Learn R Programming

CrispRVariants (version 1.0.2)

readsToTarget: Trims reads to a target region.

Description

Trims aligned reads to one or several target regions, optionally reverse complementing the alignments.

Usage

readsToTarget(reads, target, ...)
"readsToTarget"(reads, target, ..., reverse.complement = TRUE, chimeras = NULL, collapse.pairs = FALSE, use.consensus = FALSE, store.chimeras = FALSE, verbose = TRUE, name = NULL)
"readsToTarget"(reads, target, ..., reference = reference, names = NULL, reverse.complement = TRUE, target.loc = 17, chimeras = NULL, collapse.pairs = FALSE, use.consensus = FALSE, verbose = TRUE)
"readsToTarget"(reads, target, ..., reference, reverse.complement = TRUE, target.loc = 17, exclude.ranges = GRanges(), exclude.names = NA, chimeras = c("count", "exclude", "ignore", "merge"), collapse.pairs = FALSE, use.consensus = FALSE, names = NULL, verbose = TRUE)
readsToTargets(reads, targets, ...)
"readsToTargets"(reads, targets, ..., references, primer.ranges = NULL, target.loc = 17, reverse.complement = TRUE, collapse.pairs = FALSE, use.consensus = FALSE, ignore.strand = TRUE, names = NULL, bpparam = BiocParallel::SerialParam(), chimera.to.target = 5, verbose = TRUE)
"readsToTargets"(reads, targets, ..., references, primer.ranges = NULL, target.loc = 17, reverse.complement = TRUE, collapse.pairs = FALSE, use.consensus = FALSE, ignore.strand = TRUE, names = NULL, bpparam = BiocParallel::SerialParam(), chimera.to.target = 5, verbose = TRUE)

Arguments

reads
A GAlignments object, or a character vector of the filenames
target
A GRanges object specifying the range to narrow alignments to
...
Extra arguments for initialising CrisprSet
reverse.complement
Should the alignments be oriented to match the strand of the target? (Default: TRUE)
chimeras
Flag to determine how chimeric reads are treated. One of "ignore", "exclude", and "merge". Default "count", "merge" not implemented yet
collapse.pairs
If reads are paired, should pairs be collapsed? (Default: FALSE) Note: only collapses primary alignments, and assumes that there is only one primary alignment per read. May fail with blat alignments converted to bam.
use.consensus
Take the consensus sequence for non-matching pairs? If FALSE, the sequence of the first read is used. Can be very slow. (Default: FALSE)
store.chimeras
Should chimeric reads be stored? (Default: FALSE)
verbose
Print progress and statistics (Default: TRUE)
name
An experiment name for the reads. (Default: NULL)
reference
The reference sequence
names
Experiment names for each bam file. If not supplied, filenames are used.
target.loc
The zero point for renumbering (Default: 17)
exclude.ranges
Ranges to exclude from consideration, e.g. homologous to a pcr primer.
exclude.names
Alignment names to exclude
targets
A set of targets to narrow reads to
references
A set of reference sequences matching the targets. References for negative strand targets should be on the negative strand.
primer.ranges
A set of GRanges, corresponding to the targets. Read lengths are typically greater than target regions, and it can be that reads span multiple targets. If primer.ranges are available, they can be used to assign such reads to the correct target.
ignore.strand
Should strand be considered when finding overlaps? (See findOverlaps )
bpparam
A BiocParallel parameter for parallelising across reads. Default: no parallelisation. (See bpparam)
chimera.to.target
Number of bases that may separate a chimeric read set from the target.loc for it to be assigned to the target. (Default: 5)

Value

(signature("GAlignments", "GRanges")) A CrisprRun object(signature("character", "GRanges")) A CrisprSet object

Examples

Run this code
# Load the metadata table
md_fname <- system.file("extdata", "gol_F1_metadata_small.txt", package = "CrispRVariants")
md <- read.table(md_fname, sep = "\t", stringsAsFactors = FALSE)

# Get bam filenames and their full paths
bam_fnames <- sapply(md$bam.filename, function(fn){
 system.file("extdata", fn, package = "CrispRVariants")})

reference <- Biostrings::DNAString("GGTCTCTCGCAGGATGTTGCTGG")
gd <- GenomicRanges::GRanges("18", IRanges::IRanges(4647377, 4647399),
       strand = "+")

crispr_set <- readsToTarget(bam_fnames, target = gd, reference = reference,
                           names = md$experiment.name, target.loc = 17)

Run the code above in your browser using DataLab