Skip to content

Commit 1c737db

Browse files
authored
Merge pull request #59 from pgleeson/main
Restructure, move all readers to readers submodule
2 parents 4f3a2d0 + faa7114 commit 1c737db

202 files changed

Lines changed: 503 additions & 385 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -782,3 +782,4 @@ __pycache__
782782
/docs/Brainmap_Test_data_symmetry.md
783783
/cect/data/NeuroML/*.dat
784784
/cect/data/.DS_Store
785+
/docs/notebooks/.ipynb_checkpoints

cect/Analysis.py

Lines changed: 27 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -121,41 +121,41 @@ def convert_to_symmetry_array(cds, synclasses, verbose=False):
121121

122122

123123
def test_bilaterals():
124-
# from cect.White_whole import get_instance
125-
# from cect.Yim2024DataReader import get_instance
124+
# from cect.readers.White_whole import get_instance
125+
# from cect.readers.Yim2024DataReader import get_instance
126126

127-
# from cect.VarshneyDataReader import get_instance
127+
# from cect.readers.VarshneyDataReader import get_instance
128128

129129
#
130-
from cect.White_whole import get_instance
131-
# from cect.WormNeuroAtlasFuncReader import get_instance
130+
from cect.readers.White_whole import get_instance
131+
# from cect.readers.WormNeuroAtlasFuncReader import get_instance
132132

133-
# from cect.Cook2020DataReader import get_instance
134-
# from cect.TestDataReader import get_instance
133+
# from cect.readers.Cook2020DataReader import get_instance
134+
# from cect.readers.TestDataReader import get_instance
135135

136136
"""
137-
from cect.RipollSanchezDataReader import get_instance
138-
from cect.WitvlietDataReader1 import get_instance # 65
139-
from cect.WitvlietDataReader2 import get_instance # 70.85
140-
from cect.WitvlietDataReader3 import get_instance # 67.5
141-
from cect.WitvlietDataReader4 import get_instance # 78.27
142-
from cect.WitvlietDataReader5 import get_instance # 71.65
143-
from cect.WitvlietDataReader6 import get_instance # 71.31
144-
from cect.WitvlietDataReader7 import get_instance # 66.57
145-
from cect.WitvlietDataReader8 import get_instance # 69.70
146-
147-
from cect.Cook2019MaleReader import get_instance
148-
from cect.WitvlietDataReader8 import get_instance
149-
from cect.SpreadsheetDataReader import get_instance
150-
from cect.BrittinDataReader import get_instance
151-
from cect.WormNeuroAtlasMAReader import get_instance
152-
from cect.RipollSanchezDataReader import get_instance
153-
from cect.Cook2019HermReader import get_instance
154-
from cect.ConnectomeView import SOCIAL_VIEW as view"""
137+
from cect.readers.RipollSanchezDataReader import get_instance
138+
from cect.readers.WitvlietDataReader1 import get_instance # 65
139+
from cect.readers.WitvlietDataReader2 import get_instance # 70.85
140+
from cect.readers.WitvlietDataReader3 import get_instance # 67.5
141+
from cect.readers.WitvlietDataReader4 import get_instance # 78.27
142+
from cect.readers.WitvlietDataReader5 import get_instance # 71.65
143+
from cect.readers.WitvlietDataReader6 import get_instance # 71.31
144+
from cect.readers.WitvlietDataReader7 import get_instance # 66.57
145+
from cect.readers.WitvlietDataReader8 import get_instance # 69.70
146+
147+
from cect.readers.Cook2019MaleReader import get_instance
148+
from cect.readers.WitvlietDataReader8 import get_instance
149+
from cect.readers.SpreadsheetDataReader import get_instance
150+
from cect.readers.BrittinDataReader import get_instance
151+
from cect.readers.WormNeuroAtlasMAReader import get_instance
152+
from cect.readers.RipollSanchezDataReader import get_instance
153+
from cect.readers.Cook2019HermReader import get_instance
154+
from cect.readers.ConnectomeView import SOCIAL_VIEW as view"""
155155
#
156-
# from cect.ConnectomeView import NEURONS_VIEW as view
156+
# from cect.readers.ConnectomeView import NEURONS_VIEW as view
157157

158-
# from cect.ConnectomeView import NONPHARYNGEAL_NEURONS_HM_VIEW as view
158+
# from cect.readers.ConnectomeView import NONPHARYNGEAL_NEURONS_HM_VIEW as view
159159
from cect.ConnectomeView import RAW_VIEW as view
160160
# from cect.ConnectomeView import PHARYNX_VIEW as view
161161

@@ -204,10 +204,6 @@ def plot_symmetry(
204204
Plot symmetry for specified synclass across selected datasets.
205205
Produces 3 subplots for SensorySomaticH, MotorSomaticH, InterneuronsSomaticH.
206206
207-
Parameters:
208-
json_file (str): Path to the cached JSON file.
209-
synclass (str): Synapse class to plot, e.g., "Chemical".
210-
datasets_to_plot (list, optional): List of datasets to include. Defaults to all.
211207
"""
212208
# Load JSON data
213209
with open(json_file, "r") as f:

cect/CellAnalysis.py

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,36 +16,36 @@
1616

1717

1818
def test_bilaterals():
19-
# from cect.White_whole import get_instance
20-
# from cect.Yim2024DataReader import get_instance
19+
# from cect.readers.White_whole import get_instance
20+
# from cect.readers.Yim2024DataReader import get_instance
2121

22-
# from cect.VarshneyDataReader import get_instance
22+
# from cect.readers.VarshneyDataReader import get_instance
2323

2424
#
25-
from cect.White_whole import get_instance
26-
# from cect.WormNeuroAtlasFuncReader import get_instance
25+
from cect.readers.White_whole import get_instance
26+
# from cect.readers.WormNeuroAtlasFuncReader import get_instance
2727

28-
# from cect.Cook2020DataReader import get_instance
29-
# from cect.TestDataReader import get_instance
28+
# from cect.readers.Cook2020DataReader import get_instance
29+
# from cect.readers.TestDataReader import get_instance
3030

3131
"""
32-
from cect.RipollSanchezDataReader import get_instance
33-
from cect.WitvlietDataReader1 import get_instance # 65
34-
from cect.WitvlietDataReader2 import get_instance # 70.85
35-
from cect.WitvlietDataReader3 import get_instance # 67.5
36-
from cect.WitvlietDataReader4 import get_instance # 78.27
37-
from cect.WitvlietDataReader5 import get_instance # 71.65
38-
from cect.WitvlietDataReader6 import get_instance # 71.31
39-
from cect.WitvlietDataReader7 import get_instance # 66.57
40-
from cect.WitvlietDataReader8 import get_instance # 69.70
41-
42-
from cect.Cook2019MaleReader import get_instance
43-
from cect.WitvlietDataReader8 import get_instance
44-
from cect.SpreadsheetDataReader import get_instance
45-
from cect.BrittinDataReader import get_instance
46-
from cect.WormNeuroAtlasMAReader import get_instance
47-
from cect.RipollSanchezDataReader import get_instance
48-
from cect.Cook2019HermReader import get_instance
32+
from cect.readers.RipollSanchezDataReader import get_instance
33+
from cect.readers.WitvlietDataReader1 import get_instance # 65
34+
from cect.readers.WitvlietDataReader2 import get_instance # 70.85
35+
from cect.readers.WitvlietDataReader3 import get_instance # 67.5
36+
from cect.readers.WitvlietDataReader4 import get_instance # 78.27
37+
from cect.readers.WitvlietDataReader5 import get_instance # 71.65
38+
from cect.readers.WitvlietDataReader6 import get_instance # 71.31
39+
from cect.readers.WitvlietDataReader7 import get_instance # 66.57
40+
from cect.readers.WitvlietDataReader8 import get_instance # 69.70
41+
42+
from cect.readers.Cook2019MaleReader import get_instance
43+
from cect.readers.WitvlietDataReader8 import get_instance
44+
from cect.readers.SpreadsheetDataReader import get_instance
45+
from cect.readers.BrittinDataReader import get_instance
46+
from cect.readers.WormNeuroAtlasMAReader import get_instance
47+
from cect.readers.RipollSanchezDataReader import get_instance
48+
from cect.readers.Cook2019HermReader import get_instance
4949
from cect.ConnectomeView import SOCIAL_VIEW as view"""
5050
#
5151
# from cect.ConnectomeView import NEURONS_VIEW as view

cect/CellInfo.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
from cect.Comparison import reader_colors
1717

18-
from cect.Wang2024MaleReader import get_instance as get_wang2024_male_instance
18+
from cect.readers.Wang2024MaleReader import get_instance as get_wang2024_male_instance
1919

2020

2121
from cect import print_
@@ -34,7 +34,7 @@ def get_dataset_link(dataset):
3434
dataset (str): The dataset to link to
3535
3636
Returns:
37-
str: A hyperlink to the dataset
37+
(str): A hyperlink to the dataset
3838
"""
3939
# return dataset+'--'
4040
dataset_text = dataset.replace("Herm", " Herm").replace("Male", " Male")
@@ -459,7 +459,7 @@ def generate_cell_info_pages(connectomes):
459459
if "-pca" in sys.argv:
460460
# from cect.Cells import PREFERRED_HERM_NEURON_NAMES
461461

462-
from cect.White_whole import get_instance
462+
from cect.readers.White_whole import get_instance
463463

464464
cds_src = get_instance()
465465

@@ -587,35 +587,35 @@ def generate_cell_info_pages(connectomes):
587587
print(f" - '{cell}': '{cell}.md'")
588588

589589
else:
590-
from cect.White_whole import get_instance
590+
from cect.readers.White_whole import get_instance
591591

592592
cds_white = get_instance()
593593

594-
from cect.WitvlietDataReader8 import get_instance
594+
from cect.readers.WitvlietDataReader8 import get_instance
595595

596596
cds_w8 = get_instance()
597597

598598
connectomes = {"White_whole": cds_white, "Witvliet8": cds_w8}
599599

600-
from cect.Cook2019HermReader import get_instance
600+
from cect.readers.Cook2019HermReader import get_instance
601601

602602
connectomes["Cook2019Herm"] = get_instance(from_cache=True)
603603

604-
from cect.Cook2019MaleReader import get_instance
604+
from cect.readers.Cook2019MaleReader import get_instance
605605

606606
connectomes["Cook2019Male"] = get_instance(from_cache=True)
607-
from cect.WormNeuroAtlasReader import get_instance
607+
from cect.readers.WormNeuroAtlasReader import get_instance
608608

609609
connectomes["WormNeuroAtlas"] = get_instance()
610610

611611
"""
612-
from cect.WormNeuroAtlasMAReader import get_instance
612+
from cect.readers.WormNeuroAtlasMAReader import get_instance
613613
connectomes['Bentley2016_MA'] = get_instance()
614614
615-
from cect.WormNeuroAtlasFuncReader import get_instance
615+
from cect.readers.WormNeuroAtlasFuncReader import get_instance
616616
connectomes['Randi2023'] = get_instance()
617617
618-
from cect.RipollSanchezShortRangeReader import get_instance
618+
from cect.readers.RipollSanchezShortRangeReader import get_instance
619619
connectomes['RipollSanchezShortRange'] = get_instance() """
620620

621621
# load_individual_neuron_info()

cect/Cells.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def get_cell_notes(cell: str):
5252
cell (str): Name of the cell
5353
5454
Returns:
55-
str: Description of the cell type
55+
(str): Description of the cell type
5656
"""
5757
desc = cell_notes[cell] if cell in cell_notes else "???"
5858
desc = desc[0].upper() + desc[1:]
@@ -1524,7 +1524,7 @@ def get_primary_classification():
15241524
"""Get the primary classification of the cells, based on https://www.wormatlas.org/colorcode.htm
15251525
15261526
Returns:
1527-
dict: Dict of cells vs classification/group from https://www.wormatlas.org/colorcode.htm
1527+
(dict): Dict of cells vs classification/group from https://www.wormatlas.org/colorcode.htm
15281528
"""
15291529

15301530
classification = {}
@@ -1701,7 +1701,7 @@ def is_known_cell(cell: str, allow_modelled_neurons: bool = False):
17011701
cell (str): Cell name
17021702
17031703
Returns:
1704-
bool: Whether this is a known cell name
1704+
(bool): Whether this is a known cell name
17051705
"""
17061706
if allow_modelled_neurons:
17071707
return cell in ALL_PREFERRED_CELL_NAMES + KNOWN_MODELLED_NEURONS
@@ -1717,7 +1717,7 @@ def get_SIM_class(cell: str):
17171717
cell: which cell to assess
17181718
17191719
Returns:
1720-
str: whether a cell is Sensory/Interneuron/Motorneuron (or Other)
1720+
(str): whether a cell is Sensory/Interneuron/Motorneuron (or Other)
17211721
"""
17221722

17231723
pharyngeal_polymodal_to_class_motor = [
@@ -1753,13 +1753,13 @@ def get_contralateral_cell(cell: str):
17531753
"""Gets the contralateral cell for a given cell, based on Kim et al. 2024: https://doi.org/10.1101/2024.10.03.616419
17541754
17551755
Args:
1756-
cell (_type_): _description_
1756+
cell (str): The cell for which to get the contralateral cell
17571757
17581758
Raises:
1759-
Exception: _description_
1759+
Exception: If the cell is not a known cell, or if it is a non-muscle cell for which contralateral cell determination is not yet implemented/tested
17601760
17611761
Returns:
1762-
_type_: _description_
1762+
(str): The contralateral cell
17631763
"""
17641764
if not is_known_cell(cell, allow_modelled_neurons=True):
17651765
raise Exception(
@@ -1972,7 +1972,10 @@ def is_any_neuron(cell: str, allow_modelled_neurons: bool = False):
19721972

19731973
def remove_leading_index_zero(cell: str):
19741974
"""
1975-
Returns neuron name with an index without leading zero. E.g. VB01 -> VB1.
1975+
Removes leading zero from cell index, e.g. VB01 -> VB1.
1976+
1977+
Returns:
1978+
(str): Name with an index without leading zero.
19761979
"""
19771980
if cell[:2] in ["DA", "AS", "DD", "DB", "VA", "VB", "VC", "VD"] and cell[
19781981
-2:

0 commit comments

Comments
 (0)