Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ default_stages:
minimum_pre_commit_version: 2.16.0
repos:
- repo: https://github.com/biomejs/pre-commit
rev: 055c65a8144b42a1f56908484127aec0c614fb85 # frozen: v2.5.10
rev: c4d01b70e92b66e6a88739145624279889634e92 # frozen: v2.5.11
hooks:
- id: biome-format
exclude: ^\.cruft\.json$ # inconsistent indentation with cruft - file never to be modified manually.
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: aab412d509121cb5f7533134b7e67f9fab59c682 # frozen: v0.16.4
rev: 1f1e8bf348ff38fc88619a38d3ca4d9c56abea49 # frozen: v0.16.5
hooks:
- id: ruff-check
args: [--fix, --exit-non-zero-on-fix, --unsafe-fixes]
Expand Down Expand Up @@ -44,7 +44,7 @@ repos:
require_serial: true
pass_filenames: false
- repo: https://github.com/zizmorcore/zizmor-pre-commit
rev: 451b56af716f9f0d0c2b816503a3fd0cf8b036fa # frozen: v1.29.0
rev: cef8b8350da46d8114c7e6b7272aebdccdf193ce # frozen: v1.30.0
hooks:
- id: zizmor
args: [--no-progress, --fix]
24 changes: 6 additions & 18 deletions docs/api/tools_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ pdata = ps.compute(

edgr = pt.tl.EdgeR(pdata, design="~Efficacy+Treatment")
edgr.fit()
res_df = edgr.test_contrasts(
edgr.contrast(column="Treatment", baseline="Chemo", group_to_compare="Anti-PD-L1+Chemo")
)
res_df = edgr.test_contrasts(edgr.contrast(column="Treatment", baseline="Chemo", group_to_compare="Anti-PD-L1+Chemo"))
```

Inspecting a model summarizes the input data, the design and whether the model has been fitted, rendered as HTML in Jupyter:
Expand Down Expand Up @@ -172,9 +170,7 @@ mdata = milo.load(adata)
sc.pp.neighbors(mdata["rna"], use_rep="X_scVI", n_neighbors=150, n_pcs=10)
milo.make_nhoods(mdata["rna"], prop=0.1)
mdata = milo.count_nhoods(mdata, sample_col="patient_id")
mdata["rna"].obs["Status"] = (
mdata["rna"].obs["Status"].cat.reorder_categories(["Healthy", "Covid"])
)
mdata["rna"].obs["Status"] = mdata["rna"].obs["Status"].cat.reorder_categories(["Healthy", "Covid"])
milo.da_nhoods(mdata, design="~Status")

# Repeated measurements of the same donor are accounted for with a random intercept
Expand Down Expand Up @@ -233,9 +229,7 @@ sccoda_data = sccoda.prepare(
)
sccoda.run_nuts(sccoda_data, modality_key="coda_salm")
sccoda.summary(sccoda_data, modality_key="coda_salm")
sccoda.plot_effects_barplot(
sccoda_data, modality_key="coda_salm", parameter="Final Parameter"
)
sccoda.plot_effects_barplot(sccoda_data, modality_key="coda_salm", parameter="Final Parameter")
```

See [sccoda tutorial](https://pertpy.readthedocs.io/en/latest/tutorials/notebooks/sccoda.html), [extended sccoda tutorial](https://pertpy.readthedocs.io/en/latest/tutorials/notebooks/sccoda_extended.html) and [tasccoda tutorial](https://pertpy.readthedocs.io/en/latest/tutorials/notebooks/tasccoda.html).
Expand Down Expand Up @@ -346,9 +340,7 @@ ps_adata = ps.compute_control_diff(
)
ps_adata = ps_adata[ps_adata.obs["perturbation"] != "control"].copy()

query_profile = -ps_adata[
ps_adata.obs["perturbation"] == "p-sgCREB1-2"
].to_df().iloc[0]
query_profile = -ps_adata[ps_adata.obs["perturbation"] == "p-sgCREB1-2"].to_df().iloc[0]
up_genes = query_profile[query_profile > 0].nlargest(20).index.tolist()
down_genes = query_profile[query_profile < 0].nsmallest(20).index.tolist()

Expand Down Expand Up @@ -469,18 +461,14 @@ import pertpy as pt

train = pt.dt.kang_2018()

train_new = train[
~((train.obs["cell_type"] == "CD4T") & (train.obs["condition"] == "stimulated"))
]
train_new = train[~((train.obs["cell_type"] == "CD4T") & (train.obs["condition"] == "stimulated"))]
train_new = train_new.copy()

pt.tl.Scgen.setup_anndata(train_new, batch_key="condition", labels_key="cell_type")
scgen = pt.tl.Scgen(train_new)
scgen.train(max_epochs=100, batch_size=32)

pred, delta = scgen.predict(
ctrl_key="control", stim_key="stimulated", celltype_to_predict="CD4T"
)
pred, delta = scgen.predict(ctrl_key="control", stim_key="stimulated", celltype_to_predict="CD4T")
pred.obs["condition"] = "pred"
```

Expand Down
Loading