scirpy.get.obs_context
- scirpy.get.obs_context(data, temp_cols)
Contextmanager that temporarily adds columns to obs.
Example
with ir.get.obs_context(mdata, { "new_col_with_constant_value": "foo", "new_col_with_sequence": range(len(mdata)), "v_gene_primary_vj_chain": ir.get.airr(mdata, "v_call", "VJ_1") }) as m: ir.pl.group_abundance(m, groupby="v_gene_primary_vj_chain", target_col="new_col_with_constant_value")
- Parameters
- data :
AnnData
|MuData
Union
[AnnData
,MuData
] AnnData or MuData object
- temp_cols :
DataFrame
|Mapping
Union
[DataFrame
,Mapping
[str
,Any
]] Dictionary where keys are column names and values are columns. Columns will be added to obs using
pandas.DataFrame.assign()
. It is also possible to pass aDataFrame
in which case the columns of the DataFrame will be added toobs
and matched based on the index.
- data :