Sorts a SAM or BAM file. This tool sorts the input SAM or BAM file by coordinate, queryname (QNAME), or some other property of the SAM record. The SortOrder of a SAM/BAM file is found in the SAM file header tag @HD in the field labeled SO.
java -jar picard.jar SortSam I=input.bam O=sorted.bam SORT_ORDER=coordinate
INPUT (File) The BAM or SAM file to sort. Required.
OUTPUT (File) The sorted BAM or SAM output file. Required.
SORT_ORDER (SortOrder) Sort order of output file Required. Possible values: {unsorted, queryname, coordinate, duplicate}