Package picard.sam

Class SplitSamByLibrary


@DocumentedFeature public class SplitSamByLibrary extends CommandLineProgram
Command-line program to split a SAM/BAM/CRAM file into separate files based on library name.

This tool takes a SAM or BAM file and separates all the reads into one SAM or BAM file per library name. Reads that do not have a read group specified or whose read group does not have a library name are written to a file called 'unknown.' The format (SAM or BAM) of the output files matches that of the input file.

Inputs

  • The BAM or SAM file to be split
  • The directory where the library SAM or BAM files should be written

Output/h3>
  • One SAM or BAM file per library name

Usage example:

     java -jar picard.jar SplitSamByLibrary \
          I=input_reads.bam \
          O=/output/directory/
 

  • Field Details

    • INPUT

      @Argument(shortName="I", doc="The SAM, BAM of CRAM file to be split. ") public File INPUT
    • OUTPUT

      @Argument(shortName="O", doc="The directory where the per-library output files should be written (defaults to the current directory). ", optional=true) public File OUTPUT
    • NO_LIBRARIES_SPECIFIED_IN_HEADER

      public static final int NO_LIBRARIES_SPECIFIED_IN_HEADER
      See Also:
  • Constructor Details

    • SplitSamByLibrary

      public SplitSamByLibrary()
  • Method Details

    • 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.