Package picard.sam
Class ReorderSam
java.lang.Object
picard.cmdline.CommandLineProgram
picard.sam.ReorderSam
Reorders a SAM/BAM input file according to the order of contigs in a second reference file.
Summary
Not to be confused with SortSam which sorts a SAM or BAM file with a valid sequence dictionary, ReorderSam reorders reads in a SAM/BAM file to match the contig ordering in a provided reference file, as determined by exact name matching of contigs. Reads mapped to contigs absent in the new reference are unmapped. Runs substantially faster if the input is an indexed BAM file.Example
java -jar picard.jar ReorderSam \ INPUT=sample.bam \ OUTPUT=reordered.bam \ SEQUENCE_DICTIONARY=reference_with_different_order.dict
Caveats
Note that REFERENCE_SEQUENCE is used for reading the INPUT, (e.g. when reading cram files) not for determining the order of the OUTPUT. For that you must specify the SEQUENCE_DICTIONARY argument.-
Field Summary
FieldsModifier and TypeFieldDescriptionboolean
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
Modifier and TypeMethodDescriptionprotected int
doWork()
Do the work after command line has been parsed.Methods inherited from class picard.cmdline.CommandLineProgram
checkRInstallation, customCommandLineValidation, getCommandLine, getCommandLineParser, getCommandLineParserForArgs, getDefaultHeaders, getFaqLink, getMetricsFile, getPGRecord, getStandardUsagePreamble, getStandardUsagePreamble, getVersion, hasWebDocumentation, instanceMain, instanceMainWithExit, makeReferenceArgumentCollection, parseArgs, requiresReference, setDefaultHeaders, useLegacyParser
-
Field Details
-
INPUT
-
OUTPUT
@Argument(shortName="O", doc="Output file (SAM/BAM/CRAM) to write extracted reads to.") public File OUTPUT -
SEQUENCE_DICTIONARY
@Argument(shortName="SD", doc="A Sequence Dictionary for the OUTPUT file (can be read from one of the following file types (SAM, BAM, CRAM, VCF, BCF, Interval List, Fasta, or Dict)") public File SEQUENCE_DICTIONARY -
ALLOW_INCOMPLETE_DICT_CONCORDANCE
@Argument(shortName="S", doc="If true, allows only a partial overlap of the original contigs with the new reference sequence contigs. By default, this tool requires a corresponding contig in the new reference for each read contig") public boolean ALLOW_INCOMPLETE_DICT_CONCORDANCE -
ALLOW_CONTIG_LENGTH_DISCORDANCE
@Argument(shortName="U", doc="If true, then permits mapping from a read contig to a new reference contig with the same name but a different length. Highly dangerous, only use if you know what you are doing.") public boolean ALLOW_CONTIG_LENGTH_DISCORDANCE
-
-
Constructor Details
-
ReorderSam
public ReorderSam()
-
-
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 classCommandLineProgram
- Returns:
- program exit status.
-