Service note: Geraldine is on vacation this week; other members of GSA will be responding to questions, but they have a lot of work besides this, so be aware that responses may be a little slower than usual. Thank you for your patience.

Companion Utilities: ReorderSam

delangeldelangel Posts: 61GSA Official Member mod

ReorderSam

The GATK can be particular about the ordering of a BAM file. If you find yourself in the not uncommon situation of having created or received BAM files sorted in a bad order, you can use the tool ReorderSam to generate a new BAM file where the reads have been reordered to match a well-ordered reference file.

java -jar picard/ReorderSam.jar I= lexicographc.bam O= kayrotypic.bam REFERENCE= Homo_sapiens_assembly18.kayrotypic.fasta

This tool requires you have a correctly sorted version of the reference sequence you used to align your reads. This tool will drop reads that don't have equivalent contigs in the new reference (potentially bad, but maybe not). If contigs have the same name in the bam and the new reference, this tool assumes that the alignment of the read in the new BAM is the same. This is not a lift over tool!

The tool, though once in the GATK, is now part of the Picard package.

Post edited by Geraldine_VdAuwera on

Comments

  • mehaffeymgmehaffeymg Posts: 1Member

    Hello, I am running picard-1.79 ReorderSam. The bam file was created using a non-GATK acceptable order. I have another .fa file with matching .dict file I use all the time for the GATK pipeline. However, when trying to reorder these bam files - that contain additional contigs - the ReorderSam tool reorders chrM-chrY fine and then throws this exception: Exception in thread "main" net.sf.picard.PicardException: New reference sequence does not contain a matching contig for chr6_ssto_hap7 I thought these reads were supposed to be discarded by the ReorderSam tool. Suggestions?

  • Geraldine_VdAuweraGeraldine_VdAuwera Posts: 2,239Administrator, GSA Official Member admin

    I would suggest asking the Picard team, who are responsible for supporting this tool. We can't help you with this, sorry.

    Geraldine Van der Auwera, PhD

Sign In or Register to comment.