scmagnify.GRNMuData#

class scmagnify.GRNMuData(data, tf_act, network)#

GRNMuData class extends the MuData class to include a Gene Regulatory Network (GRN) and associated TF activity data.

Parameters:
  • data (AnnData | MuData) – An AnnData or MuData object containing the primary data.

  • tf_act (DataFrame | AnnData) – A DataFrame or AnnData object containing transcription factor activity data.

  • network (DataFrame) – A DataFrame representing the gene regulatory network with columns for TFs, targets, and scores.

Attributes table#

Methods table#

write_h5mu(filename, mdata, **kwargs)

Write MuData object to the HDF5 file

Attributes#

GRNMuData.axis#

MuData axis

GRNMuData.filename#
GRNMuData.isbacked#
GRNMuData.n_mod#
GRNMuData.n_obs#

Total number of observations

GRNMuData.n_var#

Total number of variables

GRNMuData.n_vars#

Total number of variables

GRNMuData.obs#

Annotation of observation

GRNMuData.obs_names#

Names of variables (alias for .obs.index)

This property is read-only. To be modified, obs_names of individual modalities should be changed, and .update_obs() should be called then.

GRNMuData.obsm#

Multi-dimensional annotation of observation

GRNMuData.obsmap#

Mapping of observation index in the MuData to indices in individual modalities.

1-based, 0 indicates that the corresponding observation is missing in the respective modality.

GRNMuData.obsp#

Pairwise annotatation of observations

GRNMuData.shape#

Shape of data, all variables and observations combined (n_obs, n_var).

GRNMuData.var#

Annotation of variables

GRNMuData.var_names#

Names of variables (alias for .var.index)

This property is read-only. To be modified, var_names of individual modalities should be changed, and .update_var() should be called then.

GRNMuData.varm#

Multi-dimensional annotation of variables

GRNMuData.varmap#

Mapping of feature index in the MuData to indices in individual modalities.

1-based, 0 indicates that the corresponding observation is missing in the respective modality.

GRNMuData.varp#

Pairwise annotatation of variables

Methods#

GRNMuData.copy(filename=None)#
Return type:

MuData

Parameters:

filename (PathLike | None)

GRNMuData.filter(**kwargs)#

Filter the GRN based on the specified attribute.

GRNMuData.obs_keys()#

List keys of observation annotation obs.

Return type:

List[str]

GRNMuData.obs_names_make_unique()#

Call .obs_names_make_unique() method on each AnnData object.

If there are obs_names, which are the same for multiple modalities, append modality name to all obs_names.

GRNMuData.obs_vector(key, layer=None)#

Return an array of values for the requested key of length n_obs

Return type:

ndarray

Parameters:
  • key (str)

  • layer (str | None)

GRNMuData.obsm_keys()#

List keys of observation annotation obsm.

Return type:

List[str]

GRNMuData.strings_to_categoricals(df=None)#

Transform string columns in .var and .obs slots of MuData to categorical as well as of .var and .obs slots in each AnnData object

This keeps it compatible with AnnData.strings_to_categoricals() method.

Parameters:

df (DataFrame | None)

GRNMuData.to_cyto()#

Convert the GRN to a Cytoscape JSON object.

Return type:

str

GRNMuData.to_matrix(network_key='network', score_key='score', rownames=None, colnames=None)#

Convert the GRN edges to a matrix

Return type:

DataFrame

GRNMuData.to_nx(network_key='network', score_key='score')#

Convert the GRN to a networkx DiGraph object.

Return type:

DiGraph

GRNMuData.uns_keys()#

List keys of unstructured annotation.

Return type:

List[str]

GRNMuData.update()#

Update both .obs and .var of MuData with the data from all the modalities

GRNMuData.update_obs()#

Update .obs slot of MuData with the newest .obs data from all the modalities

GRNMuData.update_var()#

Update .var slot of MuData with the newest .var data from all the modalities

GRNMuData.var_keys()#

List keys of variable annotation var.

Return type:

List[str]

GRNMuData.var_names_make_unique()#

Call .var_names_make_unique() method on each AnnData object.

If there are var_names, which are the same for multiple modalities, append modality name to all var_names.

GRNMuData.var_vector(key, layer=None)#

Return an array of values for the requested key of length n_var

Return type:

ndarray

Parameters:
  • key (str)

  • layer (str | None)

GRNMuData.varm_keys()#

List keys of variable annotation varm.

Return type:

List[str]

GRNMuData.write(filename)#

Write the GRNMuData object to a file.

Parameters:

filename (str)

GRNMuData.write_h5mu(filename=None, **kwargs)#

Write MuData object to an HDF5 file

Parameters:
  • filename (str | None)

  • mdata (MuData)

GRNMuData.write_zarr(store, **kwargs)#

Write MuData object to a Zarr store

Parameters:

store (MutableMapping | str | Path)