Skip to main content

Python implementation of scTenifoldNet and scTenifoldKnk workflows.

Project description

scTenifoldpy

CI PyPI Python License DOI

scTenifoldpy is a Python implementation of scTenifoldNet and scTenifoldKnk workflows.

Installation

uv venv
uv pip install scTenifoldpy

or:

pip install scTenifoldpy

Optional extras:

uv venv
uv pip install "scTenifoldpy[scanpy]"
uv pip install "scTenifoldpy[parallel-ray]"
pip install "scTenifoldpy[scanpy]"
pip install "scTenifoldpy[parallel-ray]"

scTenifoldpy has no R runtime dependency. The principal-component network step is implemented in Python and uses sklearn.utils.extmath.randomized_svd.

Docker

Build the default runtime image:

docker build -t sctenifoldpy .

Run the CLI from the container, mounting the current directory as the working directory:

docker run --rm -v "$PWD:/workspace" sctenifoldpy scTenifold --help

PowerShell:

docker run --rm -v "${PWD}:/workspace" sctenifoldpy scTenifold --help

Optional extras can be included at build time:

docker build --build-arg EXTRAS=scanpy -t sctenifoldpy:scanpy .
docker build --build-arg EXTRAS=parallel-ray -t sctenifoldpy:ray .

Class API

from scTenifold.data import get_test_df
from scTenifold import scTenifoldNet

df_1 = get_test_df(n_cells=1000)
df_2 = get_test_df(n_cells=1000)

sc = scTenifoldNet(
    df_1,
    df_2,
    "X",
    "Y",
    qc_kws={"min_lib_size": 10},
    nc_kws={"backend": "serial", "n_jobs": 1},
)
result = sc.build()

High-Level API

from scTenifold import compare_networks, virtual_knockout

result = compare_networks(
    df_1,
    df_2,
    qc_kws={"min_lib_size": 10, "plot": False},
    network_kws={"n_nets": 3, "n_samp_cells": 100},
    backend="joblib-threading",
    n_jobs=4,
)

knockout = virtual_knockout(
    df_1,
    ko_genes=["NG-1"],
    qc_kws={"min_lib_size": 10, "min_percent": 0.001},
)

Parallel Backends

Network construction defaults to deterministic serial execution:

from scTenifold import make_networks

networks = make_networks(df_1, backend="serial", n_jobs=1)
networks = make_networks(df_1, backend="joblib-loky", n_jobs=4)

Supported backends are serial, joblib-loky, joblib-threading, and ray. Ray is optional and requires scTenifoldpy[parallel-ray].

CLI

scTenifold config -t 1 -p ./net_config.yml
scTenifold net -c ./net_config.yml -o ./output_folder
scTenifold knk -c ./knk_config.yml -o ./output_folder

Citation

Please cite the original scTenifoldNet paper if you use this package in scientific work: https://www.sciencedirect.com/science/article/pii/S2666389920301872

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

sctenifoldpy-0.2.0.tar.gz (39.1 kB view details)

Uploaded Source

Built Distribution

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

sctenifoldpy-0.2.0-py3-none-any.whl (38.8 kB view details)

Uploaded Python 3

File details

Details for the file sctenifoldpy-0.2.0.tar.gz.

File metadata

  • Download URL: sctenifoldpy-0.2.0.tar.gz
  • Upload date:
  • Size: 39.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sctenifoldpy-0.2.0.tar.gz
Algorithm Hash digest
SHA256 c8b5d0dc7500e0a99cfe351d05a64d3e60581a8e5897d43bae54793cca67f8f5
MD5 1368be645ebdf5500298f88b09ef4e72
BLAKE2b-256 492159f1334b5e0d51f1b3f6712aca8d765b3d9902d3eb946c3ae32b61730926

See more details on using hashes here.

Provenance

The following attestation bundles were made for sctenifoldpy-0.2.0.tar.gz:

Publisher: pypi_pub.yml on qwerty239qwe/scTenifoldpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sctenifoldpy-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: sctenifoldpy-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 38.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sctenifoldpy-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d1b78ce55950a2de2859798fe8aaaa22daa493707a9bc59fec313da36dbdab16
MD5 d3115639c342ae717397fc7b8ddef694
BLAKE2b-256 975ecd212fdbd0ea0973a695a6363fa81b6c02c2a540956b43b77cc848a35281

See more details on using hashes here.

Provenance

The following attestation bundles were made for sctenifoldpy-0.2.0-py3-none-any.whl:

Publisher: pypi_pub.yml on qwerty239qwe/scTenifoldpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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