Compute size factors based on the coverage of spike-in transcripts.
Usage
## S4 method for signature 'SCESet'
computeSpikeFactors(x)
Arguments
x
A SCESet object containing rows corresponding spike-in transcripts.
Details
The size factor for each cell is defined as the sum of all spike-in counts in each cell.
This is equivalent to normalizing to equalize spike-in coverage between cells.
Spike-in counts are assumed to be stored in rows with fData(x)$is_control_feature – see ?isSpike<- for more details.
Note that the geometric mean of all size factors is set to unity, for standardization purposes if one were to compare different sets of size factors.
Value
An object of class x is returned, containing a numeric vector of size factors for all cells in sizeFactors(x).
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(scran)
Loading required package: BiocParallel
Loading required package: scater
Loading required package: Biobase
Loading required package: BiocGenerics
Loading required package: parallel
Attaching package: 'BiocGenerics'
The following objects are masked from 'package:parallel':
clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
clusterExport, clusterMap, parApply, parCapply, parLapply,
parLapplyLB, parRapply, parSapply, parSapplyLB
The following objects are masked from 'package:stats':
IQR, mad, xtabs
The following objects are masked from 'package:base':
Filter, Find, Map, Position, Reduce, anyDuplicated, append,
as.data.frame, cbind, colnames, do.call, duplicated, eval, evalq,
get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply,
match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank,
rbind, rownames, sapply, setdiff, sort, table, tapply, union,
unique, unsplit
Welcome to Bioconductor
Vignettes contain introductory material; view with
'browseVignettes()'. To cite Bioconductor, see
'citation("Biobase")', and for packages 'citation("pkgname")'.
Loading required package: ggplot2
Attaching package: 'scater'
The following object is masked from 'package:stats':
filter
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/scran/computeSpikeFactors.Rd_%03d_medium.png", width=480, height=480)
> ### Name: Spike-in normalization
> ### Title: Normalization with spike-in counts
> ### Aliases: computeSpikeFactors computeSpikeFactors,SCESet-method
> ### Keywords: normalization
>
> ### ** Examples
>
> set.seed(100)
> popsize <- 200
> ngenes <- 1000
> all.facs <- 2^rnorm(popsize, sd=0.5)
> counts <- matrix(rnbinom(ngenes*popsize, mu=all.facs*10, size=1), ncol=popsize, byrow=TRUE)
> spikes <- matrix(rnbinom(100*popsize, mu=all.facs*10, size=0.5), ncol=popsize, byrow=TRUE)
>
> combined <- rbind(counts, spikes)
> colnames(combined) <- seq_len(popsize)
> rownames(combined) <- seq_len(nrow(combined))
> y <- newSCESet(countData=combined)
> isSpike(y) <- rep(c(FALSE, TRUE), c(ngenes, 100))
> out.facs <- computeSpikeFactors(y)
>
>
>
>
>
> dev.off()
null device
1
>