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
274 stars 32 forks source link

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

Open erwusht opened 1 month ago

erwusht commented 1 month ago

Hi,

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

Thank you very much!

Starlitnightly commented 1 month 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
}