readsToTarget: Trims reads to a target region.

Description Usage Arguments Value Author(s) Examples

Description

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

Usage

 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
28
29
30
31
32
33
34
35
36
37
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)

## 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, 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, names = 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(),
  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,
  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

Author(s)

Helen Lindsay

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# 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)

markrobinsonuzh/CrispRVariants documentation built on May 21, 2019, 12:23 p.m.