sctools.metrics.gatherer.GatherGeneMetrics¶
- class sctools.metrics.gatherer.GatherGeneMetrics(bam_file: str, output_stem: str, mitochondrial_gene_ids: Set[str] = {}, compress: bool = True)[source]¶
..currentmodule:: sctools.metrics
This module defines classes to gather metrics across the cells or genes of an experiment and write them to gzip-compressed csv files
MetricGatherer(bam_file, output_stem, …)Gathers Metrics from an experiment
GatherCellMetrics(bam_file, output_stem, …)Sequence Metric Gatherers
GatherGeneMetrics(bam_file, output_stem, …)Sequence Metric Gatherers
See also
sctools.metrics.aggregator,sctools.metrics.merge,sctools.metrics.writerbam_filemust be sorted by molecule (UB), cell (CB), and gene (GE), where molecule varies fastest.>>> from sctools.metrics.gatherer import GatherCellMetrics >>> import os, tempfile
>>> # example data >>> bam_file = os.path.abspath(__file__) + '../test/data/test.bam' >>> temp_dir = tempfile.mkdtemp() >>> g = GatherCellMetrics(bam_file=bam_file, output_stem=temp_dir + 'test', compress=True) >>> g.extract_metrics()
GatherGeneMetrics
- __init__(bam_file: str, output_stem: str, mitochondrial_gene_ids: Set[str] = {}, compress: bool = True)¶
Methods
__init__(bam_file, output_stem[, …])extract_metrics([mode])Extract gene metrics from self.bam_file
Attributes
the bam file that metrics are generated from