An example of how counts are typically filtered using the package functions.

library(CIMseq.data)
library(printr)

Load the counts data. This would usually be done with the read.table function but here we use a small test dataset that represents typical input of HTSeq generated counts.

data(testingCounts, package = "CIMseq.data")

Move the gene names to rownames.

testingCounts <- moveGenesToRownames(testingCounts)
testingCounts

Remove the .htseq suffix from colnames.

testingCounts <- removeHTSEQsuffix(testingCounts)
testingCounts

Label samples as singlets or multiplets.

testingCounts <- labelSingletsAndMultiplets(testingCounts, LETTERS[1:5])
testingCounts

Detect non-genes reported by HTSeq.

nonGenes <- detectNonGenes(testingCounts)
nonGenes
testingCounts <- testingCounts[!nonGenes, ]
testingCounts

Detect ERCC reads.

ercc <- detectERCCreads(testingCounts)
ercc
testingERCC <- testingCounts[ercc, ]
testingCounts <- testingCounts[!ercc, ]
testingERCC
testingCounts

Detect low quality genes.

lqg <- detectLowQualityGenes(testingCounts, 18)
lqg
testingCounts <- testingCounts[lqg, ]
testingCounts

Detect low quality cells (samples). Low quality cell detection can also be done with detectLowQualityCells.ERCCfrac which uses ERCC reads to detect cells with a high fraction ERCC.

lqc.totalCounts <- detectLowQualityCells.totalCounts(testingCounts, mincount = 25)
lqc.housekeeping <- detectLowQualityCells.housekeeping(testingCounts, geneName = "ACTB", quantileCut = 0.01)
lqc <- lqc.totalCounts & lqc.housekeeping
testingCounts <- testingCounts[, lqc]
testingCounts

Convert counts to a matrix.

testingCounts <- convertCountsToMatrix(testingCounts)
testingCounts


jasonserviss/sp.scRNAseqData documentation built on Jan. 8, 2020, 11:46 a.m.