Hi, Can anyone tell me that how to filter primary alignment from the bam file. i have paired end data and mapped the data on genome using bwa. Now, i want to filter reads that have primary alignment from bam file because i want to identify SNPs and its important that i should remove secondary align reads from the bam file. i searched for the answer but do not get satisfactory answer. So please anyone can tell me that how to get reads from bam.
Thanks & Regards Deepika
As far as I know variant callers will take this into account so you don't have to worry about this.
Thank you for your response. Would you please tell me which software do you use for variant calling. ??
We use GATK and samtools.
Thank you !!!
In samtools, people used this command : samtools faidx NC_012967.1.fasta
samtools view -b -S -o SRR030257.bam SRR030257.sam
samtools sort SRR030257.bam -o SRR030257.sorted.bam
samtools index SRR030257.sorted.bam
samtools mpileup -u -f NC_012967.1.fasta SRR030257.sorted.bam > SRR030257.bcf
bcftools call -v -c SRR030257.bcf > SRR030257.vcf
but i have question related to this, you said variant caller will take this into account. So, should i use sam file as its as that i got from mapping. i should not filter those reads that map multiple positions on genome. i mean to say that pick the best aligned reads from sam/bam file. i am so confused because i read so many papers and search for answer in forum but still do not get clear vision on that. If you give me advise something then i will be grateful to you.
Thanks
I suggest you to follow the best practices from gatk.