Package picard.sam

Class FixMateInformation


  • @DocumentedFeature
    public class FixMateInformation
    extends CommandLineProgram

    Summary

    This tool ensures that all mate-pair information is in sync between each read and its mate pair. If no OUTPUT file is supplied then the output is written to a temporary file and then copied over the INPUT file (with the original placed in a .old file.) Reads marked with the secondary alignment flag are written to the output file unchanged. However, supplementary reads are corrected so that they point to the primary, non-supplemental mate record.

    Usage example:

     java -jar picard.jar FixMateInformation \
           I=input.bam \
           O=fixed_mate.bam \
           ADD_MATE_CIGAR=true
     

    Caveats

    The program should run with fairly limited memory unless there are many mate pairs that are missing or far apart from each other in the file, as it keeps track of the unmatched mates
    • Field Detail

      • INPUT

        @Argument(shortName="I",
                  doc="The input files to check and fix. Multiple files will be merged and sorted.")
        public List<File> INPUT
      • OUTPUT

        @Argument(shortName="O",
                  optional=true,
                  doc="The output file to write to. If no output file is supplied, the input file is overwritten (only available with single input file).")
        public File OUTPUT
      • SORT_ORDER

        @Argument(shortName="SO",
                  optional=true,
                  doc="Optional sort order if the OUTPUT file should be sorted differently than the INPUT file.")
        public htsjdk.samtools.SAMFileHeader.SortOrder SORT_ORDER
      • ASSUME_SORTED

        @Argument(doc="If true, assume that the input file is queryname sorted, even if the header says otherwise.",
                  shortName="AS")
        public boolean ASSUME_SORTED
      • ADD_MATE_CIGAR

        @Argument(shortName="MC",
                  optional=true,
                  doc="Adds the mate CIGAR tag (MC) if true, does not if false.")
        public Boolean ADD_MATE_CIGAR
      • IGNORE_MISSING_MATES

        @Argument(doc="If true, ignore missing mates, otherwise will throw an exception when missing mates are found.",
                  optional=true)
        public Boolean IGNORE_MISSING_MATES
      • out

        protected htsjdk.samtools.SAMFileWriter out
    • Constructor Detail

      • FixMateInformation

        public FixMateInformation()
    • Method Detail

      • main

        public static void main​(String[] args)
      • doWork

        protected int doWork()
        Description copied from class: CommandLineProgram
        Do the work after command line has been parsed. RuntimeException may be thrown by this method, and are reported appropriately.
        Specified by:
        doWork in class CommandLineProgram
        Returns:
        program exit status.
      • createSamFileWriter

        protected void createSamFileWriter​(htsjdk.samtools.SAMFileHeader header)
      • writeAlignment

        protected void writeAlignment​(htsjdk.samtools.SAMRecord sam)
      • closeWriter

        protected void closeWriter()