Starlitnightly / omicverse

A python library for multi omics included bulk, single cell and spatial RNA-seq analysis.
https://starlitnightly.github.io/omicverse/
GNU General Public License v3.0
481 stars 58 forks source link

Request for bulk count to CPM/TPM/FPKM function #83

Open erwusht opened 6 months ago

erwusht commented 6 months ago

Hi,

Is there any plan to add a function that converts count to CPM/TPM/FPKM?

Thank you very much!

Starlitnightly commented 6 months ago

@JuliaMYQ, Please add a function that converts count to CPM/TPM/FPKM in omicvese.bulk._Deseq2.py file, and named this function normalize_bulk, argument type='CPM'/'TPM'/'FPKM'/'RPKM'. If you need any additional parameters, please add them yourself.

The TPM formula in R like:

tpm <- function(counts, lengths) {
  rate <- counts / lengths
  rate / sum(rate) * 1e6
}