Skip to contents

countBarcodedReads() and countBarcodedReadsFromContig() match exogenous DNA barcode sequences to their associated cell barcodes and saves them to the colData (cell barcode metadata) of TapestriExperiment. countBarcodedReads() is a shortcut for countBarcodedReadsFromContig(), allowing the user to specify 'gRNA' or 'barcode' to use the grnaCounts or barcodeCounts altExp slots. The entries in the barcode.lookup table do not have to be present in the sample, allowing users to keep one master table/file of available barcode sequences for use in all experiments. The Rsamtools and Biostrings packages must be installed to use these functions.

Usage

countBarcodedReads(
  TapestriExperiment,
  bam.file,
  barcode.lookup,
  probe,
  return.table = FALSE,
  max.mismatch = 2,
  with.indels = FALSE,
  ...
)

countBarcodedReadsFromContig(
  bam.file,
  barcode.lookup,
  contig,
  cell.barcode.tag = "RG",
  max.mismatch = 2,
  with.indels = FALSE
)

Arguments

TapestriExperiment

TapestriExperiment object

bam.file

File path of BAM file. .bai BAM index file must be in the same location (can be generated using Rsamtools::indexBam()).

barcode.lookup

data.frame where the first column is the barcode identifier/name and the second column is the DNA sequence. Headers are ignored.

probe

Character, either "gRNA" or "barcode" to parse counts from grnaCounts or barcodeCounts altExp slots, respectively.

return.table

Logical, if TRUE, returns table of read counts per barcode. If FALSE, returns TapestriExperiment. Default FALSE.

max.mismatch

Numeric, the maximum and minimum number of mismatching letters allowed. Default 2.

with.indels

If TRUE, then indels are allowed. Default FALSE.

...

Arguments to pass on to countBarcodedReadsFromContig().

contig

Character, contig or chromosome name to search for barcodes in. Can be a vector of more than one contig to expand search space.

cell.barcode.tag

Character of length 2, indicates cell barcode field in BAM, specified by Tapestri pipeline (currently "RG"). Default "RG".

Value

TapestriExperiment with barcoded read counts added to colData.

A data.frame of read counts for each specified barcode.

Examples

if (FALSE) {
counts <- countBarcodedReads(
  TapestriExperiment,
  bam.file, barcode.lookup, "gRNA"
)
}
if (FALSE) {
counts <- countBarcodedReadsFromContig(bam.file, barcode.lookup, "virus_ref2")
}