miRTop / mirtop

command lines tool to annotate miRNAs with a standard mirna/isomir naming
https://mirtop.readthedocs.org
MIT License
17 stars 23 forks source link

Implement DESeq2 like normalization #22

Open lpantano opened 6 years ago

lpantano commented 6 years ago

Add the code that from a count matrix, can get the size factor to normalize the data.

So, input would be: count data and output: normalized count data.

In R the code is like this:

loggeomeans <- rowMeans(log(counts))
sf <- apply(counts, 2, function(cnts) {
      exp(median((log(cnts) - loggeomeans)[is.finite(loggeomeans) & cnts > 0]))
    })
sf <- sf/exp(mean(log(sf)))
t(t(counts)/sf)

This code can be inside libs/math.py

shruthibandyadka commented 6 years ago

Is this count matrix the one created in gff/convert.py ? (example file at data/examples/gff/gff_tsv_expression_counts.tsv)

lpantano commented 6 years ago

Hi! This would be to do an extra step from that matrix. So, the idea is once you have the matrix, apply this calculation to get a normalize one.