neuralib.atlas.ccf.norm

class neuralib.atlas.ccf.norm.MouseBrainRoiNormHandler[source]

Class for handle the normalization for ROIs across mouse brain

__init__(norm_type=None)[source]
Parameters:

norm_type (ROIS_NORM_TYPE | None) –

which kind of normalization for the roi labeling

channel: normalize to fraction of rois for a specific color fluorescence channel

volume: normalize to the volume size per region (cellatlas-based) # TODO validate with allenSDK source

cell: normalize to the total cell counts per region (cellatlas-based)

classmethod handle_failure(df, *, expr=None, drop_not_found=True)[source]
Parameters:
  • df (pl.DataFrame)

  • expr (pl.Expr | None)

  • drop_not_found (bool)

Return type:

pl.DataFrame

property unit_label: str

For plotting

property unit_col: str

For dataframe column

expand(df, area_col, expand_cols)[source]

expand the dataframe based on different normalization

Parameters:
  • df (DataFrame) – input dataframe has abs cell counts per region

  • area_col (str) – brain region acronym for querying

  • expand_cols (list[str]) – columns with abs cell counts need to be expanded

Returns:

expanded dataframe

Return type:

DataFrame

neuralib.atlas.ccf.norm.handle_failure_norm(df, *, expr=None, drop_not_found=True)[source]

warning verbose or drop if cellatlas cannot find the n_neurons OR volume in the given acronym,

Parameters:
  • df (pl.DataFrame)

  • expr (pl.Expr | None) – condition for determine if it’s failure

  • drop_not_found (bool) – whether drop the region that can not be found

neuralib.atlas.ccf.norm.foreach_norm_method(include_abs_count=True, **kwargs)[source]

foreach normalization method

Parameters:
  • include_abs_count (bool) – if iterator include abs cell counts

  • kwargs – pass to MouseBrainRoiNormHandler

Returns:

Return type:

Iterable[MouseBrainRoiNormHandler]