This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Filtering of RNA-seq data

Hi! I'm going to filter my RNA-seq count data, and I'm wondering how I remove rows where only one sample has a count and the rest of the sample has 0 counts. I'm using DESeq and have only found how to remove sums of counts.

Thanks!

rna-seq filtering

1 answer

For example, this selects rows with all 0s, or all 0s except 1 sample. You can change the number to be more or less stringent:

filter <- apply(counts(deseq.object),1,function(x){
  sum(x==0) >= (ncol(deseq.object) - 1)
  })

# Now filter these rows
deseq.object2 <- deseq.object[!filter,]

Log in to answer this question.