I want to filter out genes with low expression values.
Previously, I used the expFilter()
function from the EMA package. However, EMA seems to be deprecated.
What alternative R library can I use?
I want to filter out genes with low expression values.
Previously, I used the expFilter()
function from the EMA package. However, EMA seems to be deprecated.
What alternative R library can I use?
Just adding an answer for future.
I would learn how to do these filtering steps using base R functions. For example, we can generate vectors of Boolean values that can be used for filtering in these ways:
filt <- apply(expr, 1, mean) > 10
expr.filt <- expr[filt,]
filt <- apply(expr, 1, sum) > 100
expr.filt <- expr[filt,]
filt <- apply(expr, 2, sd) > 3
expr.filt <- expr[,filt]
Other mathematical functions include min()
, max()
, var()
, etc
If there are NA values in your data, try something like:
filt <- apply(expr, 1, function(x) mean(x, na.rm = TRUE)) > 10
Other convenience functions include colSums()
, rowSums()
, colMeans()
, rowMeans()
Please also be aware of matrixStats package, which is somewhat needed as datasets become larger, like scRNA-seq datasets: https://cran.rstudio.com/web/packages/matrixStats/index.html
Kevin
Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
I like
filterByExpr
in edgeR (for a matrix of counts).I tried
filterByExpr
but my code removed 48464 genes out of 54675 genes, which seems like an overkill. Is there a bug in my code?It would be best to see your input data. Aside from that,
min.total.count
, which is similar to filtering by rowSums