Skip to main content

Find active genes in bulk RNA-seq data

Reason this release was yanked:

incorrect release

Project description

zfpkm

Overview

This package performs zFPKM on RNA-seq FPKM data. This implementation is adapted from ronammar/zFPKM, which was originally based on Hart et al. 2013 (PMID24215113). The original article recommends selecting an active/inactive cutoff at -3; this value was selected based on experimental data that indicated the number of active promoters becomes more than the number of repressed promoters Figure 1.

Installation

This package can be installed from GitHub or PyPi

PyPi

python3 -m pip install zfpkm

Latest GitHub Version

python3 -m pip install git+https://github.com/JoshLoecker/zfpkm.git

Usage

To calculate zFPKM, simply import the zfpkm function and provide the raw, non-normalized FPKM values as a pandas DataFrame. The row names of the input dataframe should be the genomic identifier (Entrez IDs, Ensembl IDs, Gene Symbols, etc.) and the column names should be the sample name. The returned DataFrame will have the same number of rows and columns (in the same order provided) with a modified z-transformation applied.

import pandas as pd

from zfpkm import zFPKM, zfpkm_plot


def main():
    fpkm = pd.read_csv("fpkm.csv", index_col=0, header=0)
    zfpkm_df, zfpkm_results = zFPKM(fpkm)
    zfpkm_df.to_csv("zfpkm.csv", index=True)
    zfpkm_plot(zfpkm_results, save_filepath="zfpkm_density.png")


if __name__ == "__main__":
    main()

Results

Expected zFPKM Distribution

The following figure shows the expected FPKM ('fpkm_density', in teal) and zFPKM ('fpkm_density_scaled', in salmon). The Gaussian curve is fit to the peak of the FPKM density distribution. Values > -3 can be marked as active. Expected zFPKM

Figure 1: The expected zFPKM Gaussian distribution overlaid on the FPKM distribution

Actual zFPKM Distribution (from this package)

The following figure shows the calculated zFPKM from this package. Like Figure 1, the FPKM ('fpkm_density', in teal) and zFPKM ('fpkm_density_scaled', in salmon) are overlaid on the highest FPKM peak.

Example code showing how this graph was generated can be found in examples/example_zfpkm.py.

Actual zFPKM

Figure 2: The actual zFPKM Gaussian distribution from this package overlaid on the FPKM distribution

Comparison with scikit-learn and scipy

Figure 3 and 4, below, were generated with scikit-learn==1.7.2 and scipy==1.16.3, respsectively. These figures, while very similar to the expected and actual zFPKM distributions, have several noteable differences:

  1. The maximum density is ~37% greater than the expected and actual zFPKM distributions (~0.131 expected vs ~0.180 for scikit-learn and scipy)
  2. The left-hand of the FPKM density distribution is much smoother than the expected results; this comes specifically from a larger bandwidth value than the original R source.

Taken together, this results in the final zFPKM scores using scikit-learn or scipy being similar to, but distinct enough, from the expected values to potentially cause problems in downstream analysis.

scikit-learn zFPKM

Figure 3: scikit-learn FPKM ('fpkm_density', in teal) & zFPKM ('fitted_density_scaled', in salmon) distribution

scipy zFPKM

Figure 4: scipy FPKM ('fpkm_density', in teal) & zFPKM ('fitted_density_scaled', in salmon) distribution

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zfpkm-0.1.0.tar.gz (15.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zfpkm-0.1.0-py3-none-any.whl (18.3 kB view details)

Uploaded Python 3

File details

Details for the file zfpkm-0.1.0.tar.gz.

File metadata

  • Download URL: zfpkm-0.1.0.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.7

File hashes

Hashes for zfpkm-0.1.0.tar.gz
Algorithm Hash digest
SHA256 25e4660f62c4c0eea8744f06d05ae07aecbd1dc931d7e812522cbe9c93951809
MD5 9ead0920c4d64a7030e440d6082db795
BLAKE2b-256 7fba58be4b5daa36989f3f6753a5c0087e41fc00cd3541397b6afda5890326a1

See more details on using hashes here.

File details

Details for the file zfpkm-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: zfpkm-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 18.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.7

File hashes

Hashes for zfpkm-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 370d3c60b31d3507d609a7a846c690ccd1399e1a5381c5170e842c6822a60077
MD5 f88511c9c6f07a22c809f910c577dc78
BLAKE2b-256 f0f56a8f4b71699b7721028d135d4b3b4dfcdf31bc6fcc6791b16e13a78d5692

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page