Skip to content

Commit

Permalink
Make graph view default; better linking to datasets which have those …
Browse files Browse the repository at this point in the history
…cells
  • Loading branch information
pgleeson committed Aug 9, 2024
1 parent 570dd7f commit 6262c02
Show file tree
Hide file tree
Showing 39 changed files with 827 additions and 754 deletions.
43 changes: 38 additions & 5 deletions cect/Cells.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,14 @@
############################################################

import pandas as pd
import sys

from cect.WormAtlasInfo import WA_COLORS

cell_notes = {}

connectomes = None


SENSORY_NEURONS_1_COOK = [
"IL2DL",
Expand Down Expand Up @@ -998,17 +1003,21 @@
"GLRVR",
]

for cell in GLR_CELLS:
cell_notes[cell] = "GLR cell"

CEPSH_CELLS = [
"CEPshDL",
"CEPshDR",
"CEPshVL",
"CEPshVR",
]

for cell in CEPSH_CELLS:
cell_notes[cell] = "glial"

GLIAL_CELLS = GLR_CELLS + CEPSH_CELLS

for cell in GLIAL_CELLS:
cell_notes[cell] = "glial"

PHARYNGEAL_MARGINAL_CELLS = [
"mc1DL",
Expand Down Expand Up @@ -1141,7 +1150,7 @@ def get_standard_color(cell):
elif cell in PHARYNGEAL_BASEMENT_MEMBRANE:
return WA_COLORS["Hermaphrodite"]["Other Tissues"]["basement membrane"]
elif cell in GLR_CELLS:
return WA_COLORS["Hermaphrodite"]["Other Tissues"]["glr cell"]
return WA_COLORS["Hermaphrodite"]["Other Tissues"]["GLR cell"]
elif cell in CEPSH_CELLS:
return WA_COLORS["Hermaphrodite"]["Epithelial Tissue"][
"sheath cell other than amphid sheath and phasmid"
Expand Down Expand Up @@ -1274,16 +1283,32 @@ def get_cell_link(cell_name, html=False, text=None):
return cell_name


def _get_dataset_link(reader_name, html=False, text=None):
url = "%s_data_graph.md" % reader_name

if html:
return '<a href="%s">%s</a>' % (url, reader_name if text is None else text)
else:
return "[%s](%s)" % (reader_name if text is None else text, url)


def _generate_cell_table(cells):
all_data = {}

all_data[""] = ["Notes", "Link"]
all_data[""] = ["Notes", "Datasets", "Link"]

for cell in sorted(cells):
desc = cell_notes[cell] if cell in cell_notes else "???"
desc = desc[0].upper() + desc[1:]

datasets = " "
for reader_name, conn in connectomes.items():
if cell in conn.nodes:
datasets += "%s, " % _get_dataset_link(reader_name)

all_data[f'<a name="{cell}"></a>{cell}'] = [
desc,
datasets[:-2],
get_cell_link(cell, text="WormAtlas"),
]

Expand All @@ -1295,7 +1320,11 @@ def _generate_cell_table(cells):


if __name__ == "__main__":
from cect.WormAtlasInfo import WA_COLORS
quick = len(sys.argv) > 1 and eval(sys.argv[1])

from cect.Comparison import generate_comparison_page

connectomes = generate_comparison_page(quick)

filename = "docs/Cells.md"

Expand Down Expand Up @@ -1326,6 +1355,8 @@ def _generate_cell_table(cells):
f.write(_generate_cell_table(ODD_PHARYNGEAL_MUSCLE_NAMES))
elif cell_type == "even numbered pharyngeal muscle":
f.write(_generate_cell_table(EVEN_PHARYNGEAL_MUSCLE_NAMES))
elif cell_type == "polymodal neuron":
f.write(_generate_cell_table(PHARYNGEAL_POLYMODAL_NEURONS))
elif cell_type == "marginal cells (mc) of the pharynx":
f.write(_generate_cell_table(PHARYNGEAL_MARGINAL_CELLS))
elif cell_type == "pharyngeal epithelium":
Expand Down Expand Up @@ -1359,3 +1390,5 @@ def _generate_cell_table(cells):
f.write(_generate_cell_table(INTESTINE))
elif cell_type == "intestinal muscle":
f.write(_generate_cell_table(INTESTINAL_MUSCLES))
elif cell_type == "GLR cell":
f.write(_generate_cell_table(GLR_CELLS))
Loading

0 comments on commit 6262c02

Please sign in to comment.