Question: problem in converting bcf file to bam file in bcfToBam
0
gravatar for Madhuri Haque
4.7 years ago by
Uniklinik RWTH Aachen
Madhuri Haque20 wrote:

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?

 

angsd bedtobam tutorial bcftools • 1.5k views
ADD COMMENTlink modified 4.7 years ago • written 4.7 years ago by Madhuri Haque20

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 REPLYlink modified 6 months ago by RamRS27k • written 4.7 years ago by geek_y11k

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 REPLYlink modified 6 months ago by RamRS27k • written 4.7 years ago by Madhuri Haque20

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

samtools view <converted bam> | head -2
ADD REPLYlink modified 6 months ago by RamRS27k • written 4.7 years ago by geek_y11k

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 REPLYlink modified 6 months ago by RamRS27k • written 4.7 years ago by Madhuri Haque20

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 REPLYlink modified 6 months ago by RamRS27k • written 4.7 years ago by Madhuri Haque20
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 997 users visited in the last hour