View source: R/truncate_and_merge_pairs.R
| truncate_and_merge_pairs | R Documentation |
Removes DNA read pairs containing ambiguous nucleotides, truncates reads by length and quality score, and merges forward and reverse reads.
truncate_and_merge_pairs(
forward_files,
reverse_files,
output_files,
truncation_length = NA,
threshold.quality_score = 3,
threshold.probability = 0.5,
minimum_overlap = 10,
cores = 1,
progress = FALSE
)
forward_files |
A character vector of file paths to FASTQ files containing forward DNA sequence reads. |
reverse_files |
A character vector of file paths to FASTQ files containing reverse DNA sequence reads. |
output_files |
A character vector of file paths to output FASTA files. |
truncation_length |
Numeric. The length to truncate DNA sequences to (passed to the |
threshold.quality_score |
Numeric. The Phred quality score threshold used for truncation (passed to the |
threshold.probability |
Numeric. The probability threshold used for truncation (passed to the |
minimum_overlap |
Numeric. The minimum length of an overlap that must be found between the end of the forward read and the start of the reverse complement of the reverse read in order for a read pair to be merged (passed to |
cores |
Numeric. If |
progress |
Logical. If |
For each pair of input FASTQ files, removes DNA read pairs containing ambiguous nucleotides, truncates reads by length, quality score threshold, and probability threshold (in that order), and then merges forward and reverse reads. Merged reads are summarized by frequency of occurrence and written to a FASTA file. See contains_wildcards, truncate_sequences.length, truncate_sequences.quality_score, truncate_sequences.probability, and merge_pairs for methods. Quality scores are assumed to be encoded in Sanger format. Forward and reverse reads can be truncated by different thresholds (see truncation_length, threshold.quality_score, and threshold.probability arguments).
Multicore parallel processing is supported on Mac and Linux operating systems (not available on Windows). When cores > 1 (parallel processing enabled), warnings and errors are printed to the console in addition to being invisibly returned as a list (see the return value section), and errors produced while processing a pair of FASTQ files will not interrupt the processing of other FASTQ file pairs. When cores = 1, FASTQ file pairs are processed sequentially on a single core, and errors will prevent the processing of subsequent FASTQ file pairs (but warnings will not).
If cores = 1, then no return value. Writes a FASTA file for each pair of input FASTQ files with DNA sequence counts stored in the header lines. If cores > 1, then also invisibly returns a list where each element contains warning or error messages associated with processing each pair of input FASTQ files. A NULL value in the returned list means that no warnings or errors were generated from processing the respective pair of FASTQ files.
A manuscript describing these methods is in preparation.
contains_wildcards for detecting ambiguous nucleotides in DNA sequences.
truncate_sequences.length for truncating DNA sequences to a specified length.
truncate_sequences.quality_score for truncating DNA sequences by Phred quality score.
truncate_sequences.probability for truncating DNA sequences by cumulative probability that all bases were called correctly.
merge_pairs for merging forward and reverse DNA sequence reads.
filter_sequences for filtering merged read pairs by PCR replicate.
# Get example forward FASTQ files.
forward_files<-system.file("extdata",
paste0("S0",1:3,"F.fastq"),
package="LocaTT",
mustWork=TRUE)
# Get example reverse FASTQ files.
reverse_files<-system.file("extdata",
paste0("S0",1:3,"R.fastq"),
package="LocaTT",
mustWork=TRUE)
# Create paths for temporary output files.
output_files<-tempfile(pattern=paste0("O",1:3),fileext=".fasta")
# Truncate and merge pairs.
truncate_and_merge_pairs(forward_files=forward_files,
reverse_files=reverse_files,
output_files=output_files)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.