Skip to content

Commit

Permalink
Return gamma delta notebook (#250)
Browse files Browse the repository at this point in the history
* Create gamma_delta.ipynb

* black updated...

* Update gamma_delta.ipynb

typo
  • Loading branch information
zktuong committed Feb 3, 2023
1 parent 158277e commit 878c1a0
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 30 deletions.
6 changes: 1 addition & 5 deletions dandelion/plotting/_plotting.py
Expand Up @@ -138,11 +138,7 @@ def clone_rarefaction(
n = np.append(n, tot[i])
rarecurve[res_.index[i]] = [
rarefun(
np.array(
res_.iloc[
i,
]
),
np.array(res_.iloc[i,]),
z,
)
for z in n
Expand Down
19 changes: 4 additions & 15 deletions dandelion/preprocessing/_preprocessing.py
Expand Up @@ -2005,12 +2005,8 @@ def _create_germlines_object(
# Define Receptor iterator
receptor_iter = (
(
data.data.loc[
x,
].sequence_id,
data.data.loc[
x,
],
data.data.loc[x,].sequence_id,
data.data.loc[x,],
)
for x in data.data.index
)
Expand Down Expand Up @@ -2042,12 +2038,8 @@ def _create_germlines_object(
# Define Receptor iterator
receptor_iter = (
(
data.loc[
x,
].sequence_id,
data.loc[
x,
],
data.loc[x,].sequence_id,
data.loc[x,],
)
for x in data.index
)
Expand Down Expand Up @@ -2741,7 +2733,6 @@ def quantify_mutations(
if region_definition is None:
reg_d = NULL
else:

reg_d = base.get(region_definition)

if mutation_definition is None:
Expand Down Expand Up @@ -3392,7 +3383,6 @@ def __init__(
h_locus_p = list(data1["locus"])
if len(h_p) > 1:
if "sequence_alignment" in data1:

(
data1,
h_p,
Expand Down Expand Up @@ -3423,7 +3413,6 @@ def __init__(
sum_umi = sum(h_umi_p)
if "IGHD" in h_ccall_p:
if all(x in ["IGHM", "IGHD"] for x in h_ccall_p):

h_ccall_p_igm_count = dict(
data1[data1["c_call"] == "IGHM"][
"duplicate_count"
Expand Down
6 changes: 1 addition & 5 deletions dandelion/tools/_diversity.py
Expand Up @@ -104,11 +104,7 @@ def clone_rarefaction(
n = np.append(n, tot[i])
rarecurve[res_.index[i]] = [
rarefun(
np.array(
res_.iloc[
i,
]
),
np.array(res_.iloc[i,]),
z,
)
for z in n
Expand Down
4 changes: 0 additions & 4 deletions dandelion/tools/_network.py
Expand Up @@ -1125,7 +1125,6 @@ def nx2gt(nxG):
# Add the node properties first
nprops = set() # cache keys to only add properties once
for node, data in list(nxG.nodes(data=True)):

# Go through all the properties if not seen and add them.
for key, val in data.items():
if key in nprops:
Expand All @@ -1148,7 +1147,6 @@ def nx2gt(nxG):
# Add the edge properties second
eprops = set() # cache keys to only add properties once
for src, dst, data in list(nxG.edges(data=True)):

# Go through all the edge properties if not seen and add them.
for key, val in data.items():
if key in eprops:
Expand All @@ -1167,7 +1165,6 @@ def nx2gt(nxG):
# Add the nodes
vertices = {} # vertex mapping for tracking edges later
for node, data in list(nxG.nodes(data=True)):

# Create the vertex and annotate for our edges later
v = gtG.add_vertex()
vertices[node] = v
Expand All @@ -1179,7 +1176,6 @@ def nx2gt(nxG):

# Add the edges
for src, dst, data in list(nxG.edges(data=True)):

# Look up the vertex structs from our vertices mapping and add edge.
e = gtG.add_edge(vertices[src], vertices[dst])

Expand Down
1 change: 0 additions & 1 deletion dandelion/utilities/_core.py
Expand Up @@ -2351,7 +2351,6 @@ def initialize_metadata(
vdj_gene_calls = ["v_call", "d_call", "j_call"]
if collapse_alleles:
for x in vdj_gene_calls:

if x in vdj_data.data:
for c in tmp_metadata:
if x in c:
Expand Down
54 changes: 54 additions & 0 deletions docs/notebooks/gamma_delta.ipynb
@@ -0,0 +1,54 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Dandelion for TCR gamma/delta reannotation\n",
"\n",
"![dandelion_logo](img/dandelion_logo_illustration.png)\n",
"\n",
"In Cell Ranger 3.1.0, the VDJ algorithm was changed to favour TCR alpha/beta annotation. Since then, calling gamma/delta chains has become challenging, and 10X support recommends using Cell Ranger 3.0.2 when working with gamma/delta-rich libraries. \n",
"\n",
"However, the contigs themselves are still accurately reconstructed, just not annotated correctly. It may be desirable to use a newer Cell Ranger version for access to some previously unavailable run options, like specifying custom enrichment primers. In those cases, the contigs can be reannotated via `dandelion` to yield functional output.\n",
"\n",
"Just follow [standard protocol](https://sc-dandelion.readthedocs.io/en/latest/notebooks/Q1-singularity-preprocessing.html) for preparing and running the preprocessing. The parameterisation recommendation is applicable here as well:\n",
"\n",
"```bash\n",
"singularity run -B $PWD /path/to/sc-dandelion_latest.sif dandelion-preprocess \\\n",
" --chain TR \\\n",
" --file_prefix all \\\n",
" --filter_to_high_confidence\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 4
}

0 comments on commit 878c1a0

Please sign in to comment.