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.6.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.6.0.tar.gz (1.0 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.6.0-py3-none-any.whl (121.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for scfair-0.6.0.tar.gz
Algorithm Hash digest
SHA256 c82d55fe7de1dd8be92f59c19891159e1ea8d27795a74e241e9ad3f70c21bfad
MD5 b5aeacc36d1078df6df7a228884fc0dd
BLAKE2b-256 27e9e352329fcc0741583d39a8432923c8216f12c48465e6418c4bc71f6553ef

See more details on using hashes here.

Provenance

The following attestation bundles were made for scfair-0.6.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.6.0-py3-none-any.whl.

File metadata

  • Download URL: scfair-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 121.2 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.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d1fa147b286aeb9022fd901d1c32116c339620650726f9697ab3d8bd40b5e352
MD5 e858e4174e5d8a512c79da4dc209a2d4
BLAKE2b-256 c27199535cf345ace86fee67cfb2d761d02cc71d75c70b3183a247d3ec3842d6

See more details on using hashes here.

Provenance

The following attestation bundles were made for scfair-0.6.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