readsToTarget {CrispRVariants} | R Documentation

## 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, ...)

    ## S4 method for signature 'GAlignments,GRanges'
    readsToTarget(reads, target, ...,
      reverse.complement = TRUE, chimeras = NULL, collapse.pairs = FALSE,
      use.consensus = FALSE, store.chimeras = FALSE, verbose = TRUE,
      name = NULL, minoverlap = NULL, orientation = c("target", "opposite",
      "positive"))

    ## S4 method for signature 'GAlignmentsList,GRanges'
    readsToTarget(reads, target, ...,
      reference = reference, names = NULL, reverse.complement = TRUE,
      target.loc = 17, chimeras = NULL, collapse.pairs = FALSE,
      use.consensus = FALSE, orientation = c("target", "opposite", "positive"),
      minoverlap = NULL, verbose = TRUE)

    ## S4 method for signature 'character,GRanges'
    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, orientation = c("target",
      "opposite", "positive"), names = NULL, minoverlap = NULL,
      verbose = TRUE)

    readsToTargets(reads, targets, ...)

    ## S4 method for signature 'character,GRanges'
    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(),
      orientation = c("target", "opposite", "positive"), chimera.to.target = 5,
      verbose = TRUE)

    ## S4 method for signature 'GAlignmentsList,GRanges'
    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,
      orientation = c("target", "opposite", "positive"), 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` | (Default: TRUE) Should the alignments be oriented to match the strand of the target? If TRUE, targets located strand and targets on the negative strand with respect to the negative strand. If FALSE, the parameter 'orientation' must be set to determine the orientation. 'reverse.complement' will be replaced by 'orientation' in a later release.
`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.
`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)
`minoverlap` | Minimum number of bases the aligned read must share with the target site. If not specified, the aligned read must completely span the target region. (Default: NULL)
`orientation` | One of "target" (reads are displayed on the same strand as the target) "opposite" (reads are displayed on the opposite) strand from the target or "positive" (reads are displayed on the forward strand regardless of the strand of the target) (Default:"target")
`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

### Author(s)

Helen Lindsay

### Examples

    # 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)

[Package CrispRVariants version 1.16.0 Index]