reference for freebayes or samtools mpileup after extracting chromosome from alignment
2
0
Entering edit mode
21 months ago
poecile.pal ▴ 50

Good evening,

I have extracted one chromosome from alignment map (.bam), using samtools view:

samtools view -b map.bam chr1 > map_chr1.bam

Now I would like to perform SNP calling using freebayes. Is it correct to use chr1.fasta as reference file (not full genome)? Like this:

freebayes --genotype-qualities -f chr1.fasta map_chr1.bam > map_chr1_vars.vcf

It confuses me that other chromosomes are preserved in the .bam header (even after samtools view chr1). Will it interfere with the work of freebayes that he will expect a full reference based on the .bam header, and will receive only part of it (although he needs only it)?

Similar question for samtools mpileup (if I decide to use it as alternative):

 samtools mpileup -f chr1.fasta -o map_chr1_vars.bcf map_chr1.bam

Of course, after indexing chr1.fasta (using samtools faidx) and getting .fai.

Thank you in advance!

Best regards,
Poecile

samtools SNP alignment freebayes • 1.3k views
ADD COMMENT
1
Entering edit mode
21 months ago
poecile.pal ▴ 50

I launched both variants and got the same results! It seems to me that both options are applicable, even the option of using the full genome, because thanks to the presence of .fai, a quick search for the desired chromosome chr1 is possible.

ADD COMMENT
1
Entering edit mode
20 months ago
jkbonfield ★ 1.3k

There's no need to extract just one chromosome and produce a new fasta file, as the full genome fasta will be indexed and both samtools mpileup and freebayes will just fetch the bit they need when analysing the data. That said, it shouldn't harm either.

Also the headers contain all the other chromosomes because even after extracting just one chr from your total alignment to produce a new BAM, those alignments may have read-pairs in other chromosomes and they'll be reported in the MRNAME SAM column. It's harmless to have the SQ entries. Mpileup won't be fetching and using those sequences.

ADD COMMENT
0
Entering edit mode

Thank you so much for the answer! This gives me confidence in the correctness of actions.

ADD REPLY

Login before adding your answer.

Traffic: 2169 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