Skip to main content

Fair highly variable gene selection for single-cell RNA-seq

Project description

scFair

PyPI version Python versions Documentation Status CI License

scFair selects highly variable genes (HVGs) for single-cell RNA-seq while giving small cell populations a fairer chance at the gene list.

Standard HVG ranking is driven by the largest populations. Markers that matter for rare types can fall just below the cutoff even when they are exactly what you need later for clustering or annotation. scFair keeps a familiar global ranking as the backbone and, by default, appends a small extension from the same ranking so near-miss genes are not discarded.

Docs: Read the Docs.

What you need

  • Python 3.10+ (tested 3.10–3.12)
  • An AnnData object with raw integer counts in .X or layers["counts"]

Install

pip install scfair

First run

import scfair as scf

# raw integer counts in .X or layers["counts"]
scf.pp.highly_variable_genes(adata)

adata = adata[:, adata.var["highly_variable"]].copy()

That is the default path: one global HVG pass, then a small append of the next genes in the same ranking. Runtime is on the same order as scanpy.pp.highly_variable_genes.

To let the data suggest how many genes to keep:

scf.pp.highly_variable_genes(adata, n_top_genes="auto")

To match scanpy with no extension:

scf.pp.highly_variable_genes(adata, balance_method="none")

Status

0.5.0 (Beta). Import as import scfair as scf and use names in scfair.__all__ and scf.pp. See the API reference.

Next steps

  1. Installation
  2. Quickstart
  3. Tutorial: PBMC 10k misclustered cells vs standard HVG
  4. FAQ if something looks off

License

Software: Apache License 2.0.

Author

Zhao Li (李钊)
Email: leelieber@gmail.com

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

scfair-0.5.0.tar.gz (1.2 MB view details)

Uploaded Source

Built Distribution

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

scfair-0.5.0-py3-none-any.whl (120.9 kB view details)

Uploaded Python 3

File details

Details for the file scfair-0.5.0.tar.gz.

File metadata

  • Download URL: scfair-0.5.0.tar.gz
  • Upload date:
  • Size: 1.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for scfair-0.5.0.tar.gz
Algorithm Hash digest
SHA256 87e5d77f1f6381c61c2f6b91adad65332245f235553c4b37daa82ae57474f12f
MD5 d6193b65d427d71a63a7d668a3c4d960
BLAKE2b-256 318eac940b95d961ad36ac49d0eb03c35f616743341650c21d03008ce7dc2df9

See more details on using hashes here.

Provenance

The following attestation bundles were made for scfair-0.5.0.tar.gz:

Publisher: publish.yml on leelieber2025/scFair

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

File details

Details for the file scfair-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: scfair-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 120.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for scfair-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 876555fc3a33ef2d448601561107a56cb7edb7e26b9f4673a5bb4fe1d50f5dd1
MD5 d57bc60bb74717e04a2e77e48c611673
BLAKE2b-256 d48f35f1f69143f6f90b3a316e8b83461e85351621d1dfdd039ce6c54e8b8321

See more details on using hashes here.

Provenance

The following attestation bundles were made for scfair-0.5.0-py3-none-any.whl:

Publisher: publish.yml on leelieber2025/scFair

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