Question: Differences between two SAM/BAM files with samtools
0
gravatar for dshulgin
4.9 years ago by
dshulgin250
Belarus
dshulgin250 wrote:

Hi everyone. I'd like to compare thwo bam files from two different aligners ti find overlaps, multiply alignments,unique reads in each bam file etc. I was looking for simple tutorial of samtools to do that, but it is still unclear for me (tjere are to many options and flags and i'm puzzled with it).

Could someone help me? What is the best way to compare outputs of different aligners? 

Thanks a lot,

snp alignment • 4.6k views
ADD COMMENTlink modified 4.9 years ago by Pierre Lindenbaum131k • written 4.9 years ago by dshulgin250
2
gravatar for Pierre Lindenbaum
4.9 years ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum131k wrote:

comparing the first in pair using the RNAME,CHROM,POS, columns:

samtools view -f 64 -F 2304 method1.bam | cut -f1,3,4 | LC_ALL=C sort -t '\t' -k1,1 > method1.txt
samtools view -f 64 -F 2304 method2.bam | cut -f1,3,4 | LC_ALL=C sort -t '\t' -k1,1 > method2.txt
join -t '\t' -1 1 -2 1 method1.txt method2.txt > R1.comparaison
ADD COMMENTlink modified 10 months ago by RamRS30k • written 4.9 years ago by Pierre Lindenbaum131k

I performed this but got empty file at each steps. Could you help me?

ADD REPLYlink modified 10 months ago by RamRS30k • written 4.9 years ago by dshulgin250

'\t' in sort is a TAB. Did you replace this?

ADD REPLYlink modified 10 months ago by RamRS30k • written 4.9 years ago by Pierre Lindenbaum131k

I wrote this way t$'\t'. Sorry for interrupting you. There is something wrong with my file. It works fine on another .bam file. Thanks.

ADD REPLYlink modified 10 months ago by RamRS30k • written 4.9 years ago by dshulgin250

Hi Pierre, I am trying to compare two bam files just like dsulgin did, but I am getting empty file out of this step -

samttools view -f 64 -F 2304 input1.bam | cut -f1,3,4 | LC_ALL=C sort -t `\t` -k1,1  > method1.txt

Can you please share what columns should I expect in this method1.txt file? I am also getting this error -

sort: multi-character tab `\\t'

thanks!

ADD REPLYlink modified 10 months ago by RamRS30k • written 4.1 years ago by PAn20
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: 956 users visited in the last hour