Functions

Index

All functions

Base.getindexFunction
getindex(
    data::Union{AbstractAnnData, AbstractMuData},
    I::Union{OrdinalRange, Colon, AbstractVector{<:Integer}, AbstractVector{<:AbstractString}, Number, AbstractString},
    J::Union{OrdinalRange, Colon, AbstractVector{<:Integer}, AbstractVector{<:AbstractString}, Number, AbstractString},
)

Subset data to observations I and variables J.

Indexing can be performed by numerical index or by name, where names are looked up in data.obs_names and data.var_names.

source
Base.getindexMethod
getindex(mdata::AbstractMuData, modality::Union{AbstractString, Symbol})::AnnData

Get a modality from mdata.

source
Base.setindex!Method
setindex!(mdata::AbstractMuData, ad::AnnData, key::Union{AbstractString, Symbol})

Insert or overwrite a modality in mdata.

source
Base.sizeFunction
size(data::Union{AbstractAnnData, AbstractMuData}, [dim::Integer])

Return a tuple containing the number of observations and variables of adata. Optionally you can specify a dimension to get just the length of that dimension.

source
Base.viewFunction
view(data::Union{AbstractAnnData, AbstractMuData},
    I::Union{OrdinalRange, Colon, AbstractVector{<:Integer}, AbstractVector{<:AbstractString}, Number, AbstractString},
    J::Union{OrdinalRange, Colon, AbstractVector{<:Integer}, AbstractVector{<:AbstractString}, Number, AbstractString},
)

Like getindex, but returns a lightweight object that lazily references the parent object.

source
Base.writeFunction
write(data::Union{AbstractAnnData, AbstractMuData}; compress::UInt8=0x9)
write(parent::Union{HDF5.File, HDF5.Group, ZGroup}, data::Union{AbstractAnnData, AbstractMuData}; compress::UInt8=0x9)

Write the data to disk.

The first form writes the metadata of a backed AnnData or MuData object to disk. The second form writes the data to an already open HDF5 or Zarr file into the group parent.

source
Base.writeMethod
write(parent::Union{HDF5.File, HDF5.Group, ZGroup}, name::AbstractString, adata::AbstractAnnData; compress::UInt8=0x9)

Write the adata to an already open HDF5 or Zarr file into the group parent as a subgroup with name name.

source
Muon.pull_obs!Method
pull_obs!(
    mdata::MuData;
    columns::Union{AbstractVector{<:AbstractString}, NTuple{N, <:AbstractString}, AbstractString, Nothing}=nothing,
    mods::Union{AbstractVector{<:AbstractString}, NTuple{M, <:AbstractString}, AbstractString, Nothing}=nothing,
    common::Union{Bool, Nothing}=nothing,
    join_common::Union{Bool, Nothing}=nothing,
    nonunique::Union{Bool, Nothing}=nothing,
    join_nonunique::Bool=false,
    unique::Union{Bool, Nothing}=nothing,
    prefix_unique::Bool=true,
    drop::Bool=false,
    only_drop::Bool=false,
) where {N, M}

Copy metadata from the .obs of the individual modalities to the global .obs of the MuData object, overwriting or updating existing columns.

Arguments

  • mdata: The MuData object.
  • columns: Columns to pull from the modalities. Pulls everything by default.
  • mods: Modalities to pull from. Pull from all modalities by default.
  • common: Whether to pull common columns. Common columns exist in all modalities. Cannot be used together with columns. Defaults to true.
  • join_common: Whether to join common columns. Joined columns do not have a modality prefix. Defaults to true if mdata.axis == 0x1 (shared .obs), false otherwise.
  • nonunique: Whether to pull nonunique columns. Non-unique columns exist in at least two, but not all modalities. Cannot be used together with columns. Defaults to true.
  • join_nonunique: Whether to join non-unique columns. Joined columns do not have a modality prefix.
  • unique: Whether to pull unique columns. Unique columns exist in exactly one modality. Cannot be used together with columns. Defaults to true.
  • prefix_unique: Whether to prefix unique columns with the modality name.
  • drop: Whether to delete columns from the modalities after pulling.
  • only_drop: Whether to only delete the columns from the modalities, but not actually pull them. Implies drop=true.

See also pull_var!, push_obs!, push_var!.

source
Muon.pull_var!Method
pull_var!(
    mdata::MuData;
    columns::Union{AbstractVector{<:AbstractString}, NTuple{N, <:AbstractString}, AbstractString, Nothing}=nothing,
    mods::Union{AbstractVector{<:AbstractString}, NTuple{M, <:AbstractString}, AbstractString, Nothing}=nothing,
    common::Union{Bool, Nothing}=nothing,
    join_common::Union{Bool, Nothing}=nothing,
    nonunique::Union{Bool, Nothing}=nothing,
    join_nonunique::Bool=false,
    unique::Union{Bool, Nothing}=nothing,
    prefix_unique::Bool=true,
    drop::Bool=false,
    only_drop::Bool=false,
) where {N, M}

Copy metadata from the .var of the individual modalities to the global .var of the MuData object, overwriting or updating existing columns.

Arguments

  • mdata: The MuData object.
  • columns: Columns to pull from the modalities. Pulls everything by default.
  • mods: Modalities to pull from. Pull from all modalities by default.
  • common: Whether to pull common columns. Common columns exist in all modalities. Cannot be used together with columns. Defaults to true.
  • join_common: Whether to join common columns. Joined columns do not have a modality prefix. Defaults to true if mdata.axis == 0x1 (shared .obs), false otherwise.
  • nonunique: Whether to pull nonunique columns. Non-unique columns exist in at least two, but not all modalities. Cannot be used together with columns. Defaults to true.
  • join_nonunique: Whether to join non-unique columns. Joined columns do not have a modality prefix.
  • unique: Whether to pull unique columns. Unique columns exist in exactly one modality. Cannot be used together with columns. Defaults to true.
  • prefix_unique: Whether to prefix unique columns with the modality name.
  • drop: Whether to delete columns from the modalities after pulling.
  • only_drop: Whether to only delete the columns from the modalities, but not actually pull them. Implies drop=true.

See also pull_obs!, push_obs!, push_var!.

source
Muon.push_obs!Method
push_obs!(
    mdata::MuData;
    columns::Union{AbstractVector{<:AbstractString}, NTuple{N, <:AbstractString}, AbstractString, Nothing}=nothing,
    mods::Union{AbstractVector{<:AbstractString}, NTuple{M, <:AbstractString}, AbstractString, Nothing}=nothing,
    common::Union{Bool, Nothing}=nothing,
    prefixed::Union{Bool, Nothing}=nothing,
    drop::Bool=false,
    only_drop::Bool=false,
) where {N, M}

Copy metadata from mdata.obs to the .obs of the individual modalities, overwriting existing columns.

Arguments

  • mdata: The MuData object.
  • columns: Columns to push. Pushes everything by default.
  • mods: Modalities to push to. Pushes to all modalities by default.
  • common: Whether to push common columns. Common columns do not have modality prefixes. Cannot be used together with columns. Defaults to true.
  • prefixed: Whether to push columns with a modality prefix. Only push to the respective modalities. Cannot be used together with columns. Defaults to true.
  • drop: Whether to delete columns from mdata.obs after pushing.
  • only_drop: Whether to only delete the columns from mdata.obs, but not actually push them. Implies drop=true.

See also push_var!, pull_obs!, pull_var!.

source
Muon.push_var!Method
push_var!(
    mdata::MuData;
    columns::Union{AbstractVector{<:AbstractString}, NTuple{N, <:AbstractString}, AbstractString, Nothing}=nothing,
    mods::Union{AbstractVector{<:AbstractString}, NTuple{M, <:AbstractString}, AbstractString, Nothing}=nothing,
    common::Union{Bool, Nothing}=nothing,
    prefixed::Union{Bool, Nothing}=nothing,
    drop::Bool=false,
    only_drop::Bool=false,
) where {N, M}

Copy metadata from mdata.var to the .var of the individual modalities, overwriting existing columns.

Arguments

  • mdata: The MuData object.
  • columns: Columns to push. Pushes everything by default.
  • mods: Modalities to push to. Pushes to all modalities by default.
  • common: Whether to push common columns. Common columns do not have modality prefixes. Cannot be used together with columns. Defaults to true.
  • prefixed: Whether to push columns with a modality prefix. Only push to the respective modalities. Cannot be used together with columns. Defaults to true.
  • drop: Whether to delete columns from mdata.obs after pushing.
  • only_drop: Whether to only delete the columns from mdata.obs, but not actually push them. Implies drop=true.

See also push_obs!, pull_obs!, pull_var!.

source
Muon.readh5adMethod
readh5ad(filename::AbstractString; backed=false)::AnnData

Read an AnnData object stored in an h5ad file.

In backed mode, matrices X and layers are not read into memory, but are instead represented by proxy objects reading the required matrix elements from disk upon access.

See also readzarrad, writeh5ad, writezarrad, isbacked.

source
Muon.readh5muMethod
readh5mu(filename::AbstractString; backed=false)::MuData

Read a MuData object stored in an h5mu file.

In backed mode, matrices X and layers for each modality are not read into memory, but are instead represented by proxy objects reading the required matrix elements from disk upon access.

See also readzarrmu, writeh5mu, writezarrmu, isbacked.

source
Muon.readzarradMethod
readzarrad(filename::AbstractString; backed=false)::AnnData

Read an AnnData object stored in a Zarr file.

In backed mode, matrices X and layers are not read into memory, but are instead represented by proxy objects reading the required matrix elements from disk upon access.

See also readh5ad, writeh5ad, writezarrad, isbacked.

source
Muon.readzarrmuMethod
readzarr(filename::AbstractString; backed=false)::MuData

Read a MuData object stored in a Zarr file.

In backed mode, matrices X and layers for each modality are not read into memory, but are instead represented by proxy objects reading the required matrix elements from disk upon access.

See also readh5mu, writeh5mu, writezarrmu, isbacked.

source
Muon.set_optionsMethod
set_options(; kwargs...)

Set package-specific options.

These will be written to LocalPreferences.toml in your active project. Supported options are:

  • pull_on_update::Bool (defaults to false): Controls whether to automatically run pull_obs!/ pull_var! after update_obs!/update_var!.

See also get_option.

source
Muon.update!Method
update!(mdata::MuData)

Update the MuData object with information from all modalities.

This function should be called after adding or removing modalities. It will update the MuData's obs_names and var_names as well as the obsmap and `varmap.

See also update_obs!, update_var!.

source
Muon.writeh5adMethod
writeh5ad(filename::AbstractString, adata::AbstractAnnData; compress::UInt8=0x9)

Write an AnnData object to disk using the h5ad format (HDF5 with a particular structure).

compress indicates the level of compression to apply, from 0 (no compression) to 9 (highest compression).

See also writezarrad, readh5ad, readzarrad.

source
Muon.writeh5muMethod
writeh5mu(filename::AbstractString, mudata::AbstractMuData; compress::UInt8=0x9)

Write a MuData object to disk using the h5mu format (HDF5 with a particular structure).

compress indicates the level of compression to apply, from 0 (no compression) to 9 (highest compression).

See also writezarrmu, readh5mu, readzarrmu.

source
Muon.writezarradMethod
writezarrad(filename::AbstractString, adata::AbstractAnnData; compress::UInt8=0x9)

Write an AnnData object to disk using the Zarr format.

compress indicates the level of compression to apply, from 0 (no compression) to 9 (highest compression).

See also writeh5ad, readh5ad, readzarrad.

source
Muon.writezarrmuMethod
writezarrmu(filename::AbstractString, mudata::AbstractMuData; compress::UInt8=0x9)

Write a MuData object to disk using the Zarr format.

compress indicates the level of compression to apply, from 0 (no compression) to 9 (highest compression).

See also writeh5mu, readh5mu, readzarrmu.

source