Skip to content

Instantly share code, notes, and snippets.

@lindenb
Created February 2, 2011 09:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lindenb/807481 to your computer and use it in GitHub Desktop.
Save lindenb/807481 to your computer and use it in GitHub Desktop.
test if one or more BAM files are sorted
moved to: https://github.com/lindenb/samtools-utilities/blob/master/src/bamsorted.c
> for F in `find ~/tmp/ -name "*.bam"`; do echo $F; samtools index ${F} ; done
/home/lindenb/tmp/GALAXY/galaxy-dist/test-data/sam_merge_out2.bam
/home/lindenb/tmp/GALAXY/galaxy-dist/test-data/sam_merge_in1.bam
/home/lindenb/tmp/GALAXY/galaxy-dist/test-data/srma_out1.bam
/home/lindenb/tmp/GALAXY/galaxy-dist/test-data/srma_out2.bam
/home/lindenb/tmp/GALAXY/galaxy-dist/test-data/sam_merge_in3.bam
/home/lindenb/tmp/GALAXY/galaxy-dist/test-data/sam_merge_in2.bam
/home/lindenb/tmp/GALAXY/galaxy-dist/test-data/1.bam
/home/lindenb/tmp/GALAXY/galaxy-dist/test-data/srma_in1.bam
/home/lindenb/tmp/GALAXY/galaxy-dist/test-data/sam_to_bam_out1.bam
/home/lindenb/tmp/GALAXY/galaxy-dist/test-data/3.bam
[bam_index_core] the alignment is not sorted (HWI-EAS91_1_30788AAXX:1:1:799:192): 14955 > 8420 in 46-th chr
/home/lindenb/tmp/GALAXY/galaxy-dist/test-data/srma_in3.bam
/home/lindenb/tmp/GALAXY/galaxy-dist/test-data/sam_pileup_in1.bam
/home/lindenb/tmp/GALAXY/galaxy-dist/test-data/sam_to_bam_out2.bam
/home/lindenb/tmp/GALAXY/galaxy-dist/lib/galaxy/datatypes/test/1.bam
/home/lindenb/tmp/GALAXY/galaxy-dist/lib/galaxy/datatypes/test/3.bam
[bam_index_core] the alignment is not sorted (HWI-EAS91_1_30788AAXX:1:1:799:192): 14955 > 8420 in 46-th chr
> for F in `find ~/tmp/ -name "*.bam"`; do ./a.out ${F} ; done
/home/lindenb/tmp/GALAXY/galaxy-dist/test-data/sam_merge_out2.bam OK
/home/lindenb/tmp/GALAXY/galaxy-dist/test-data/sam_merge_in1.bam OK
/home/lindenb/tmp/GALAXY/galaxy-dist/test-data/srma_out1.bam OK
/home/lindenb/tmp/GALAXY/galaxy-dist/test-data/srma_out2.bam OK
/home/lindenb/tmp/GALAXY/galaxy-dist/test-data/sam_merge_in3.bam OK
/home/lindenb/tmp/GALAXY/galaxy-dist/test-data/sam_merge_in2.bam OK
/home/lindenb/tmp/GALAXY/galaxy-dist/test-data/1.bam OK
/home/lindenb/tmp/GALAXY/galaxy-dist/test-data/srma_in1.bam OK
/home/lindenb/tmp/GALAXY/galaxy-dist/test-data/sam_to_bam_out1.bam OK
/home/lindenb/tmp/GALAXY/galaxy-dist/test-data/3.bam Unsorted: On Reference[45]="chrM" position=8420 after 14955.
/home/lindenb/tmp/GALAXY/galaxy-dist/test-data/srma_in3.bam OK
/home/lindenb/tmp/GALAXY/galaxy-dist/test-data/sam_pileup_in1.bam OK
/home/lindenb/tmp/GALAXY/galaxy-dist/test-data/sam_to_bam_out2.bam OK
/home/lindenb/tmp/GALAXY/galaxy-dist/lib/galaxy/datatypes/test/1.bam OK
/home/lindenb/tmp/GALAXY/galaxy-dist/lib/galaxy/datatypes/test/3.bam Unsorted: On Reference[45]="chrM" position=8420 after 14955.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment