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.
Usage example:
java -jar picard.jar SamToFastq
I=input.bam
FASTQ=output.fastq
Category Read Data Manipulation
Overview
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.
Usage example:
java -jar picard.jar SamToFastq \ I=input.bam \ FASTQ=output.fastq
SamToFastq (Picard) specific arguments
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 |
Argument details
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.
--arguments_file / NA
read one or more arguments files and add them to the command line
List[File] []
--CLIPPING_ACTION / -CLIP_ACT
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
--CLIPPING_ATTRIBUTE / -CLIP_ATTR
The attribute that stores the position at which the SAM record should be clipped
String null
--CLIPPING_MIN_LENGTH / -CLIP_MIN
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_OUTPUTS_PER_RG / -GZOPRG
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 / NA
Compression level for all compressed files created (e.g. BAM and VCF).
int 5 [ [ -∞ ∞ ] ]
--CREATE_INDEX / NA
Whether to create a BAM index when writing a coordinate-sorted BAM file.
Boolean false
--CREATE_MD5_FILE / NA
Whether to create an MD5 digest for any BAM or FASTQ files created.
boolean false
--FASTQ / -F
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
--GA4GH_CLIENT_SECRETS / NA
Google Genomics API client_secrets.json file path.
String client_secrets.json
--help / -h
display the help message
boolean false
--INCLUDE_NON_PF_READS / -NON_PF
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
--INCLUDE_NON_PRIMARY_ALIGNMENTS / NA
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 / -I
Input SAM/BAM file to extract reads from
R File null
--INTERLEAVE / -INTER
Will generate an interleaved fastq if paired, each line will have /1 or /2 to describe which end it came from
boolean false
--MAX_RECORDS_IN_RAM / NA
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 [ [ -∞ ∞ ] ]
--OUTPUT_DIR / -ODIR
Directory in which to output the FASTQ file(s). Used only when OUTPUT_PER_RG is true.
File null
--OUTPUT_PER_RG / -OPRG
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
--QUALITY / -Q
End-trim reads using the phred/bwa quality trimming algorithm and this quality.
Integer null
--QUIET / NA
Whether to suppress job-summary info on System.err.
Boolean false
--RE_REVERSE / -RC
Re-reverse bases and qualities of reads with negative strand flag set before writing them to FASTQ
boolean true
--READ1_MAX_BASES_TO_WRITE / -R1_MAX_BASES
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
--READ1_TRIM / -R1_TRIM
The number of bases to trim from the beginning of read 1.
int 0 [ [ -∞ ∞ ] ]
--READ2_MAX_BASES_TO_WRITE / -R2_MAX_BASES
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
--READ2_TRIM / -R2_TRIM
The number of bases to trim from the beginning of read 2.
int 0 [ [ -∞ ∞ ] ]
--REFERENCE_SEQUENCE / -R
Reference sequence file.
File null
--RG_TAG / -RGT
The read group tag (PU or ID) to be used to output a FASTQ file per read group.
String PU
--SECOND_END_FASTQ / -F2
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
--showHidden / -showHidden
display hidden arguments
boolean false
--TMP_DIR / NA
One or more directories with space available to be used by this program for temporary storage of working files
List[File] []
--UNPAIRED_FASTQ / -FU
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_JDK_DEFLATER / -use_jdk_deflater
Use the JDK Deflater instead of the Intel Deflater for writing compressed output
Boolean false
--USE_JDK_INFLATER / -use_jdk_inflater
Use the JDK Inflater instead of the Intel Inflater for reading compressed input
Boolean false
--VALIDATION_STRINGENCY / NA
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:
- STRICT
- LENIENT
- SILENT
ValidationStringency STRICT
--VERBOSITY / NA
Control verbosity of logging.
The --VERBOSITY argument is an enumerated type (LogLevel), which can have one of the following values:
- ERROR
- WARNING
- INFO
- DEBUG
LogLevel INFO
--version / NA
display the version number for this tool
boolean false
GATK version 4.0.5.2 built at 25-50-2019 01:50:01.
0 comments
Please sign in to leave a comment.