sccloud.set_group_attribute¶
-
sccloud.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, sccloud will only perform batch correction for channels within each group.
- data:
anndata.AnnData Annotated data matrix with rows for cells and columns for genes.
- attribute_string:
str - Attributes used to construct groups:
If
None, assume all channels are from one group.attr, whereattris a keyword indata.obs.
So the groups are defined by this sample attribute.
``att1+att2+…+attrn``, where ``attr1`` to ``attrn`` are keywords in ``data.obs``. So the groups are defined by the Cartesian product of these *n attributes.
attr=value_11,...value_1n_1;value_21,...value_2n_2;...;value_m1,...,value_mn_m, whereattris a keyword indata.obs.
In this form, there will be (m+1) groups. A cell belongs to group i (i > 1) if and only if its sample attribute
attrhas a value amongvalue_i1, …value_in_i. A cell belongs to group 0 if it does not belong to any other groups.
None- Update
data.obs: data.obs["Group"]: Group ID for each cell.
>>> scc.set_group_attribute(adata, attr_string = "Individual")
>>> scc.set_group_attribute(adata, attr_string = "Individual+assignment")
>>> scc.set_group_attribute(adata, attr_string = "Channel=1,3,5;2,4,6,8")
- Return type
None
- data: