# Class SortGff

java.lang.Object
picard.cmdline.CommandLineProgram
picard.annotation.SortGff

public class SortGff extends CommandLineProgram

### Summary

This tool sorts a gff3 file by coordinates, so that it can be indexed. It additionally adds flush directives where possible, which can significantly reduce the memory footprint of downstream tools. Sorting of multiple contigs can be specified by a sequence dictionary; if no sequence dictionary is specified, contigs are sorted lexicographically.

### Usage Examples

#### 1. Sort gff3 file, add flush directives. Contigs will be sorted lexicographically.

    java -jar picard.jar SortGff
         I=input.gff3
         O=output.gff3

#### 2. Sort gff3 file, add flush directives. Contigs will be sorted according to order in sequence dictionary

    java -jar picard.jar SortGff
         I=input.gff3
         O=output.gff3
         SD=dictionary.dict

## Field Summary

Fields
Modifier and Type
Field
Description
`File`
`INPUT`
`int`
`nRecordsInMemory`
`File`
`OUTPUT`
`File`
`SEQUENCE_DICTIONARY`

### Fields inherited from class CommandLineProgram

`COMPRESSION_LEVEL, CREATE_INDEX, CREATE_MD5_FILE, 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
Constructor
Description
`SortGff()`

## Method Summary

Modifier and Type
Method
Description
`protected int`
`doWork()`
Do the work after command line has been parsed.

### Methods inherited from class CommandLineProgram

`checkRInstallation, customCommandLineValidation, getCommandLine, getCommandLineParser, getCommandLineParserForArgs, getDefaultHeaders, getFaqLink, getMetricsFile, getPGRecord, getStandardUsagePreamble, getStandardUsagePreamble, getVersion, hasWebDocumentation, instanceMain, instanceMainWithExit, makeReferenceArgumentCollection, parseArgs, requiresReference, setDefaultHeaders, useLegacyParser`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### INPUT

@Argument(doc="Input Gff3 file to sort.", shortName="I") public File INPUT

### OUTPUT

@Argument(doc="Sorted Gff3 output file.", shortName="O") public File OUTPUT

### SEQUENCE_DICTIONARY

@Argument(doc="Dictionary to sort contigs by. If dictionary is not provided, contigs are sorted lexicographically.", shortName="SD", optional=true) public File SEQUENCE_DICTIONARY

### nRecordsInMemory

@Argument(doc="Number of records to hold in memory before spilling to disk", optional=true) public int nRecordsInMemory

## Constructor Details

### SortGff

public SortGff()

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