I want to compare two bam files to see whether they are same, how many reads they overlapped, and how many reads are unique. bam1 file was got several years ago and then I convert it to bam1_r1_fq and bam1_r2_fq and then remap to the new reference genome and got new sam file. Then I sorted, added header etc and got the bam2 file. When I use
samtools view -f 64 -F 2304 bam1 | cut -f 1,3,4 | LC_ALL=C sort -t ' ' -k 1,1 > bam1.txt
samtools view -f 64 -F 2304 bam2 | cut -f 1,3,4 | LC_ALL=C sort -t ' ' -k 1,1 > bam2.txt
join -t ' ' -1 1 -2 1 bam1.txt bam2.txt > bam.comparaison
I got error like this :
join: bam1.txt:4077: is not sorted: HWI-D00222:175:H7C06ADXX:2:1101:1250:20054 MT 10679
join: bam2.txt:4077 is not sorted: HWI-D00222:175:H7C06ADXX:2:1101:1250:20054 MT 10679
Then I want to try "cmpbams" that @Pierre Lindenbaum wrote, and it showed
mkdir -p lib/com/github/samtools/htsjdk/2.9.1/ && curl -Lk -o "lib/com/github/samtools/htsjdk/2.9.1/htsjdk-2.9.1.jar" "http://central.maven.org/maven2/com/github/samtools/htsjdk/2.9.1/htsjdk-2.9.1.jar"
/bin/bash: curl: command not found
maven.mk:102: recipe for target 'lib/com/github/samtools/htsjdk/2.9.1/htsjdk-2.9.1.jar' failed
make: *** [lib/com/github/samtools/htsjdk/2.9.1/htsjdk-2.9.1.jar] Error 127
How can I fix one of this problem or both? Thanks ahead.
Yes, I need to install other programs. It works now. Thanks