API Reference¶
- scParams.cellMetadata¶
This mapping specifies which cells belong to each sample and cell group.
Type: a dictionary specifying the file path and column names for a CSV, TSV, or AnnData
.obssource.The
pathcan be one ofCSV/TSV file (optionally gzipped): contains cell metadata with columns for barcodes (
barcodeColumn), sample IDs (sampleColumn), and group labels (groupColumn)AnnData (.h5ad) file: contains cell metadata in the
.obstable.
Field
Type
Use
pathstrRequired. A
.csv,.tsv, or.h5adfile. CSV/TSV may use.gz.barcodeColumnstr | NoneCell identifier column. Required for CSV/TSV. Omit this for AnnData/H5AD so that
.obs_namesis usedsampleColumnstr | NoneColumn used to match metadata rows to an input sample, e.g.
librarybelow. Required when the metadata file covers multiple input samples.groupColumnstr | NoneCell-group column, such as
cellType. Required for group selection.Example.
cells.csv¶ barcode
library
cellType
AAACGAAAGTACGCCC-1
PBMC_01
CD4_T
AAACGAACAGCTACAT-1
PBMC_01
B_cell
AAACGAAGTCGTTGGC-1
PBMC_01
NK_cell
AAACGAAAGTACGCCC-1
PBMC_02
CD8_T
AAACGAATCTTACGGA-1
PBMC_02
B_cell
AAACGAAGTACAGCGA-1
PBMC_02
CD4_T
For the
cells.csvtable above, specify the column names underscParams.cellMetadatain the Consenrich YAML:scParams: cellMetadata: path: cells.csv barcodeColumn: barcode sampleColumn: library groupColumn: cellType
With
sampleColumn: library, an input namedPBMC_01is matched to the three rows labelledPBMC_01. If that input is namedreplicate1, you would setmetadataSample: PBMC_01on the input to keep the same match.
- scParams.fits¶
Use this to specify multiple Consenrich jobs for different cell groups within the same dataset, in one YAML file. See, for example, the scATAC-seq example.
Type:
list[dict[str, str | list[str]]] | None.Default:
None(one run without a fit list).Each entry requires
nameandselectGroups:name(str) names the output directory, e.g.TCells. Must be uniqueselectGroups(list[str]) holds one or more unique labels fromgroupColumn, matched exactly
# ...other consenrich config... scParams: fits: - {name: TCells, selectGroups: [CD4_T, CD8_T]} # Run a fit for T cells - {name: BCells, selectGroups: [B_cell]} # and run a fit for B cells, too
- inputParams.samples¶
Input files and source-specific settings.
Type:
list[str | dict[str, Any]] | None. Default:None.Supply a nonempty list. H5AD counts require a mapping with
matrixRows.Field
Type
Use / default
pathstrRequired. E.g.
library1.fragments.tsv.gzorlibrary1.h5ad.namestr | NoneOutput label and default metadata sample identifier. Default:
None.cellMetadatadict[str, str | None] | NoneReplaces
scParams.cellMetadatafor that source. Default:Noneuses the shared setting.metadataSamplestr | NoneValue to select from
sampleColumn, e.g.library1. Default:Noneusesname.matrixRowsstr | NoneRequired for H5AD counts.
cellssums selected rows.pseudobulksselects exactly one row per source and fit. Default:None.countModestr | NoneFragment counting override. Default:
NoneusesscParams.defaultCountMode. Rejected for H5AD counts.fragmentsUseReadSupportboolTrueweights fragment rows by column five. InheritsscParams.fragmentsUseReadSupport, which defaults toFalse.Fragment
countModechoices:coverage,cutsite,fiveprime,center,midpoint, orconservedFractionalOverlap. Usecenterto count fragment centers.
H5AD count requirements¶
.Xcontains raw, nonnegative integer counts. Dense, CSR, and CSC storage are supported, including integer-valued floats..varcontainschrom,start, andendfor complete, regular chromosome grids in 0-based, half-open coordinates. Terminal bins may be shorter.countingParams.intervalSizeBPis inferred when omitted. All H5AD inputs must share that width, and an explicit value must match. Fragment inputs in the same run use that width.
Normalization uses countingParams.normMethod. H5AD supports CPM, RPKM,
SF, or supplied scale factors. EGS/RPGC require supplied factors.
Fragment barcode-file options on H5AD inputs are ignored with a warning.
See the single-cell examples for complete configurations.