MaskCollection

class pylluminator.mask.MaskCollection

Bases: object

A collection of masks, each mask is a set of probes that are masked for a specific sample or for all samples.

Variables:

masks (dict) – a dictionary of masks, where the key is a tuple (mask_name, sample_label) and the value is a Mask object

Methods

__init__()

add_mask(mask)

Add a new mask to the collection.

copy()

Creates a copy of the MaskCollection object.

get_mask([mask_name, sample_label])

Retrieve a mask by name and scope.

get_mask_names(sample_label)

Return the names of the masks existing for specific sample(s)

number_probes_masked([mask_name, sample_label])

Return the number or masked probes for a specific sample or for all samples if no sample name is provided.

remove_masks([mask_name, sample_label])

Reset the mask for specific samples or for all samples if no sample name is provided.

reset_masks()

Reset all masks.

Methods and attributes detail

__init__()
add_mask(mask: Mask) None

Add a new mask to the collection.

Parameters:

mask (Mask) – the mask to add

copy()

Creates a copy of the MaskCollection object.

get_mask(mask_name: str | list[str] | None = None, sample_label: str | list[str] | None = None) MultiIndex | None

Retrieve a mask by name and scope. If no sample_label is defined, return the mask that applies to all samples, without considering masks of specific samples. If one or more sample_labels are defined, the mask includes the masks that applies to all samples combined with the masks of the samples(s) defined. If one or more mask_name are defined, only these masks will be considered.

Parameters:
  • mask_name (str | list[str] | None) – the name of the mask. Default: None

  • sample_label (str | None) – the name of the sample the mask is applied to. Default: None

Returns:

a pandas Series of booleans, where True indicates that the probe is masked

Return type:

pandas.Series | None

get_mask_names(sample_label: str | list[str] | None) set

Return the names of the masks existing for specific sample(s)

Returns:

the mask names

Return type:

set

number_probes_masked(mask_name: str | None = None, sample_label: str | None = None) int

Return the number or masked probes for a specific sample or for all samples if no sample name is provided.

Parameters:
  • mask_name (str | None) – the name of the mask. Default: None

  • sample_label (str | None) – the name of the sample the mask is applied to. Default: None

Returns:

number of masked probes

Return type:

int

remove_masks(mask_name: str | list[str] | None = None, sample_label: str | list[str] | None = None) None

Reset the mask for specific samples or for all samples if no sample name is provided. If a mask name is provided,only delete this mask.

Parameters:
  • mask_name (str | list[str] | None) – the name of the mask. Default: None

  • sample_label (str | list[str] | None) – the name(s) of the sample(s) the mask is applied to. Default: None

Returns:

None

reset_masks()

Reset all masks.