filter_zerorow: Filter variants with zero allele counts in all cells

Description Usage Arguments Value Examples

View source: R/scphaser.R

Description

filter_zerorow removes variants which do no have any read count

Usage

1

Arguments

acset

An acset list which must contain "refcount" and "altcount" elements with allele counts, see new_acset.

Value

acset An acset list subsetted on variants that pass the filter.

Examples

 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
##create small artifical allele count matrixes where first row is zero
ncells = 10
ref = c(0, 10, 1, 5, 2, 9)
alt = c(0, 2, 5, 5, 6, 3)        
refcount = as.matrix(as.data.frame(rep(list(ref, alt), ncells / 2)))
altcount = as.matrix(as.data.frame(rep(list(alt, ref), ncells / 2)))

vars = 1:nrow(refcount)
samples = 1:ncells
colnames(refcount) = samples
rownames(refcount) = vars
colnames(altcount) = samples
rownames(altcount) = vars

##create a feature annotation data-frame
nvars = length(vars)
featdata = as.data.frame(matrix(cbind(rep('jfeat', nvars),
as.character(1:nvars), rep('dummy', nvars), rep('dummy', nvars)), ncol = 4,
dimnames = list(vars, c('feat', 'var', 'ref', 'alt'))), stringsAsFactors =
FALSE)

##create acset
acset = new_acset(featdata, altcount = altcount, refcount = refcount)

##Remove variants having no allele counts
acset_filt = filter_zerorow(acset)

scphaser documentation built on May 29, 2017, 3:49 p.m.