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 dropped. Runs substantially faster if the input is an indexed BAM file.
java -jar picard.jar ReorderSam
INPUT (File) Input file (bam or sam) to extract reads from. Required.
OUTPUT (File) Output file (bam or sam) to write extracted reads to. Required.
REFERENCE (File) Reference sequence to reorder reads to match. A sequence dictionary corresponding to the reference fasta is required. Create one with CreateSequenceDictionary.jar. Required.
ALLOW_INCOMPLETE_DICT_CONCORDANCE (Boolean) If true, then allows only a partial overlap of the BAM contigs with the new reference sequence contigs. By default, this tool requires a corresponding contig in the new reference for each read contig Default value: false. This option can be set to 'null' to clear the default value. Possible values: {true, false}
ALLOW_CONTIG_LENGTH_DISCORDANCE (Boolean) 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. Default value: false. This option can be set to 'null' to clear the default value. Possible values: {true, false}