2. Step A — Construct mcDETECT and understand every parameter
Step A1. Import the class:
from mcDETECT.model import mcDETECT
Step A2. Read the parameter list below in order. Each entry matches one argument of mcDETECT(...).
type—"discrete"or"continuous"; see Section 1.transcripts— Full transcriptDataFrame; column requirements are in Section 1.gnl_genes—list[str]: all granule / synaptic marker genes to run DBSCAN on.nc_genes—list[str]orNone. IfNone,detect()skips negative-control filtering. Otherwisenc_filterruns at the end ofdetect().eps— DBSCAN neighborhood radius in coordinate units (3D).minspl— IfNone,poisson_select(gene)sets per-genemin_samplesfrom tissue area and background density. If an integer, that value is used for all genes (as in3_detection.pywithminspl=3).grid_len— Bin width when estimating tissue area for the Poisson model (not the spot grid in downstream notebooks).cutoff_prob— Quantile for the Poisson background (used whenminspl is None).alpha— Multiplier on expected local density insideπ eps²when selectingmin_samples.low_bound— Lower floor for automaticmin_samplesand minimum number of unique transcript positions per DBSCAN cluster before the cluster is skipped.size_thr— Discard spheres whose minimum enclosing ball has radius ≥size_thr. Use a very large value (e.g.1e5) for a “no radius cap” exploratory run.in_soma_thr— Discard spheres with in-soma ratio ≥in_soma_thr. Use a value slightly above 1 (e.g.1.01) to effectively disable.l— Scales center–center distance vs. sum of radii when resolving overlaps between spheres from different genes.rho— Threshold pairing withlfor deciding when two spheres “intersect” vs. nest for merge logic inmerge_sphere.s— Scales the radius of a new sphere after merging two overlapping spheres (miniball over combined points).nc_top— Whennc_genesis set, only the topnc_topnegative-control genes by transcript count enter the NC filter.nc_thr— Maximum allowed ratio of NC transcripts to total transcripts inside the sphere; spheres above this are removed. UseNoneto keep all spheres but still computenc_ratioif applicable.merge_genes— IfTrue, granule markers are collapsed to a single pseudo-marker column for detection (seemodel.py).merged_gene_label— Label used for that pseudo-marker whenmerge_genes=True.
Step A3. Instantiate without inline comments — parameters are documented above:
mc = mcDETECT(
type="discrete",
transcripts=transcripts,
gnl_genes=syn_genes,
nc_genes=nc_genes,
eps=1.5,
minspl=3,
grid_len=1,
cutoff_prob=0.95,
alpha=10,
low_bound=3,
size_thr=4.0,
in_soma_thr=0.1,
l=1,
rho=0.2,
s=1,
nc_top=20,
nc_thr=0.1,
merge_genes=False,
merged_gene_label="merged",
)
The same hyperparameter names apply to rough vs fine runs; only the values of nc_genes, size_thr, in_soma_thr, and related flags change; see Section 3.