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
10 changes: 5 additions & 5 deletions notebooks/Basics_of_lineageTree.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,11 @@
},
{
"cell_type": "code",
"execution_count": 24,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# lT.plot_nodes(list(lT.roots)[3])"
"# lT.plot_nodes(list(lT.roots)[3]) # noqa: ERA001\n"
]
},
{
Expand Down Expand Up @@ -556,7 +556,7 @@
"source": [
"selected_root = list(lT.roots)[0]\n",
"lT.get_subtree_nodes(selected_root) # returns all the nodes spawned by a node\n",
"lT.all_chains # returns a list of lists that contains each chain of the dataset\n",
"lT.all_chains # returns a list of lists that contains each chain of the dataset # noqa: B018\n",
"lT.get_all_chains_of_subtree(\n",
" selected_root\n",
") # returns a list of lists that contains each chain of the subtree of a node"
Expand All @@ -568,8 +568,8 @@
"metadata": {},
"outputs": [],
"source": [
"lT.nodes # all the nodes present on the lT object\n",
"lT.roots # all the roots of the object\n",
"lT.nodes # all the nodes present on the lT object # noqa: B018\n",
"lT.roots # all the roots of the object # noqa: B018\n",
"lT.successor # dictionary that connects an id to a list of successors, can be used to find all edges."
]
},
Expand Down
12 changes: 6 additions & 6 deletions notebooks/Easy_clustermaps.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
"\n",
"try:\n",
" import seaborn as sns\n",
"except:\n",
" !pip install seaborn\n",
"except ModuleNotFoundError:\n",
" %pip install seaborn\n",
"finally:\n",
" from itertools import combinations\n",
"\n",
Expand Down Expand Up @@ -77,7 +77,7 @@
"\n",
"### Or load a manager###\n",
"\n",
"# lTm = lineageTreeManager.load(\"path_to/Manager.ltM\")"
"# lTm = lineageTreeManager.load(\"path_to/Manager.ltM\") # noqa: ERA001"
]
},
{
Expand Down Expand Up @@ -195,7 +195,7 @@
"outputs": [],
"source": [
"comparison = {}\n",
"for i, (n1, n2) in enumerate(combs):\n",
"for n1, n2 in combs:\n",
" comparison[n1, n2] = lTm.cross_lineage_edit_distance(\n",
" names[n1][1],\n",
" names[n1][0],\n",
Expand Down Expand Up @@ -247,8 +247,8 @@
"source": [
"g = sns.clustermap(\n",
" hierarchy,\n",
" xticklabels=[label for label in labels], # labels,\n",
" yticklabels=[label for label in labels],\n",
" xticklabels=list(labels),\n",
" yticklabels=list(labels),\n",
" cmap=\"viridis\",\n",
" row_linkage=linkage_data,\n",
" col_linkage=linkage_data,\n",
Expand Down
2 changes: 1 addition & 1 deletion src/LineageTree/lineageTree.py
Original file line number Diff line number Diff line change
Expand Up @@ -3497,7 +3497,7 @@ def __init__(
f"Attribute `starting_time` was a `{type(starting_time)}`, has been casted as an `int`.",
stacklevel=2,
)
self._time = {node: starting_time for node in self.roots}
self._time = dict.fromkeys(self.roots, starting_time)
queue = list(self.roots)
for node in queue:
for succ in self._successor[node]:
Expand Down
4 changes: 2 additions & 2 deletions src/LineageTree/loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ def read_from_binary(fname: str, name: None | str = None) -> lineageTree:
)
)
)
is_root = {c: True for c in tmp}
is_root = dict.fromkeys(tmp, True)
done = True
while (
i < len(number_sequence) and not done
Expand Down Expand Up @@ -635,7 +635,7 @@ def read_from_txt_for_celegans_BAO(
ids = list(range(unique_id, unique_id + len(lc)))
successor.update({ids[i]: [ids[i + 1]] for i in range(len(ids) - 1)})
properties["expression"].update(dict(zip(ids, lc, strict=True)))
properties["_labels"].update({id_: c for id_ in ids})
properties["_labels"].update(dict.fromkeys(ids, c))
to_link[c] = (unique_id, unique_id + len(lc) - 1)
unique_id += len(lc)

Expand Down
1 change: 1 addition & 0 deletions src/LineageTree/test/test_lineageTree.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import numpy as np
import pytest

from LineageTree import (
lineageTree,
lineageTreeManager,
Expand Down
Loading