Converts a SAM or BAM file to FASTQ. Extracts read sequences and qualities from the input SAM/BAM file and writes them intothe output file in Sanger FASTQ format.See MAQ FASTQ specification for details.This tool can be used by way of a pipe to run BWA MEM on unmapped BAM (uBAM) files efficiently.
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 correctlythe original read sequence as it was generated by the sequencer.
java -jar picard.jar SamToFastq
I=input.bam
FASTQ=output.fastq
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. This tool can be used by way of a pipe to run BWA MEM on unmapped BAM (uBAM) files efficiently.
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.
java -jar picard.jar SamToFastq \ I=input.bam \ FASTQ=output.fastq
This table summarizes the command-line arguments that are specific to this tool. For more details on each argument, see the list further down below the table or click on an argument name to jump directly to that entry in the list.
Argument name(s) | Default value | Summary | |
---|---|---|---|
Required Arguments | |||
--FASTQ -F |
null | Output FASTQ file (single-end fastq or, if paired, first end of the pair FASTQ). | |
--INPUT -I |
null | Input SAM/BAM file to extract reads from | |
Optional Tool Arguments | |||
--arguments_file |
[] | read one or more arguments files and add them to the command line | |
--CLIPPING_ACTION -CLIP_ACT |
null | 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. | |
--CLIPPING_ATTRIBUTE -CLIP_ATTR |
null | The attribute that stores the position at which the SAM record should be clipped | |
--CLIPPING_MIN_LENGTH -CLIP_MIN |
0 | When performing clipping with the CLIPPING_ATTRIBUTE and CLIPPING_ACTION parameters, ensure that the resulting reads after clipping are at least CLIPPING_MIN_LENGTH bases long. If the original read is shorter than CLIPPING_MIN_LENGTH then the original read length will be maintained. | |
--COMPRESS_OUTPUTS_PER_RG -GZOPRG |
false | Compress output FASTQ files per read group using gzip and append a .gz extension to the file names. | |
--help -h |
false | display the help message | |
--INCLUDE_NON_PF_READS -NON_PF |
false | Include non-PF reads from the SAM file into the output FASTQ files. PF means 'passes filtering'. Reads whose 'not passing quality controls' flag is set are non-PF reads. See GATK Dictionary for more info. | |
--INCLUDE_NON_PRIMARY_ALIGNMENTS |
false | 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. | |
--INTERLEAVE -INTER |
false | Will generate an interleaved fastq if paired, each line will have /1 or /2 to describe which end it came from | |
--OUTPUT_DIR -ODIR |
null | Directory in which to output the FASTQ file(s). Used only when OUTPUT_PER_RG is true. | |
--OUTPUT_PER_RG -OPRG |
false | Output a FASTQ file per read group (two FASTQ files per read group if the group is paired). | |
--QUALITY -Q |
null | End-trim reads using the phred/bwa quality trimming algorithm and this quality. | |
--RE_REVERSE -RC |
true | Re-reverse bases and qualities of reads with negative strand flag set before writing them to FASTQ | |
--READ1_MAX_BASES_TO_WRITE -R1_MAX_BASES |
null | 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. | |
--READ1_TRIM -R1_TRIM |
0 | The number of bases to trim from the beginning of read 1. | |
--READ2_MAX_BASES_TO_WRITE -R2_MAX_BASES |
null | 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. | |
--READ2_TRIM -R2_TRIM |
0 | The number of bases to trim from the beginning of read 2. | |
--RG_TAG -RGT |
PU | The read group tag (PU or ID) to be used to output a FASTQ file per read group. | |
--SECOND_END_FASTQ -F2 |
null | Output FASTQ file (if paired, second end of the pair FASTQ). | |
--UNPAIRED_FASTQ -FU |
null | Output FASTQ file for unpaired reads; may only be provided in paired-FASTQ mode | |
--version |
false | display the version number for this tool | |
Optional Common Arguments | |||
--COMPRESSION_LEVEL |
5 | Compression level for all compressed files created (e.g. BAM and VCF). | |
--CREATE_INDEX |
false | Whether to create a BAM index when writing a coordinate-sorted BAM file. | |
--CREATE_MD5_FILE |
false | Whether to create an MD5 digest for any BAM or FASTQ files created. | |
--GA4GH_CLIENT_SECRETS |
client_secrets.json | Google Genomics API client_secrets.json file path. | |
--MAX_RECORDS_IN_RAM |
500000 | When writing files that need to be sorted, this will specify the number of records stored in RAM before spilling to disk. Increasing this number reduces the number of file handles needed to sort the file, and increases the amount of RAM needed. | |
--QUIET |
false | Whether to suppress job-summary info on System.err. | |
--REFERENCE_SEQUENCE -R |
null | Reference sequence file. | |
--TMP_DIR |
[] | One or more directories with space available to be used by this program for temporary storage of working files | |
--USE_JDK_DEFLATER -use_jdk_deflater |
false | Use the JDK Deflater instead of the Intel Deflater for writing compressed output | |
--USE_JDK_INFLATER -use_jdk_inflater |
false | Use the JDK Inflater instead of the Intel Inflater for reading compressed input | |
--VALIDATION_STRINGENCY |
STRICT | Validation stringency for all SAM files read by this program. Setting stringency to SILENT can improve performance when processing a BAM file in which variable-length data (read, qualities, tags) do not otherwise need to be decoded. | |
--VERBOSITY |
INFO | Control verbosity of logging. | |
Advanced Arguments | |||
--showHidden |
false | display hidden arguments |
Arguments in this list are specific to this tool. Keep in mind that other arguments are available that are shared with other tools (e.g. command-line GATK arguments); see Inherited arguments above.
read one or more arguments files and add them to the command line
List[File] []
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.
String null
The attribute that stores the position at which the SAM record should be clipped
String null
When performing clipping with the CLIPPING_ATTRIBUTE and CLIPPING_ACTION parameters, ensure that the resulting reads after clipping are at least CLIPPING_MIN_LENGTH bases long. If the original read is shorter than CLIPPING_MIN_LENGTH then the original read length will be maintained.
int 0 [ [ -∞ ∞ ] ]
Compress output FASTQ files per read group using gzip and append a .gz extension to the file names.
Exclusion: This argument cannot be used at the same time as FASTQ, SECOND_END_FASTQ, UNPAIRED_FASTQ
.
Boolean false
Compression level for all compressed files created (e.g. BAM and VCF).
int 5 [ [ -∞ ∞ ] ]
Whether to create a BAM index when writing a coordinate-sorted BAM file.
Boolean false
Whether to create an MD5 digest for any BAM or FASTQ files created.
boolean false
Output FASTQ file (single-end fastq or, if paired, first end of the pair FASTQ).
Exclusion: This argument cannot be used at the same time as OUTPUT_PER_RG, COMPRESS_OUTPUTS_PER_RG, OUTPUT_DIR, OPRG, GZOPRG
.
R File null
Google Genomics API client_secrets.json file path.
String client_secrets.json
display the help message
boolean false
Include non-PF reads from the SAM file into the output FASTQ files. PF means 'passes filtering'. Reads whose 'not passing quality controls' flag is set are non-PF reads. See GATK Dictionary for more info.
boolean false
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.
boolean false
Input SAM/BAM file to extract reads from
R File null
Will generate an interleaved fastq if paired, each line will have /1 or /2 to describe which end it came from
boolean false
When writing files that need to be sorted, this will specify the number of records stored in RAM before spilling to disk. Increasing this number reduces the number of file handles needed to sort the file, and increases the amount of RAM needed.
Integer 500000 [ [ -∞ ∞ ] ]
Directory in which to output the FASTQ file(s). Used only when OUTPUT_PER_RG is true.
File null
Output a FASTQ file per read group (two FASTQ files per read group if the group is paired).
Exclusion: This argument cannot be used at the same time as FASTQ, SECOND_END_FASTQ, UNPAIRED_FASTQ
.
boolean false
End-trim reads using the phred/bwa quality trimming algorithm and this quality.
Integer null
Whether to suppress job-summary info on System.err.
Boolean false
Re-reverse bases and qualities of reads with negative strand flag set before writing them to FASTQ
boolean true
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.
Integer null
The number of bases to trim from the beginning of read 1.
int 0 [ [ -∞ ∞ ] ]
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.
Integer null
The number of bases to trim from the beginning of read 2.
int 0 [ [ -∞ ∞ ] ]
Reference sequence file.
File null
The read group tag (PU or ID) to be used to output a FASTQ file per read group.
String PU
Output FASTQ file (if paired, second end of the pair FASTQ).
Exclusion: This argument cannot be used at the same time as OUTPUT_PER_RG, COMPRESS_OUTPUTS_PER_RG, OPRG, GZOPRG
.
File null
display hidden arguments
boolean false
One or more directories with space available to be used by this program for temporary storage of working files
List[File] []
Output FASTQ file for unpaired reads; may only be provided in paired-FASTQ mode
Exclusion: This argument cannot be used at the same time as OUTPUT_PER_RG, COMPRESS_OUTPUTS_PER_RG, OPRG, GZOPRG
.
File null
Use the JDK Deflater instead of the Intel Deflater for writing compressed output
Boolean false
Use the JDK Inflater instead of the Intel Inflater for reading compressed input
Boolean false
Validation stringency for all SAM files read by this program. Setting stringency to SILENT can improve performance when processing a BAM file in which variable-length data (read, qualities, tags) do not otherwise need to be decoded.
The --VALIDATION_STRINGENCY argument is an enumerated type (ValidationStringency), which can have one of the following values:
ValidationStringency STRICT
Control verbosity of logging.
The --VERBOSITY argument is an enumerated type (LogLevel), which can have one of the following values:
LogLevel INFO
display the version number for this tool
boolean false
See also General Documentation | Tool Docs Index Tool Documentation Index | Support Forum
GATK version 4.0.11.0 built at 23-11-2018 02:11:49.