Basic Polis Pipeline

%pip install --quiet git+https://github.com/patcon/valency-anndata@main
Usage
Loading Polis Data
import valency_anndata as val
adata = val.datasets.polis.load("https://pol.is/report/r29kkytnipymd3exbynkd")
val.viz.schematic_diagram(adata, diff_from=None)
Data was gathered using the Polis software (see: https://compdemocracy.org/polis
and https://github.com/compdemocracy/polis) and is sub-licensed under CC BY 4.0
with Attribution to The Computational Democracy Project.
The data and more information about how the data was collected can be found at
the following link: https://pol.is/report/r29kkytnipymd3exbynkd

Running Polis Pipelines
with val.viz.schematic_diagram(diff_from=adata):
val.tools.recipe_polis(adata, key_added_pca="X_pca_polis")
/home/runner/work/valency-anndata/valency-anndata/.venv/lib/python3.10/site-packages/scanpy/preprocessing/_pca/__init__.py:226: FutureWarning: Argument `use_highly_variable` is deprecated, consider using the mask argument. Use_highly_variable=True can be called through mask_var="highly_variable". Use_highly_variable=False can be called through mask_var=None
mask_var_param, mask_var = _handle_mask_var(

val.viz.embedding(adata, basis="pca_polis", color="kmeans_polis")
adata.obs["kmeans_polis"].value_counts()

kmeans_polis
0 1627
1 116
Name: count, dtype: int64
Exploring Polis Pipelines
with val.viz.schematic_diagram(diff_from=adata):
val.preprocessing.calculate_qc_metrics(adata, inplace=True)

val.viz.embedding(adata, basis="pca_polis",
color=["kmeans_polis", "pct_seen", "pct_agree", "pct_pass"],
)

Running & Exploring Alternative Pipelines
with val.viz.schematic_diagram(diff_from=adata):
val.tools.pacmap(
adata,
key_added="X_pacmap",
layer="X_masked_imputed_mean",
)
val.tools.kmeans(
adata,
k_bounds=(2, 9),
init="polis",
use_rep="X_pacmap",
mask_obs="cluster_mask",
key_added="kmeans_pacmap",
)

val.viz.embedding(adata, basis="pacmap",
color=["kmeans_pacmap", "pct_seen", "pct_agree", "pct_pass"],
)
