msmu.dt.map
Map source columns onto a target table in place, returning the same MuData.
Table paths are obs, var, <modality>.obs/var, <modality>.decoy
(the decoy table in .uns["decoy"]), or [<modality>.]obsm/varm.<key>
(DataFrame objects only). Index arguments name
matching columns; None uses the table index without changing it.
columns maps source column names to destination column names.
Identical source key/value rows are collapsed; conflicting keys raise.
Unmatched rows receive missing values. Existing destination columns are
overwritten. Matching follows pandas, including matching missing keys.
Provenance records these instructions, not the mapped column contents.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mdata
|
MuData
|
|
required |
source
|
str
|
Source table path: |
required |
target
|
str
|
Destination table path using the same syntax. |
required |
columns
|
dict[str, str]
|
Nonempty mapping from source column names to unique destination column names. |
required |
source_index
|
str | None
|
Source matching column; |
None
|
target_index
|
str | None
|
Destination matching column; |
None
|
Returns:
| Type | Description |
|---|---|
MuData
|
The same |
Examples:
import msmu as mm
mm.dt.map(mdata, source="obs", target="protein.obs", columns={"condition": "condition"})