Skip to content

Commit 17a3d45

Browse files
committed
Add running example, expected results, and required actions (AnatomicMaps#170).
1 parent 8590f61 commit 17a3d45

1 file changed

Lines changed: 85 additions & 0 deletions

File tree

tools/flatmap_diagnostic.py

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,91 @@
3232
- rdflib
3333
- mapknowledge
3434
All dependencies except pandas are installable using standard `uv sync` when installing mapmaker.
35+
36+
Running the script:
37+
# If the map sources is available in remote repository
38+
python tools/flatmap_diagnostic.py \
39+
--map-folders \
40+
{FLATMAP_ROOT}/{UUID1} \
41+
{FLATMAP_ROOT}/{UUID2}
42+
--output-dir {REPORT_OUTPUT_DIR}
43+
44+
# If the map sources is not available in remote repository
45+
python tools/flatmap_diagnostic.py \
46+
--manifest-files manifest.json \
47+
{SOURCE_DIR}/human-flatmap/female.manifest.json \
48+
{SOURCE_DIR}/human-flatmap/male.manifest.json \
49+
--map-folders \
50+
{FLATMAP_ROOT}/{UUID1} \
51+
{FLATMAP_ROOT}/{UUID2}
52+
--output-dir {REPORT_OUTPUT_DIR}
53+
54+
Output example `{map-ids}-node_minimal.csv`:
55+
Needed node Node label Superclass Superclass label Paths Phenotypes Maps
56+
('ILX:0793626', ()) ventrolateral periaqueductal gray ('UBERON:0001062',) ('-',) ['ilxtr:neuron-type-keast-19', …] [['ilxtr:ProjectionPhenotype']] ['human-flatmap_male']
57+
('ILX:0786933', ()) Second lumbar ganglion ('UBERON:0001062',) ('-',) ['ilxtr:sparc-nlp/swglnd/162', …] [['ilxtr:neuron-phenotype-sym-pre'], …] [('human-flatmap_male', 'human-flatmap_female')]
58+
('ILX:0726402', ()) prostate gland smooth muscle ('',) ('-',) ['ilxtr:sparc-nlp/prostate/24', …] [['ilxtr:neuron-phenotype-sym-post'], …]['human-flatmap_male']
59+
('ILX:0739297', ()) sixth lumbar sympathetic ganglion ('UBERON:0001062',) ('-',) ['ilxtr:neuron-type-keast-8', …] [['ilxtr:PreGanglionicPhenotype', …] [('human-flatmap_male', 'human-flatmap_female')]
60+
61+
Possible actions for missing nodes for the the specified maps:
62+
1. Add object to map
63+
- Add the anatomical node directly to the flatmap source if it is missing but required for rendering.
64+
- Example:
65+
- Node: ('ILX:0793626', ()) — ventrolateral periaqueductal gray
66+
- Action: Add to map to render ilxtr:neuron-type-keast-19.
67+
2. Add entries in proxy
68+
- Link the missing node to a more specific/detailed annotation already present in the map.
69+
- Example:
70+
{
71+
"feature": "ILX:0786933",
72+
"name": "Second lumbar ganglion",
73+
"proxies": [
74+
"ILX:0792386"
75+
]
76+
}
77+
Proxing: ILX:0786933 — Second lumbar ganglion to ILX:0792386 — Right second lumbar ganglion
78+
79+
3. Add entries in alias
80+
- Link the missing node to a more general/parent node in the map.
81+
- Example:
82+
{
83+
"id": [
84+
"UBERON:0002367",
85+
[]
86+
],
87+
"name": "prostate gland",
88+
"aliases": [
89+
[
90+
"ILX:0726402",
91+
[]
92+
]
93+
]
94+
}
95+
Aliasing: ILX:0726402 — Prostate gland smooth muscle as UBERON:0002367 — Prostate gland
96+
4. Nothing to do
97+
- When the missing node is legitimately absent in the species being mapped.
98+
- Example:
99+
- Node: ('ILX:0739297', ()) — sixth lumbar sympathetic ganglion
100+
- Notes: Not present in humans; unrendered neuron type ilxtr:neuron-type-keast-8 is valid.
101+
102+
Output example `{manifest-ids}-source_check.csv`:
103+
Type Object code Object location Issue Source
104+
id digestive_41 SVG Multiple SVG ids found human-flatmap_male;human-flatmap_female
105+
class digestive_43 Anatomical Map Anatomical map class not in properties features and SVG human-flatmap_male;human-flatmap_female
106+
id glossopharyngeal_afferent_nerve_cn_ix SVG SVG id not in properties human-flatmap_male;human-flatmap_female
107+
108+
Possible actions for source inconsistencies:
109+
1. Duplicate SVG IDs (critical issue)
110+
- The same ID is used more than once in the SVG file. Action:
111+
- If both refer to the same anatomical term, create a new entry in properties.json with a unique ID pointing to the same term, and assign it in SVG.
112+
- If they refer to different terms, assign a new unique ID for the new term and update the SVG.
113+
2. Anatomical class has been defined but not used (warning)
114+
- Action:
115+
- Remove the unused class from anatomical_map.json or add it to properties.json features with appropriate models.
116+
3. SVG ID not defined in properties (critical issue)
117+
- Action:
118+
- Add the missing ID to properties.json with appropriate class or models. Add to anatomical_map.json if necessary.
119+
- Remove the SVG element if it is not needed.
35120
"""
36121

37122
#===============================================================================

0 commit comments

Comments
 (0)