problem in converting bcf file to bam file in bcfToBam
0
0
Entering edit mode
9.2 years ago

I am trying to prepare my vcf data for working with ANGSD. At first, I converted my vcf file to bed file using plink. Then tried bedToBam of BCftools to convert it to bam format. The problem is, a compressed file is generated which is not accessible. Is it happening due to the difference in the chr name in vcf and genome file as vcf file contains only the chromosome number while genome file contains 'chr'?

My another question is, what will be the genome file when I'm working with vcf files that has population specific snps in bcfToBed? The final question is, for such type of data what will be the ancestral sequence in fasta format for ANGSD?

bedToBam bcftools ANGSD • 2.6k views
ADD COMMENT
0
Entering edit mode

Too many question. Can you show the first few lines of your data?

grep -v "^#" <VCF> | head -5
head -5 <BED>
grep "^>" <reference fasta>  | head -5

a compressed file is generated which is not accessible.

BAM file is a compressed file. you need to 'view' it with samtools.

ADD REPLY
0
Entering edit mode

sorry for my clumsy questions. The problem is, when I'm trying to load the converted bam file into ANGSD, it is showing error - file can't be read.

I used the following command:

bedToBam -i African.bed -g hg38.txt > African.bam

I used plink to get the bed file from vcf file.

ADD REPLY
0
Entering edit mode

Would be good if you can show the output of commands asked above. also:

samtools view <converted bam> | head -2
ADD REPLY
0
Entering edit mode

The converted file though has .bam extension, samtools is unable to view it.

If I have a vcf file, the how can I get bam file for it?

ADD REPLY
0
Entering edit mode

When I viewed the converted .bam file in samtools, it said...

→tbbrubio@tbbrubio-B85M-HD3[gwd] samtools view gwd.bam             [ 2:19অপরাহ্ণ]
→[bam_header_read] EOF marker is absent. The input is probably truncated.
G/A_rs12677    0    chr1    197053373    255    1M    *    0    0*    *
G/A_rs1537318    0    chr1    197053394    255    1M    *    0    0*    *
C/T_rs78390689    0    chr1    197054942    255    1M    *    0    0*    *
T/C_rs185549173    0    chr1    197054969    255    1M    *    0    0
ADD REPLY

Login before adding your answer.

Traffic: 1808 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6