Description Usage Arguments Details Value See Also Examples
Filters and trims an input fastq file(s) (can be compressed) based on several user-definable criteria, and outputs fastq file(s) (compressed by default) containing those trimmed reads which passed the filters. Corresponding forward and reverse fastq file(s) can be provided as input, in which case filtering is performed on the forward and reverse reads independently, and both reads must pass for the read pair to be output.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | filterAndTrim(
fwd,
filt,
rev = NULL,
filt.rev = NULL,
compress = TRUE,
truncQ = 2,
truncLen = 0,
trimLeft = 0,
trimRight = 0,
maxLen = Inf,
minLen = 20,
maxN = 0,
minQ = 0,
maxEE = Inf,
rm.phix = TRUE,
rm.lowcomplex = 0,
orient.fwd = NULL,
matchIDs = FALSE,
id.sep = "\\s",
id.field = NULL,
multithread = FALSE,
n = 1e+05,
OMP = TRUE,
qualityType = "Auto",
verbose = FALSE
)
|
fwd |
(Required). |
filt |
(Required). |
rev |
(Optional). Default NULL.
The file path(s) to the reverse fastq file(s) from paired-end sequence data corresponding to those
provided to the |
filt.rev |
(Optional). Default NULL, but required if |
compress |
(Optional). Default TRUE. If TRUE, the output fastq file(s) are gzipped. FILTERING AND TRIMMING PARAMETERS ——— Note: When filtering paired reads... If a length 1 vector is provided, the same parameter value is used for the forward and reverse reads. If a length 2 vector is provided, the first value is used for the forward reads, and the second for the reverse reads. |
truncQ |
(Optional). Default 2.
Truncate reads at the first instance of a quality score less than or equal to |
truncLen |
(Optional). Default 0 (no truncation).
Truncate reads after |
trimLeft |
(Optional). Default 0.
The number of nucleotides to remove from the start of each read. If both |
trimRight |
(Optional). Default 0.
The number of nucleotides to remove from the end of each read. If both |
maxLen |
(Optional). Default Inf (no maximum). Remove reads with length greater than maxLen. maxLen is enforced before trimming and truncation. |
minLen |
(Optional). Default 20. Remove reads with length less than minLen. minLen is enforced after trimming and truncation. |
maxN |
(Optional). Default 0.
After truncation, sequences with more than |
minQ |
(Optional). Default 0.
After truncation, reads contain a quality score less than |
maxEE |
(Optional). Default |
rm.phix |
(Optional). Default TRUE.
If TRUE, discard reads that match against the phiX genome, as determined by |
rm.lowcomplex |
(Optional). Default 0.
If greater than 0, reads with an effective number of kmers less than this value will be removed.
The effective number of kmers is determined by |
orient.fwd |
(Optional). Default NULL. A character string present at the start of valid reads. Only allows unambiguous nucleotides. This string is compared to the start of each read, and the reverse complement of each read. If it exactly matches the start of the read, the read is kept. If it exactly matches the start of the reverse-complement read, the read is reverse-complemented and kept. Otherwise the read if filtered out. For paired reads, the string is compared to the start of the forward and reverse reads, and if it matches the start of the reverse read the reaads are swapped and kept. The primary use of this parameter is to unify the orientation of amplicon sequencing libraries that are a mixture of forward and reverse orientations, and that include the forward primer on the reads. |
matchIDs |
(Optional). Default FALSE. Paired-read filtering only.
Whether to enforce matching between the id-line sequence identifiers of the forward and reverse fastq files.
If TRUE, only paired reads that share id fields (see below) are output.
If FALSE, no read ID checking is done.
Note: |
id.sep |
(Optional). Default "\s" (white-space). Paired-read filtering only.
The separator between fields in the id-line of the input fastq files. Passed to the |
id.field |
(Optional). Default NULL (automatic detection). Paired-read filtering only. The field of the id-line containing the sequence identifier. If NULL (the default) and matchIDs is TRUE, the function attempts to automatically detect the sequence identifier field under the assumption of Illumina formatted output. |
multithread |
(Optional). Default is FALSE.
If TRUE, input files are filtered in parallel via |
n |
(Optional). Default |
OMP |
(Optional). Default TRUE.
Whether or not to use OMP multithreading when calling |
qualityType |
(Optional). |
verbose |
(Optional). Default FALSE. Whether to output status messages. |
filterAndTrim
is a multithreaded convenience interface for the fastqFilter
and fastqPairedFilter
filtering functions.
Note that error messages and tracking are not handled gracefully when using the multithreading
functionality. If errors arise, it is recommended to re-run without multithreading to
troubleshoot the issue.
Integer matrix. Returned invisibly (i.e. only if assigned to something). Rows correspond to the input files, columns record the reads.in and reads.out after filtering.
fastqFilter
fastqPairedFilter
FastqStreamer
1 2 3 4 5 | testFastqs = c(system.file("extdata", "sam1F.fastq.gz", package="dada2"),
system.file("extdata", "sam2F.fastq.gz", package="dada2"))
filtFastqs <- c(tempfile(fileext=".fastq.gz"), tempfile(fileext=".fastq.gz"))
filterAndTrim(testFastqs, filtFastqs, maxN=0, maxEE=2, verbose=TRUE)
filterAndTrim(testFastqs, filtFastqs, truncQ=2, truncLen=200, rm.phix=TRUE, rm.lowcomplex=8)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.