pegasus.set_group_attribute¶
-
pegasus.set_group_attribute(data, attribute_string)[source]¶ Set group attributes used in batch correction.
Batch correction assumes the differences in gene expression between channels are due to batch effects. However, in many cases, we know that channels can be partitioned into several groups and each group is biologically different from others. In this case, pegasus will only perform batch correction for channels within each group.
- Parameters
data (
pegasusio.MultimodalData) – Annotated data matrix with rows for cells and columns for genes.attribute_string (
str) –Attributes used to construct groups:
NoneAssume all channels are from one group.
attrDefine groups by sample attribute
attr, which is a keyword indata.obs.
att1+att2+...+attrnDefine groups by the Cartesian product of these n attributes, which are keywords in
data.obs.
attr=value_11,...value_1n_1;value_21,...value_2n_2;...;value_m1,...,value_mn_mIn this form, there will be (m+1) groups. A cell belongs to group i (i > 1) if and only if its sample attribute
attr, which is a keyword indata.obs, has a value amongvalue_i1, …value_in_i. A cell belongs to group 0 if it does not belong to any other groups.
- Returns
Update
data.obs:data.obs["Group"]: Group ID for each cell.
- Return type
None
Examples
>>> pg.set_group_attribute(data, attr_string = "Individual")
>>> pg.set_group_attribute(data, attr_string = "Individual+assignment")
>>> pg.set_group_attribute(data, attr_string = "Channel=1,3,5;2,4,6,8")