net.sf.picard.sam
Class SamToFastq

java.lang.Object
  extended by net.sf.picard.cmdline.CommandLineProgram
      extended by net.sf.picard.sam.SamToFastq

public class SamToFastq
extends CommandLineProgram

Extracts read sequences and qualities from the input SAM/BAM file and writes them into the output file in Sanger fastq format. See MAQ FastQ specification for details. In the RC mode (default is True), if the read is aligned and the alignment is to the reverse strand on the genome, the read's sequence from input sam file will be reverse-complemented prior to writing it to fastq in order restore correctly the original read sequence as it was generated by the sequencer.


Field Summary
 String CLIPPING_ACTION
           
 String CLIPPING_ATTRIBUTE
           
 File FASTQ
           
 boolean INCLUDE_NON_PF_READS
           
 boolean INCLUDE_NON_PRIMARY_ALIGNMENTS
           
 File INPUT
           
 boolean INTERLEAVE
           
 File OUTPUT_DIR
           
 boolean OUTPUT_PER_RG
           
 boolean RE_REVERSE
           
 Integer READ1_MAX_BASES_TO_WRITE
           
 int READ1_TRIM
           
 Integer READ2_MAX_BASES_TO_WRITE
           
 int READ2_TRIM
           
 File SECOND_END_FASTQ
           
 File UNPAIRED_FASTQ
           
 String USAGE
           
 
Fields inherited from class net.sf.picard.cmdline.CommandLineProgram
COMPRESSION_LEVEL, CREATE_INDEX, CREATE_MD5_FILE, MAX_RECORDS_IN_RAM, QUIET, TMP_DIR, VALIDATION_STRINGENCY, VERBOSITY
 
Constructor Summary
SamToFastq()
           
 
Method Summary
protected  String[] customCommandLineValidation()
          Put any custom command-line validation in an override of this method.
protected  int doWork()
          Do the work after command line has been parsed.
static void main(String[] argv)
           
 
Methods inherited from class net.sf.picard.cmdline.CommandLineProgram
getCommandLine, getCommandLineParser, getDefaultHeaders, getMetricsFile, getNestedOptions, getNestedOptionsForHelp, getProgramVersion, getStandardUsagePreamble, getVersion, instanceMain, instanceMainWithExit, parseArgs, setDefaultHeaders
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

USAGE

@Usage
public String USAGE

INPUT

@Option(doc="Input SAM/BAM file to extract reads from",
        shortName="I")
public File INPUT

FASTQ

@Option(shortName="F",
        doc="Output fastq file (single-end fastq or, if paired, first end of the pair fastq).",
        mutex="OUTPUT_PER_RG")
public File FASTQ

SECOND_END_FASTQ

@Option(shortName="F2",
        doc="Output fastq file (if paired, second end of the pair fastq).",
        optional=true,
        mutex="OUTPUT_PER_RG")
public File SECOND_END_FASTQ

UNPAIRED_FASTQ

@Option(shortName="FU",
        doc="Output fastq file for unpaired reads; may only be provided in paired-fastq mode",
        optional=true,
        mutex="OUTPUT_PER_RG")
public File UNPAIRED_FASTQ

OUTPUT_PER_RG

@Option(shortName="OPRG",
        doc="Output a fastq file per read group (two fastq files per read group if the group is paired).",
        optional=true,
        mutex={"FASTQ","SECOND_END_FASTQ","UNPAIRED_FASTQ"})
public boolean OUTPUT_PER_RG

OUTPUT_DIR

@Option(shortName="ODIR",
        doc="Directory in which to output the fastq file(s).  Used only when OUTPUT_PER_RG is true.",
        optional=true)
public File OUTPUT_DIR

RE_REVERSE

@Option(shortName="RC",
        doc="Re-reverse bases and qualities of reads with negative strand flag set before writing them to fastq",
        optional=true)
public boolean RE_REVERSE

INTERLEAVE

@Option(shortName="INTER",
        doc="Will generate an interleaved fastq if paired, each line will have /1 or /2 to describe which end it came from")
public boolean INTERLEAVE

INCLUDE_NON_PF_READS

@Option(shortName="NON_PF",
        doc="Include non-PF reads from the SAM file into the output FASTQ files.")
public boolean INCLUDE_NON_PF_READS

CLIPPING_ATTRIBUTE

@Option(shortName="CLIP_ATTR",
        doc="The attribute that stores the position at which the SAM record should be clipped",
        optional=true)
public String CLIPPING_ATTRIBUTE

CLIPPING_ACTION

@Option(shortName="CLIP_ACT",
        doc="The action that should be taken with clipped reads: \'X\' means the reads and qualities should be trimmed at the clipped position; \'N\' means the bases should be changed to Ns in the clipped region; and any integer means that the base qualities should be set to that value in the clipped region.",
        optional=true)
public String CLIPPING_ACTION

READ1_TRIM

@Option(shortName="R1_TRIM",
        doc="The number of bases to trim from the beginning of read 1.")
public int READ1_TRIM

READ1_MAX_BASES_TO_WRITE

@Option(shortName="R1_MAX_BASES",
        doc="The maximum number of bases to write from read 1 after trimming. If there are fewer than this many bases left after trimming, all will be written.  If this value is null then all bases left after trimming will be written.",
        optional=true)
public Integer READ1_MAX_BASES_TO_WRITE

READ2_TRIM

@Option(shortName="R2_TRIM",
        doc="The number of bases to trim from the beginning of read 2.")
public int READ2_TRIM

READ2_MAX_BASES_TO_WRITE

@Option(shortName="R2_MAX_BASES",
        doc="The maximum number of bases to write from read 2 after trimming. If there are fewer than this many bases left after trimming, all will be written.  If this value is null then all bases left after trimming will be written.",
        optional=true)
public Integer READ2_MAX_BASES_TO_WRITE

INCLUDE_NON_PRIMARY_ALIGNMENTS

@Option(doc="If true, include non-primary alignments in the output.  Support of non-primary alignments in SamToFastq is not comprehensive, so there may be exceptions if this is set to true and there are paired reads with non-primary alignments.")
public boolean INCLUDE_NON_PRIMARY_ALIGNMENTS
Constructor Detail

SamToFastq

public SamToFastq()
Method Detail

main

public static void main(String[] argv)

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.

customCommandLineValidation

protected String[] customCommandLineValidation()
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 class CommandLineProgram
Returns:
null if command line is valid. If command line is invalid, returns an array of error messages to be written to the appropriate place.