-
Notifications
You must be signed in to change notification settings - Fork 132
CmpBamAndBuild
Pierre Lindenbaum edited this page Mar 7, 2014
·
4 revisions
##Motivation
Compare two BAM files mapped on two different builds. Requires a liftover chain file.
##Compilation
See also Compilation.
$ ant cmpbamsandbuild
##Synopsis
$ java -jar distcmpbamsandbuild.jar [options] -c A_to_B.chain bamA.bam bamB.bam
##Options
Option | Description |
---|---|
-c (chain file) | Lift Over file from bam1 to bam2. REQUIRED |
-d (dist) | distance tolerance between two alignments. |
-r (region) | restrict to that region chr:start-end |
-n (int) | When writing data that need to be sorted, this will specify the number of records stored in RAM before spilling to disk. Increasing this number reduces the number of file handles needed to sort a SAM file, and increases the amount of RAM needed. Optional. |
-T (dir) | Add a temporary directory. Optional. |
-h | get help (this screen) and exit. |
-v | print version and exit. |
-L (level) | log level. One of java.util.logging.Level . Optional. |
##Source Code
Main code is: https://github.com/lindenb/jvarkit/blob/master/src/main/java/com/github/lindenb/jvarkit/tools/cmpbams/CompareBamAndBuild.java
##Example The following Makefile compares two BAMs mapped on hg19 and hg38.
BWA=bwa
SAMTOOLS=samtools
.PHONY:all
all: file.diff
file.diff.gz : hg19ToHg38.over.chain hg19.bam hg38.bam
java -jar jvarkit-git/dist/cmpbamsandbuild.jar -d 20 \
-c hg19ToHg38.over.chain hg19.bam hg38.bam | gzip --best > $@
hg38.bam:file1.fastq.gz file2.fastq.gz
${BWA} mem index-bwa-0.7.6a/hg38.fa $^ |\
${SAMTOOLS} view -Sb - |\
${SAMTOOLS} sort - hg38 && \
${SAMTOOLS} index hg38.bam
hg19.bam: file1.fastq.gz file2.fastq.gz
${BWA} mem index-bwa-0.7.6a/hg19.fa $^ |\
${SAMTOOLS} view -Sb - |\
${SAMTOOLS} sort - hg19 && \
${SAMTOOLS} index hg19.bam
hg19ToHg38.over.chain:
curl -o $@.gz http://hgdownload.cse.ucsc.edu/goldenPath/hg19/liftOver/$@.gz && gunzip -f $@.gz
file.diff :
#READ-Name COMPARE hg19.bam hg38.bam
HWI-1KL149:18:C0RNBACXX:3:1101:10375:80749/2 NE chrMasked:581319279->chrMasked:581415967 chrMasked:581703411
HWI-1KL149:18:C0RNBACXX:3:1101:10394:60111/1 NE chrMasked:581319428->chrMasked:581416116 chrMasked:581703560
HWI-1KL149:18:C0RNBACXX:3:1101:10394:60111/2 NE chrMasked:581319428->chrMasked:581416116 chrMasked:581703560
HWI-1KL149:18:C0RNBACXX:3:1101:10413:69955/1 NE chrMasked:581318674->chrMasked:581415362 chrMasked:581702806
HWI-1KL149:18:C0RNBACXX:3:1101:10413:69955/2 NE chrMasked:581318707->chrMasked:581415395 chrMasked:581702839
HWI-1KL149:18:C0RNBACXX:3:1101:10484:89477/1 NE chrMasked:581319428->chrMasked:581416116 chrMasked:581703560
HWI-1KL149:18:C0RNBACXX:3:1101:10484:89477/2 NE chrMasked:581319428->chrMasked:581416116 chrMasked:581703560
HWI-1KL149:18:C0RNBACXX:3:1101:10527:3241/1 NE chrMasked:581319279->chrMasked:581415967 chrMasked:581703411
HWI-1KL149:18:C0RNBACXX:3:1101:10527:3241/2 NE chrMasked:581319279->chrMasked:581415967 chrMasked:581703411
HWI-1KL149:18:C0RNBACXX:3:1101:10580:13030/1 NE chrMasked:581319331->chrMasked:581416019 chrMasked:581703463
HWI-1KL149:18:C0RNBACXX:3:1101:10580:13030/2 NE chrMasked:581319331->chrMasked:581416019 chrMasked:581703463
HWI-1KL149:18:C0RNBACXX:3:1101:10618:51813/1 EQ chrMasked:581318674->chrMasked:581415362 chrMasked:581415362
HWI-1KL149:18:C0RNBACXX:3:1101:10618:51813/2 NE chrMasked:581318707->chrMasked:581415395 chrMasked:581702839
HWI-1KL149:18:C0RNBACXX:3:1101:10803:23593/1 NE chrMasked:581319091->chrMasked:581415779 chrMasked:581703223
HWI-1KL149:18:C0RNBACXX:3:1101:10803:23593/2 NE chrMasked:581319091->chrMasked:581415779 chrMasked:581703223
HWI-1KL149:18:C0RNBACXX:3:1101:11290:76217/1 EQ chrMasked:581318674->chrMasked:581415362 chrMasked:581415362
HWI-1KL149:18:C0RNBACXX:3:1101:11290:76217/2 NE chrMasked:581318707->chrMasked:581415395 chrMasked:581702839
HWI-1KL149:18:C0RNBACXX:3:1101:11307:71853/1 NE chrMasked:581319254->chrMasked:581415942 chrMasked:581703386
HWI-1KL149:18:C0RNBACXX:3:1101:11307:71853/2 NE chrMasked:581319258->chrMasked:581415946 chrMasked:581703390
HWI-1KL149:18:C0RNBACXX:3:1101:11359:100655/1 EQ chrMasked:581318923->chrMasked:581415611 chrMasked:581415611
HWI-1KL149:18:C0RNBACXX:3:1101:11359:100655/2 EQ chrMasked:581318923->chrMasked:581415611 chrMasked:581415611
HWI-1KL149:18:C0RNBACXX:3:1101:11467:8793/1 NE chrMasked:581319428->chrMasked:581416116 chrMasked:581703560
HWI-1KL149:18:C0RNBACXX:3:1101:11467:8793/2 NE chrMasked:581319428->chrMasked:581416116 chrMasked:581703560
HWI-1KL149:18:C0RNBACXX:3:1101:11560:69825/1 EQ chrMasked:581319331->chrMasked:581416019 chrMasked:581416019
HWI-1KL149:18:C0RNBACXX:3:1101:11560:69825/2 EQ chrMasked:581319335->chrMasked:581416023 chrMasked:581416023
##See also
##History
- 2014: Creation