Skip to content

Commit

Permalink
Update tutorial after data structure change
Browse files Browse the repository at this point in the history
  • Loading branch information
grst committed Apr 7, 2021
1 parent 801e359 commit aa6e81a
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions docs/tutorials/tutorial_3k_tcr.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ from matplotlib import pyplot as plt, cm as mpl_cm
from cycler import cycler

sc.set_figure_params(figsize=(4, 4))
sc.settings.verbosity = 2 # verbosity: errors (0), warnings (1), info (2), hints (3)
```

```python
Expand Down Expand Up @@ -317,10 +318,6 @@ This appoach was initially proposed as *TCRdist* by Dash et al. (:cite:`TCRdist`
All cells with a distance between their CDR3 sequences lower than `cutoff` will be connected in the network.
<!-- #endraw -->

```python
sc.settings.verbosity = 4
```

```python
ir.pp.ir_dist(
adata,
Expand Down Expand Up @@ -359,10 +356,10 @@ When extracting the CDR3 sequences of clonotype cluster `159`, we retreive five
```python
adata.obs.loc[adata.obs["cc_aa_alignment"] == "159", :].groupby(
[
"IR_VJ_1_cdr3",
"IR_VJ_2_cdr3",
"IR_VDJ_1_cdr3",
"IR_VDJ_2_cdr3",
"IR_VJ_1_junction_aa",
"IR_VJ_2_junction_aa",
"IR_VDJ_1_junction_aa",
"IR_VDJ_2_junction_aa",
"receptor_subtype",
],
observed=True,
Expand Down Expand Up @@ -406,8 +403,8 @@ adata.obs.loc[
[
"cc_aa_alignment",
"cc_aa_alignment_same_v",
"IR_VJ_1_v_gene",
"IR_VDJ_1_v_gene",
"IR_VJ_1_v_call",
"IR_VDJ_1_v_call",
],
].sort_values("cc_aa_alignment").drop_duplicates().reset_index(drop=True)
```
Expand All @@ -430,7 +427,7 @@ ir.tl.clonal_expansion(adata)
The `clonotype_size` refers to the absolute number of cells in a clonotype.

```python
sc.pl.umap(adata, color=["clonal_expansion", "clonotype_size"])
sc.pl.umap(adata, color=["clonal_expansion", "clone_id_size"])
```

<!-- #raw raw_mimetype="text/restructuredtext" -->
Expand Down Expand Up @@ -509,7 +506,7 @@ We use `max_col` to limit the plot to the 10 most abundant V-genes.

```python
ax = ir.pl.group_abundance(
adata, groupby="IR_VJ_1_v_gene", target_col="cluster", normalize=True, max_cols=10
adata, groupby="IR_VJ_1_v_call", target_col="cluster", normalize=True, max_cols=10
)
```

Expand All @@ -518,13 +515,13 @@ We can pre-select groups by filtering `adata`:
```python
ax = ir.pl.group_abundance(
adata[
adata.obs["IR_VDJ_1_v_gene"].isin(
adata.obs["IR_VDJ_1_v_call"].isin(
["TRBV20-1", "TRBV7-2", "TRBV28", "TRBV5-1", "TRBV7-9"]
),
:,
],
groupby="cluster",
target_col="IR_VDJ_1_v_gene",
target_col="IR_VDJ_1_v_call",
normalize=True,
)
```
Expand Down Expand Up @@ -575,13 +572,13 @@ A spectratype-plot by gene usage. To pre-select specific genes, we can simply fi
```python
ir.pl.spectratype(
adata[
adata.obs["IR_VDJ_1_v_gene"].isin(
adata.obs["IR_VDJ_1_v_call"].isin(
["TRBV20-1", "TRBV7-2", "TRBV28", "TRBV5-1", "TRBV7-9"]
),
:,
],
cdr3_col="IR_VDJ_1_cdr3",
color="IR_VDJ_1_v_gene",
cdr3_col="IR_VDJ_1_junction_aa",
color="IR_VDJ_1_v_call",
normalize="sample",
fig_kws={"dpi": 120},
)
Expand Down

0 comments on commit aa6e81a

Please sign in to comment.