multiassayexperiment package¶
Subpackages¶
Submodules¶
multiassayexperiment.MultiAssayExperiment module¶
- class multiassayexperiment.MultiAssayExperiment.MultiAssayExperiment(experiments, column_data=None, sample_map=None, metadata=None, validate=True)[source]¶
Bases:
object
Container class for representing and managing multi-omics genomic experiments.
Checkout the R/MultiAssayExperiment for more information.
- __getitem__(args)[source]¶
Subset a MultiAssayExperiment.
- Parameters:
args (
tuple
) –Tuple containing slices along dimensions (rows, columns, experiments).
Each element in the tuple, might be either a integer vector (integer positions), boolean vector or
slice
object. Defaults to None.- Raises:
ValueError – Too many or too few slices.
- Return type:
- Returns:
A new sliced MultiAssayExperiment object with the subsets.
- add_experiment(name, experiment, sample_map, column_data=None, in_place=False)[source]¶
Add a new experiment to MultiAssayExperiment.
sample_map
must be provided to map the columns from this experiment tocolumn_data
. This will be appended to the existingsample_map
.Optionally,
column_data
may be provided to add new sample information.- Parameters:
name (
str
) – Name of the new experiment.experiment (
Any
) – The experiment to add.sample_map (
BiocFrame
) – Sample map to append to the MAE.column_data (
Optional
[BiocFrame
]) –Sample data to append to the MAE.
Defaults to None.
in_place (
bool
) – Whether to modify theMultiAssayExperiment
in place. Defaults to False.
- Return type:
- Returns:
A modified
MultiAssayExperiment
object, either as a copy of the original or as a reference to the (in-place-modified) original.
- property assays: Dict[str, Any]¶
Alias for
get_experiments()
.
- property colnames: Dict[str, Names | None]¶
Alias for
get_column_names
, provided for back-compatibility.
- property column_data: BiocFrame¶
Alias for
get_column_data()
.
- property column_names: Dict[str, Names | None]¶
Alias for
get_column_names
, provided for back-compatibility.
- property columnnames: Dict[str, Names | None]¶
Alias for
get_column_names
, provided for back-compatibility.
- copy()[source]¶
Alias for
__copy__()
.
- experiment(name, with_sample_data=False)[source]¶
Get an experiment by name.
- Parameters:
- Raises:
AttributeError – If the experiment name does not exist.
IndexError – If index is greater than the number of experiments.
- Return type:
- Returns:
The experiment object.
If
with_sample_data
is True, a copy of the experiment object is returned.
- property experiment_names: List[str]¶
Alias for
get_experiment_names()
.
- property experiments: Dict[str, Any]¶
Alias for
get_experiments()
.
- classmethod from_anndata(input, name='unknown')[source]¶
Create a
MultiAssayExperiment
fromAnnData
.Since
AnnData
does not contain sample information, sample named"unknown_sample"
will be added tocol_data
. All cells are considered to be extracted from this sample and is reflected insample_map
.- Parameters:
input (anndata.AnnData) – An
AnnData
object.name (
str
) –Name for the experiment.
Defaults to “unknown”.
- Return type:
MultiAssayExperiment
- Returns:
An
MultiAssayExperiment
.
- classmethod from_mudata(input)[source]¶
Create a
MultiAssayExperiment
object fromMuData
.The import naively creates sample mapping, each
experiment
is considered to be a sample. We add a sample with the following pattern -"unknown_sample_{experiment_name}"
tocol_data
. All cells from the same experiment are considered to be extracted from the same sample and is reflected insample_map
.- Parameters:
input (mudata.MuData) – MuData object.
- Raises:
Exception – If
mudata
object is read in backed modeisbacked
.- Return type:
MultiAssayExperiment
- Returns:
MultiAssayExperiment
object.
- get_with_column_data(name)[source]¶
Alias to
experiment()
.Consistency with Bioconductor’s naming of the same function.
- Return type:
- intersect_rows()[source]¶
Finds common row names across all experiments and filters the MAE to these rows.
- Return type:
- Returns:
A new sliced MultiAssayExperiment object with the filtered rows.
- property metadata: dict¶
Alias for
get_metadata
.
- property rownames: Dict[str, Names | None]¶
Alias for
get_row_names
, provided for back-compatibility.
- property sample_map: BiocFrame¶
Alias for
get_sample_map()
.
- set_column_data(column_data, in_place=False)[source]¶
Set new sample metadata.
- Parameters:
- Return type:
- Returns:
A modified
MultiAssayExperiment
object, either as a copy of the original or as a reference to the (in-place-modified) original.
- set_experiment_names(names, in_place=False)[source]¶
Replace
experiments
’s names.- Parameters:
- Return type:
- Returns:
A modified
MultiAssayExperiment
object, either as a copy of the original or as a reference to the (in-place-modified) original.
- set_experiments(experiments, in_place=False)[source]¶
Set new experiments.
- Parameters:
experiments (
Dict
[str
,Any
]) –New experiments to set. A dictionary of experiments with experiment names as keys and the experiments as values.
Each
experiment
may be either aSummarizedExperiment
or any class that extendsSummarizedExperiment
.in_place (
bool
) – Whether to modify theMultiAssayExperiment
in place.
- Return type:
- Returns:
A modified
MultiAssayExperiment
object, either as a copy of the original or as a reference to the (in-place-modified) original.
- set_metadata(metadata, in_place=False)[source]¶
Set additional metadata.
- Parameters:
- Return type:
- Returns:
A modified
MultiAssayExperiment
object, either as a copy of the original or as a reference to the (in-place-modified) original.
- set_sample_map(sample_map, in_place=False)[source]¶
Set new sample mapping.
- Parameters:
- Return type:
- Returns:
A modified
MultiAssayExperiment
object, either as a copy of the original or as a reference to the (in-place-modified) original.
- subset_by_column(columns)[source]¶
Subset by column.
- Parameters:
columns (
Union
[str
,int
,bool
,Sequence
]) –Columns to be extracted.
Integer indices, a boolean filter, or (if the current object is named) names specifying the ranges to be extracted, see
normalize_subscript()
.- Return type:
- Returns:
A new MultiAssayExperiment with the subsetted columns.
- subset_by_experiments(experiments)[source]¶
Subset by experiment(s).
- Parameters:
experiments (
Union
[str
,int
,bool
,Sequence
]) –Experiments to extract.
Integer indices, a boolean filter, or (if the current object is named) names specifying the ranges to be extracted, see
normalize_subscript()
.Check
experiment_names
for a list of valid experiment names.- Return type:
- Returns:
A new MultiAssayExperiment with the subset experiments.
- subset_by_row(rows)[source]¶
Subset by rows.
- subset_experiments(rows, columns, experiment_names)[source]¶
Subset experiments.
- Parameters:
rows (
Union
[str
,int
,bool
,Sequence
,None
]) –Row indices to subset.
Integer indices, a boolean filter, or (if the current object is named) names specifying the ranges to be extracted, see
normalize_subscript()
.columns (
Union
[str
,int
,bool
,Sequence
,None
]) –Column indices (from
column_data
) to subset.Integer indices, a boolean filter, or (if the current object is named) names specifying the ranges to be extracted, see
normalize_subscript()
.experiment_names (
Union
[str
,int
,bool
,Sequence
]) –Experiment names to keep.
Integer indices, a boolean filter, or (if the current object is named) names specifying the ranges to be extracted, see
normalize_subscript()
.Check
experiment_names
for a list of valid experiment names.
- Return type:
- Returns:
A dictionary with experiment names as keys and the subsetted experiment data as value.
- class multiassayexperiment.MultiAssayExperiment.SlicerResult(experiments, sample_map, column_data)¶
Bases:
tuple
- __getnewargs__()¶
Return self as a plain tuple. Used by copy and pickle.
- static __new__(_cls, experiments, sample_map, column_data)¶
Create new instance of SlicerResult(experiments, sample_map, column_data)
- __repr__()¶
Return a nicely formatted representation string
- __slots__ = ()¶
- column_data¶
Alias for field number 2
- experiments¶
Alias for field number 0
- sample_map¶
Alias for field number 1