Skip to main content

Python implementation of BayesPrism

Project description

This is a Python implementation of BayesPrism.

Usage

import os
import pandas as pd
from pybayesprism import process_input, prism, extract

os.system("curl -L -O https://github.com/ziluwang829/pyBayesPrism/raw/main/data/data.tar.gz")
os.system("mkdir -p BP_data")
os.system("tar -xzvf data.tar.gz -C BP_data")

bk_dat = pd.read_csv("BP_data/bk_dat.csv", sep=",", index_col=0)
sc_dat = pd.read_csv("BP_data/sc_dat.csv", sep=",", index_col=0)


cell_state_labels = pd.read_csv("BP_data/cell_state_labels.csv", header=None).iloc[:,0].tolist()

cell_type_labels = pd.read_csv("BP_data/cell_type_labels.csv", header=None).iloc[:,0].tolist()

sc_dat_filtered = process_input.cleanup_genes(sc_dat, "count.matrix", "hs", \
                  ["Rb", "Mrp", "other_Rb", "chrM", "MALAT1", "chrX", "chrY"], 5)
                  
sc_dat_filtered_pc = process_input.select_gene_type(sc_dat_filtered, ["protein_coding"])

my_prism = prism.Prism.new(reference = sc_dat_filtered_pc, 
                          mixture = bk_dat, input_type = "count.matrix", 
                          cell_type_labels = cell_type_labels, 
                          cell_state_labels = cell_state_labels, 
                          key = "tumor", 
                          outlier_cut = 0.01, 
                          outlier_fraction = 0.1)

bp_res = my_prism.run(n_cores = 36, update_gibbs = True)     

theta = extract.get_fraction(bp_res, "final", "type")

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

pybayesprism-0.1.0.tar.gz (1.5 MB view details)

Uploaded Source

Built Distribution

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

pybayesprism-0.1.0-py3-none-any.whl (1.5 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pybayesprism-0.1.0.tar.gz
  • Upload date:
  • Size: 1.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for pybayesprism-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7ce59a07eb0f5edcd9b840a311886c654e369fa1e62f0ee1569388fdbc91bc3e
MD5 cb83b94f8ce5da39b3176658b0640207
BLAKE2b-256 3a20339f9b912ecf6fb8a5ef10cedfa245f07939d29eeaf3195bff69c4874450

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pybayesprism-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for pybayesprism-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 90f167259b563c9a1f48fdb6a766f7dc7d287bde8062acb461733745d5aaa99a
MD5 3c8f62865e31895af98f621787ee3f14
BLAKE2b-256 a4fd3735bc5bf8c1db77cb0954f1c281b42a50e01e20f2315c97cdd3d0ff78a0

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