scatrans.generate_gene_features_from_gtf#
- scatrans.generate_gene_features_from_gtf(gtf_path, output_name=None, organism='mouse')[source]#
Generate a gene features parquet (gene_length + intron_number) from a GTF.
This is the recommended way to create custom tables for human or non-standard annotations so that bias correction in active_score() can be used.
gene_length: proper union of all exon intervals of the gene (fixed from an earlier “sum all transcripts” bug).
intron_number: heuristic = (max number of exons among any transcript of the gene) - 1. This is only an approximation: - Uses the “most exon-rich” transcript as a proxy for the gene. - Does not perform coordinate-level union of intron intervals across isoforms. - The main/canonical transcript may differ from the max-exon one. See source comments in generate_gene_features_from_gtf for details.
Requires the gtfparse package (installed via pip install “scatrans[gene_features]”).
- After generation, attach the result with:
adata = scat.add_gene_features(adata, gene_features_path=”your_output.parquet”)
Long-running step (GTF parsing). Progress is emitted via the ‘scatrans’ logger. When used from the CLI entrypoint, the CLI configures logging so messages appear.
- Parameters:
gtf_path (str) – Path to a 10X Genomics or GENCODE genes.gtf file (must contain “exon” and “gene” features).
output_name (str, optional) – Output parquet filename. If None, auto-generated as {organism}_gene_features.parquet.
organism (str, default "mouse") – Only used for default output naming; the generated table itself is generic.