mmc.Hierarchy.run_all_thresholds()

Hierarchy.run_all_thresholds(adata, data_key=utils.DATA_KEY, batch_key=None, mode='fill in', interactive=True, plot=True, limit=None, batch_marker_order=False, skip=[], bins=100, external_holdout=False, key_added='lin', force_model=[])

Runs thresholding using the thresholding.threshold() function. First uses mmc.get_data to search for marker. If marker is not found in AnnData, gives up and ask whether to label it as interactive or not.

Parameters:
  • adata (AnnData) – Object containing marker expression in the .X, .obsm[data_key], or .obs for high confidence thresholding.

  • data_key (Union[str, list, None] (default: utils.DATA_KEY)) – obsm or .var[utils.MODALITY_COLUMN] location to probe for other modalities beyond the .X

  • batch_key (str (default: None)) – If none, don’t run with batch. Otherwise, the batch on which to threshold

  • mode (str (default: 'fill in')) – One of: [‘fill in’,’rerun all’, ‘rerun specified’,’every level’] Whether to only fill in unspecified thresholds, rerun all thresholds, rerun all thresholds that have been specified (and not fill in new ones), or rerun every level separately. Add “fancy” to the mode name to trigger fancy plots (interactive widgets).

  • interactive (bool (default: True)) – Whether to run thresholding.threshold() interactively or not

  • plot (bool (default: True)) – Whether to display a plot when running thresholding.threshold()

  • limit (Union[str, List[str], None] (default: None)) – If specified, only thresholds marker(s) included in the limit

  • batch_marker_order (bool (default: False)) – Whether to order by batch first or marker first (as the outer loop). If true, marker is the outer loop.

  • skip (List[str] (default: [])) – Markers to skip for thresholding

  • bins (int (default: 100)) – The number of bins to include in the histograms

  • external_holdout (bool (default: False)) – If external hold out was defined in adata.obsm[key_added], removes external hold out from automatic threshold calculations and from graphs used for manual thresholding

  • key_added (str (default: 'lin')) – If external_holdout is true, the place in adata.obsm[key_added] to search for the external hold out column (bool T F column used to indicate whether an event should be set aside for hold out)

  • force_model (list (default: [])) – If precalculated thresholds already exists, will recalculate thresholds on this model based on Gaussian Mixture Model. Can be used to force model calculation for genes, which be default are thresholded to 0.5.