Package picard.sam
Class MergeSamFiles
java.lang.Object
picard.cmdline.CommandLineProgram
picard.sam.MergeSamFiles
This tool is used for combining SAM and/or BAM files from different runs or read groups into a single file, similar
to the \"merge\" function of Samtools (http://www.htslib.org/doc/samtools.html).
Note that to prevent errors in downstream processing, it is critical to identify/label read groups appropriately. If different samples contain identical read group IDs, this tool will avoid collisions by modifying the read group IDs to be unique. For more information about read groups, see the GATK Dictionary entry.
Note that to prevent errors in downstream processing, it is critical to identify/label read groups appropriately. If different samples contain identical read group IDs, this tool will avoid collisions by modifying the read group IDs to be unique. For more information about read groups, see the GATK Dictionary entry.
Usage example:
java -jar picard.jar MergeSamFiles \\
I=input_1.bam \\
I=input_2.bam \\
O=output_merged_files.bam
-
Field Summary
FieldsModifier and TypeFieldDescriptionboolean
boolean
htsjdk.samtools.SAMFileHeader.SortOrder
boolean
Fields inherited from class picard.cmdline.CommandLineProgram
COMPRESSION_LEVEL, CREATE_INDEX, CREATE_MD5_FILE, GA4GH_CLIENT_SECRETS, MAX_ALLOWABLE_ONE_LINE_SUMMARY_LENGTH, MAX_RECORDS_IN_RAM, QUIET, REFERENCE_SEQUENCE, referenceSequence, specialArgumentsCollection, SYNTAX_TRANSITION_URL, TMP_DIR, USE_JDK_DEFLATER, USE_JDK_INFLATER, VALIDATION_STRINGENCY, VERBOSITY
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class picard.cmdline.CommandLineProgram
checkRInstallation, getCommandLine, getCommandLineParser, getCommandLineParserForArgs, getDefaultHeaders, getFaqLink, getMetricsFile, getPGRecord, getStandardUsagePreamble, getStandardUsagePreamble, getVersion, hasWebDocumentation, instanceMain, instanceMainWithExit, makeReferenceArgumentCollection, parseArgs, requiresReference, setDefaultHeaders, useLegacyParser
-
Field Details
-
INPUT
-
OUTPUT
-
SORT_ORDER
@Argument(shortName="SO", doc="Sort order of output file", optional=true) public htsjdk.samtools.SAMFileHeader.SortOrder SORT_ORDER -
ASSUME_SORTED
@Argument(doc="If true, assume that the input files are in the same sort order as the requested output sort order, even if their headers say otherwise.", shortName="AS") public boolean ASSUME_SORTED -
MERGE_SEQUENCE_DICTIONARIES
@Argument(shortName="MSD", doc="Merge the sequence dictionaries", optional=true) public boolean MERGE_SEQUENCE_DICTIONARIES -
USE_THREADING
@Argument(doc="Option to create a background thread to encode, compress and write to disk the output file. The threaded version uses about 20% more CPU and decreases runtime by ~20% when writing out a compressed BAM/CRAM file.") public boolean USE_THREADING -
COMMENT
-
INTERVALS
@Argument(shortName="RGN", doc="An interval list file that contains the locations of the positions to merge. Assume sam are sorted and indexed. The resulting file will contain alignments that may overlap with genomic regions outside the requested region. Unmapped reads are discarded.", optional=true) public File INTERVALS
-
-
Constructor Details
-
MergeSamFiles
public MergeSamFiles()
-
-
Method Details
-
doWork
protected int doWork()Combines multiple SAM/BAM/CRAM files into one.- Specified by:
doWork
in classCommandLineProgram
- Returns:
- program exit status.
-
customCommandLineValidation
Description copied from class:CommandLineProgram
Put any custom command-line validation in an override of this method. clp is initialized at this point and can be used to print usage and access argv. Any options set by command-line parser can be validated.- Overrides:
customCommandLineValidation
in classCommandLineProgram
- Returns:
- null if command line is valid. If command line is invalid, returns an array of error message to be written to the appropriate place.
-