Learn R Programming

CrispRVariants (version 1.0.2)

mergeCrisprSets: Merge two CrisprSets

Description

Merge two CrisprSet objects sharing a reference and target location

Usage

mergeCrisprSets(x, y, ...)
"mergeCrisprSets"(x, y, ..., x.samples = NULL, y.samples = NULL, names = NULL, order = NULL)

Arguments

x
A CrisprSet object
y
A second CrisprSet object
...
extra arguments
x.samples
A subset of column names or indices to keep from CrispRSet x (Default: NULL, i.e. keep all)
y.samples
A subset of column names or indices to keep from CrispRSet y (Default: NULL, i.e. keep all)
names
New names for the merged CrisprSet object (Default: NULL)
order
A list of sample names, matching the names in x and y, specifying the order of the samples in the new CrisprSet. (Not implemented yet)

Value

A merged 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_set1 <- readsToTarget(bam_fnames[c(1:4)], target = gd,
      reference = reference, names = md$experiment.name[1:4], target.loc = 17)
crispr_set2 <- readsToTarget(bam_fnames[c(5:8)], target = gd,
      reference = reference, names = md$experiment.name[5:8], target.loc = 17)
mergeCrisprSets(crispr_set1,crispr_set2)

Run the code above in your browser using DataLab