From 7cd865a525cef6fbf54a99eba5d131fa712e5e9e Mon Sep 17 00:00:00 2001 From: Troy Sincomb Date: Thu, 10 Dec 2020 12:29:06 -0800 Subject: [PATCH 01/10] doc for pax 2009/13 created --- nifstd/nifstd_tools/parcellation/paxinos.py | 6 +- nifstd/resources/pax-spine-2009.txt | 230 ++++++++++++++++++ nifstd/resources/pax-spine-2013.txt | 256 ++++++++++++++++++++ 3 files changed, 491 insertions(+), 1 deletion(-) create mode 100644 nifstd/resources/pax-spine-2009.txt create mode 100644 nifstd/resources/pax-spine-2013.txt diff --git a/nifstd/nifstd_tools/parcellation/paxinos.py b/nifstd/nifstd_tools/parcellation/paxinos.py index a3cfe6b3..95e9b1f1 100644 --- a/nifstd/nifstd_tools/parcellation/paxinos.py +++ b/nifstd/nifstd_tools/parcellation/paxinos.py @@ -112,7 +112,7 @@ class PaxSpinalAt(Atlas): species=NCBITaxon['???'], devstage=UBERON['0000113'], region=UBERON['???'], - citation=,) + citation='???',) PaxSpine2009 = PaxRatAt(iri=ilx['paxinos/uris/spinal/versions/2009'], label='Spine 2009', @@ -458,6 +458,8 @@ class PaxMFix(LocalSource): class PaxSpineSource2009(Source): + sourceFile = auth.get_path('resources') / 'pax-spine-2009.txt' + artifact = Artifacts.PaxSpine2009 @classmethod def validate(cls, ???): @@ -465,6 +467,8 @@ def validate(cls, ???): class PaxSpineSource2013(Source): + sourceFile = auth.get_path('resources') / 'pax-spine-2013.txt' + artifact = Artifacts.PaxSpine2013 @classmethod def validate(cls, ???): diff --git a/nifstd/resources/pax-spine-2009.txt b/nifstd/resources/pax-spine-2009.txt new file mode 100644 index 00000000..8aca6fb1 --- /dev/null +++ b/nifstd/resources/pax-spine-2009.txt @@ -0,0 +1,230 @@ +List of Structures +; # +; A +accessory nerve nucleus 11N +adductor motoneurons of lamina 9 Ad9 +anterior spinal artery asp +axial muscle motoneurons of lamina 9 Ax9 +; B +biceps motoneurons of lamina 9 Bi9 +; C +cauda equina CE +central canal CC +central cervical nucleus CeCv +coccygeal vertebra CoVert +cremaster motoneurons of lamina 9 Cr9 +crural extensor motoneurons of lamina 9 CEx9 +crural flexor motoneurons of lamina 9 CFl9 +cuneate fasciculus cu +; D +deltoid motoneurons of lamina 9 De9 +dorsal corticospinal tract dcs +dorsal funiculus df +dorsal nucleus (Clarke) D +dorsal root dr +dorsal root ganglion DRG +dorsolateral fasciculus (Lissauer) dl +; E +external anal sphincter motoneurons of lamina 9 ExA9 +external urethral sphincter motoneurons of lamina 9 ExU9 +; F +forearm extensor motoneurons of lamina 9 FEx9 +forearm flexor motoneurons of lamina 9 FFl9 +; G +Gl9 gracile fasciculus gr +gluteal motoneurons of lamina 9 Gl9 +; H +hamstring motoneurons of lamina 9 Hm9 +; I +iliopsoas motoneurons of lamina 9 IPs9 +infrahyoid muscle motoneurons of lamina 9 IH9 +intercalated nucleus ICl +intercalated nucleus, paraependymal part IClPe +intercostal muscle motoneurons of lamina 9 ICo9 +intermediolateral column IML +intermediomedial column IMM +internal basilar nucleus IB +; J +; K +; L +lamina 1 of the spinal gray 1Sp +lamina 10 of the spinal gray 10Sp +lamina 2 of the spinal gray 2Sp +lamina 2 of the spinal gray, inner part 2SpI +lamina 2 of the spinal gray, outer part 2SpO +lamina 3 of the spinal gray 3Sp +lamina 4 of the spinal gray 4Sp +lamina 5 of the spinal gray 5Sp +lamina 5 of the spinal gray, lateral part 5SpL +lamina 6 of the spinal gray 6Sp +lamina 6 of the spinal gray, lateral part 6SpL +lamina 6 of the spinal gray, medial part 6SpM +lamina 7 of the spinal gray 7Sp +lamina 8 of the spinal gray 8Sp +lamina 9 of the spinal gray 9Sp +lamina5 of the spinal gray, medial part 5SpM +lateral cervical nucleus LatC +lateral funiculus lf +lateral spinal nucleus LSp +latissimus dorsi motoneurons of lamina 9 LD9 +levator scapulae motoneurons of lamina 9 LS9 +lumbar dorsal commissural nucleus LDCom +lumbar precerebellar nucleus LPrCb +; M +manus motoneurons of lamina 9 Man9 +; N +; O +; P +pectoral muscle motoneurons of lamina 9 Pec9 +pes motoneurons of lamina 9 Pes9 +phrenic motoneurons of lamina 9 Ph9 +postsynaptic dorsal column pathway psdc +psoas motoneurons of lamina 9 Ps9 +; Q +quadratus lumborum motoneurons of lamina 9 QL9 +quadriceps motoneurons of lamina 9 Q9 +; R +rhomboid muscle motoneurons of lamina 9 Rh9 +rubrospinal tract rs +; S +sacral dorsal commissural nucleus SDCom +sacral parasympathetic nucleus SPSy +sacral precerebellar nucleus SPrCb +scalene muscle motoneurons of lamina 9 Sc9 +serratus anterior motoneurons in lamina 9 Sr9 +spinal accessory nerve 11n +spinous process of vertebra SpPr +sternomastoid motoneurons of lamina 9 SM9 +supraspinatus and infraspinatus motoneurons of lamina 9 SI9 +; T +tail muscle motoneurons of lamina 9 Tail9 +thoracoabdominal wall muscle motoneurons of lamina 9 ThAb9 +trapezius and sternomastoid motoneurons of lamina 9 TzSM9 +trapezius motoneurons of lamina 9 Tz9 +triceps motoneurons of lamina 9 Tr9 +; U +; V +ventral funiculus vf +ventral median fissure vmf +ventral root vr +ventral white commissure vwc +vertebral arch VAr +vertebral body VB +; W +; X +; Y +; Z + +List of Abbreviations +; # +10Sp lamina 10 of the spinal gray +11N accessory nerve nucleus +11n spinal accessory nerve +1Sp lamina 1 of the spinal gray +2Sp lamina 2 of the spinal gray +2SpI lamina 2 of the spinal gray, inner part +2SpO lamina 2 of the spinal gray, outer part +3Sp lamina 3 of the spinal gray +4Sp lamina 4 of the spinal gray +5Sp lamina 5 of the spinal gray +5SpL lamina 5 of the spinal gray, lateral part +5SpM lamina5 of the spinal gray, medial part +6Sp lamina 6 of the spinal gray +6SpL lamina 6 of the spinal gray, lateral part +6SpM lamina 6 of the spinal gray, medial part +7Sp lamina 7 of the spinal gray +8Sp lamina 8 of the spinal gray +9Sp lamina 9 of the spinal gray +; A +Ad9 adductor motoneurons of lamina 9 +Ax9 axial muscle motoneurons of lamina 9 +asp anterior spinal artery +; B +Bi9 biceps motoneurons of lamina 9 +; C +CE cauda equina +CEx9 crural extensor motoneurons of lamina 9 +CFl9 crural flexor motoneurons of lamina 9 +CeCv central cervical nucleus +CoVert coccygeal vertebra +Cr9 cremaster motoneurons of lamina 9 +cu cuneate fasciculus +; D +D dorsal nucleus (Clarke) +DRG dorsal root ganglion +De9 deltoid motoneurons of lamina 9 +dcs dorsal corticospinal tract +df dorsal funiculus +dl dorsolateral fasciculus (Lissauer) +dr dorsal root +; E +ExA9 external anal sphincter motoneurons of lamina 9 +ExU9 external urethral sphincter motoneurons of lamina 9 +; F +FEx9 forearm extensor motoneurons of lamina 9 +FFl9 forearm flexor motoneurons of lamina 9 +; G +Gl9 gluteal motoneurons of lamina 9 +gr Gl9 gracile fasciculus +; H +Hm9 hamstring motoneurons of lamina 9 +; I +IB internal basilar nucleus +ICl intercalated nucleus +IClPe intercalated nucleus, paraependymal part +ICo9 intercostal muscle motoneurons of lamina 9 +IH9 infrahyoid muscle motoneurons of lamina 9 +IML intermediolateral column +IMM intermediomedial column +; J +; K +; L +LD9 latissimus dorsi motoneurons of lamina 9 +LDCom lumbar dorsal commissural nucleus +LPrCb lumbar precerebellar nucleus +LS9 levator scapulae motoneurons of lamina 9 +LSp lateral spinal nucleus +LatC lateral cervical nucleus +lf lateral funiculus +; M +Man9 manus motoneurons of lamina 9 +; N +; O +; P +Pec9 pectoral muscle motoneurons of lamina 9 +Pes9 pes motoneurons of lamina 9 +Ph9 phrenic motoneurons of lamina 9 +Ps9 psoas motoneurons of lamina 9 +psdc postsynaptic dorsal column pathway +; Q +Q9 quadriceps motoneurons of lamina 9 +QL9 quadratus lumborum motoneurons of lamina 9 +; R +Rh9 rhomboid muscle motoneurons of lamina 9 +rs rubrospinal tract +; S +SDCom sacral dorsal commissural nucleus +SI9 supraspinatus and infraspinatus motoneurons of lamina 9 +SM9 sternomastoid motoneurons of lamina 9 +SPSy sacral parasympathetic nucleus +SPrCb sacral precerebellar nucleus +Sc9 scalene muscle motoneurons of lamina 9 +SpPr spinous process of vertebra +Sr9 serratus anterior motoneurons in lamina 9 +; T +Tail9 tail muscle motoneurons of lamina 9 +ThAb9 thoracoabdominal wall muscle motoneurons of lamina 9 +Tr9 triceps motoneurons of lamina 9 +TzSM9 trapezius and sternomastoid motoneurons of lamina 9 +; U +; V +VAr vertebral arch +VB vertebral body +vf ventral funiculus +vmf ventral median fissure +vr ventral root +vwc ventral white commissure +; W +; X +; Y +; Z diff --git a/nifstd/resources/pax-spine-2013.txt b/nifstd/resources/pax-spine-2013.txt new file mode 100644 index 00000000..6143055d --- /dev/null +++ b/nifstd/resources/pax-spine-2013.txt @@ -0,0 +1,256 @@ +List of Structures +; # +; A +adductor motoneurons of lamina 9 Ad9 +anterior corticospinal tract acs +anterior spinal artery asp +area 10 of the spinal gray 10Sp +axial muscle motoneurons of lamina 9 Ax9 +; B +biceps motoneurons of lamina 9 Bi9 +; C +cauda equina CE +caudal reticulospinal tract crsp +central canal CC +central cervical nucleus CeCv +coccygeal vertebra CoVert +cremaster motoneurons of lamina 9 Cr9 +crural extensor motoneurons of lamina 9 CEx9 +crural flexor motoneurons of lamina 9 CF19 +cuneate fasciculus cu +; D +deltoid motoneurons of lamina 9 De9 +dorsal corticospinal tract dcs +dorsal funiculus df +dorsal nucleus (clarke) D +dorsal root dr +dorsal root dr +dorsal root ganglion DRG +dorsal spinocerebellar tract dsc +dorsolateral fasciculus (lissauer) dl +dorsolateral spinothalamic tract dlst +; E +external anal sphincter motoneurons of lamina 9 ExA9 +external urethral sphincter motoneurons of lamina 9 ExU9 +; F +forearm extensor motoneurons of lamina 9 FEx9 +forearm flexor motoneurons of lamina 9 FFl9 +; G +gluteal motoneurons of lamina 9 Gl9 +gracile fasciculus gr +; H +hamstring motoneurons of lamina 9 Hm9 +; I +iliopsoas motoneurons of lamina 9 IPs9 +infrahyoid muscle motoneurons of lamina 9 IH9 +intercalated nucleus ICl +intercalated nucleus, paraependymal part ICIPe +intercostal muscle motoneurons of lamina 9 ICo9 +intermediolateral column IML +intermediolateral column, funicular part IMFL +intermediomedial column IMM +internal basilar nucleus IB +; J +; K +; L +lamina 1 of the spinal gray 1Sp +lamina 2 of the spinal gray 2Sp +lamina 2 of the spinal gray, inner part 2SpI +lamina 2 of the spinal gray, outer part 2SpO +lamina 3 of the spinal gray 3Sp +lamina 4 of the spinal gray 4Sp +lamina 5 of the spinal gray 5Sp +lamina 5 of the spinal gray, lateral part 5SpL +lamina 5 of the spinal gray, medial part 5SpM +lamina 6 of the spinal gray 6Sp +lamina 6 of the spinal gray, lateral part 6SpL +lamina 6 of the spinal gray, medial part 6SpM +lamina 7 of the spinal gray 7Sp +lamina 8 of the spinal gray 8Sp +lamina 9 of the spinal gray 9Sp +lateral cervical nucleus LatC +lateral corticospinal tract lcs +lateral funiculus lf +lateral spinal nucleus LSp +lateral spinothalamic tract lst +lateral vestibulospinal tract lvs +latissimus dorsi motoneurons of lamina 9 LD9 +levator scapulae motoneurons of lamina 9 LS9 +lumbar dorsal commissural nucleus LDCom +lumbar precerebellar nucleus LPrCb +; M +manus motoneurons of lamina 9 Man9 +medial vestibulospinal tract mvs +; N +; O +; P +pectoral muscle motoneurons of lamina 9 Pec9 +pes motoneurons of lamina 9 Pes9 +phrenic motoneurons of lamina 9 Ph9 +postsynaptic dorsal column pathway psdc +psoas muscle motoneurons of lamina 9 Ps9 +; Q +quadratus lumborum motoneurons of lamina 9 QL9 +quadriceps motoneurons of lamina 9 Q9 +; R +rhomboid muscle motoneurons of lamina 9 Rh9 +rostral reticulospinal tract rrsp +rubrospinal tract rs +; S +sacral dorsal commissural nucleus SDCom +sacral parasympathetic nucleus SPSy +sacral precerebellar nucleus SPrCb +scalene muscle motoneurons of lamina 9 Sc9 +serratus anterior motoneurons in lamina 9 Sr9 +spinal accessory nerve 11n +spinous process of vertebra SpPr +sternomastoid motoneurons of lamina 9 SM9 +supraspinatus and infraspinatus motoneurons of lamina 9 SI9 +; T +tail muscle motoneurons of lamina 9 Tail9 +thoracoabdominal wall muscle motoneurons of lamina 9 ThAb9 +trapezius and sternomastoid motoneurons of lamina 9 TzSM9 +trapezius motoneurons of lamina 9 Tz9 +triceps motoneurons of lamina 9 Tr9 +; U +; V +ventral funiculus vf +ventral median fissure vmf +ventral root vr +ventral spinocerebellar tract vsc +ventral spinothalamic tract vst +ventral white commissure vwc +vertebral arch VAr +vertebral body VB +; W +; X +; Y +; Z + +List of Abbreviations +; # +; A +adductor motoneurons of lamina 9 Ad9 +anterior corticospinal tract acs +anterior spinal artery asp +area 10 of the spinal gray 10Sp +axial muscle motoneurons of lamina 9 Ax9 +; B +biceps motoneurons of lamina 9 Bi9 +; C +cauda equina CE +caudal reticulospinal tract crsp +central canal CC +central cervical nucleus CeCv +coccygeal vertebra CoVert +cremaster motoneurons of lamina 9 Cr9 +crural extensor motoneurons of lamina 9 CEx9 +crural flexor motoneurons of lamina 9 CF19 +cuneate fasciculus cu +; D +deltoid motoneurons of lamina 9 De9 +dorsal corticospinal tract dcs +dorsal funiculus df +dorsal nucleus (clarke) D +dorsal root dr +dorsal root ganglion DRG +dorsal spinocerebellar tract dsc +dorsolateral fasciculus (lissauer) dl +dorsolateral spinothalamic tract dlst +; E +external anal sphincter motoneurons of lamina 9 ExA9 +external urethral sphincter motoneurons of lamina 9 ExU9 +; F +forearm extensor motoneurons of lamina 9 FEx9 +forearm flexor motoneurons of lamina 9 FFl9 +; G +gluteal motoneurons of lamina 9 Gl9 +gracile fasciculus gr +; H +hamstring motoneurons of lamina 9 Hm9 +; I +iliopsoas motoneurons of lamina 9 IPs9 +infrahyoid muscle motoneurons of lamina 9 IH9 +intercalated nucleus ICl +intercalated nucleus, paraependymal part ICIPe +intercostal muscle motoneurons of lamina 9 ICo9 +intermediolateral column IML +intermediolateral column, funicular part IMFL +intermediomedial column IMM +internal basilar nucleus IB +; J +; K +; L +lamina 1 of the spinal gray 1Sp +lamina 2 of the spinal gray 2Sp +lamina 2 of the spinal gray, inner part 2SpI +lamina 2 of the spinal gray, outer part 2SpO +lamina 3 of the spinal gray 3Sp +lamina 4 of the spinal gray 4Sp +lamina 5 of the spinal gray 5Sp +lamina 5 of the spinal gray, lateral part 5SpL +lamina 5 of the spinal gray, medial part 5SpM +lamina 6 of the spinal gray 6Sp +lamina 6 of the spinal gray, lateral part 6SpL +lamina 6 of the spinal gray, medial part 6SpM +lamina 7 of the spinal gray 7Sp +lamina 8 of the spinal gray 8Sp +lamina 9 of the spinal gray 9Sp +lateral cervical nucleus LatC +lateral corticospinal tract lcs +lateral funiculus lf +lateral spinal nucleus LSp +lateral spinothalamic tract lst +lateral vestibulospinal tract lvs +latissimus dorsi motoneurons of lamina 9 LD9 +levator scapulae motoneurons of lamina 9 LS9 +lumbar dorsal commissural nucleus LDCom +lumbar precerebellar nucleus LPrCb +; M +manus motoneurons of lamina 9 Man9 +medial vestibulospinal tract mvs +; N +; O +; P +pectoral muscle motoneurons of lamina 9 Pec9 +pes motoneurons of lamina 9 Pes9 +phrenic motoneurons of lamina 9 Ph9 +postsynaptic dorsal column pathway psdc +psoas muscle motoneurons of lamina 9 Ps9 +; Q +quadratus lumborum motoneurons of lamina 9 QL9 +quadriceps motoneurons of lamina 9 Q9 +; R +rhomboid muscle motoneurons of lamina 9 Rh9 +rostral reticulospinal tract rrsp +rubrospinal tract rs +; S +sacral dorsal commissural nucleus SDCom +sacral parasympathetic nucleus SPSy +sacral precerebellar nucleus SPrCb +scalene muscle motoneurons of lamina 9 Sc9 +serratus anterior motoneurons in lamina 9 Sr9 +spinal accessory nerve 11n +spinous process of vertebra SpPr +sternomastoid motoneurons of lamina 9 SM9 +supraspinatus and infraspinatus motoneurons of lamina 9 SI9 +; T +tail muscle motoneurons of lamina 9 Tail9 +thoracoabdominal wall muscle motoneurons of lamina 9 ThAb9 +trapezius and sternomastoid motoneurons of lamina 9 TzSM9 +trapezius motoneurons of lamina 9 Tz9 +triceps motoneurons of lamina 9 Tr9 +; U +; V +ventral funiculus vf +ventral median fissure vmf +ventral root vr +ventral spinocerebellar tract vsc +ventral spinothalamic tract vst +ventral white commissure vwc +vertebral arch VAr +vertebral body VB +; W +; X +; Y +; Z From 7331d54f88e9792696353205feb14b5290b3e905 Mon Sep 17 00:00:00 2001 From: Troy Sincomb Date: Mon, 28 Dec 2020 10:40:24 -0800 Subject: [PATCH 02/10] - --- nifstd/nifstd_tools/parcellation/paxinos.py | 130 +++++++++++++++++--- nifstd/resources/pax-spine-2009.txt | 10 +- 2 files changed, 117 insertions(+), 23 deletions(-) diff --git a/nifstd/nifstd_tools/parcellation/paxinos.py b/nifstd/nifstd_tools/parcellation/paxinos.py index 95e9b1f1..94c7fd7b 100644 --- a/nifstd/nifstd_tools/parcellation/paxinos.py +++ b/nifstd/nifstd_tools/parcellation/paxinos.py @@ -197,8 +197,10 @@ def parseData(cls): #asdf = l.rsplit(' ', 1) #print(asdf) + l = l.strip() abbrev, rest = l.split(' ', 1) parts = rest.split(' ') + # print(parts, abbrev) #print(parts) for i, pr in enumerate(parts[::-1]): #print(i, pr) @@ -249,7 +251,7 @@ def processData(cls): out[a][0].append(s) #raise TypeError(f'Mismatched labels on {a}: {s} {out[a][0]}') - breakpoint() + # breakpoint() return sr, ar, out, achild, schild @classmethod @@ -290,9 +292,101 @@ def missing(a, b): errata = {'nodes with layers':achild} return out, errata +class PaxSrAr2(resSource): + artifact = None + + @classmethod + def parseData(cls): + a, b = cls.raw.split('List of Structures') + if not a: + los, loa = b.split('List of Abbreviations') + else: + los = b + _, loa = a.split('List of Abbreviations') + + sr = [] + for l in los.split('\n'): + if l and not l[0] == ';': + if ';' in l: + l, *comment = l.split(';') + l = l.strip() + print(l, comment) + + #asdf = l.rsplit(' ', 1) + #print(asdf) + struct, abbrev = l.rsplit(' ', 1) + sr.append((abbrev, struct)) + + ar = [] + for l in loa.split('\n'): + if l and not l[0] == ';': + if ';' in l: + l, *comment = l.split(';') + l = l.strip() + print(l, comment) + + #asdf = l.rsplit(' ', 1) + #print(asdf) + l = l.strip() + abbrev, rest = l.split(' ', 1) + parts = rest.split(' ') + # print(parts, abbrev) + #print(parts) + for i, pr in enumerate(parts[::-1]): + #print(i, pr) + z = pr[0].isdigit() + if not z or i > 0 and z and pr[-1] != ',': + break + + struct = ' '.join(parts[:-i]) + figs = tuple(tuple(int(_) for _ in p.split('-')) + if '-' in p + else (tuple(f'{nl[:-1]}{l}' + for nl, *ls in p.split(',') + for l in (nl[-1], *ls)) + if ',' in p or p[-1].isalpha() + else int(p)) + for p in (_.rstrip(',') for _ in parts[-i:])) + figs = tuple(f for f in figs if f) # zero marks abbrevs in index that are not in figures + #print(struct) + ar.append((abbrev, struct, figs)) + return sr, ar + + @classmethod + def processData(cls): + sr, ar = cls.parseData() + out = {} + achild = {} + for a, s, f in ar: + if ', layer 1' in s or s.endswith(' layer 1'): # DTT1 ends in ' layer 1' without a comma + achild[a[:-1]] = a + continue # remove the precomposed, we will deal with them systematically + if a not in out: + out[a] = ([s], f) + else: + if s not in out[a][0]: + print(f'Found new label from ar for {a}:\n{s}\n{out[a][0]}') + out[a][0].append(s) + + schild = {} + for a, s in sr: + if ', layer 1' in s or s.endswith(' layer 1'): + schild[a[:-1]] = a + continue # remove the precomposed, we will deal with them systematically + if a not in out: + out[a] = ([s], tuple()) + else: + if s not in out[a][0]: + print(f'Found new label from sr for {a}:\n{s}\n{out[a][0]}') + out[a][0].append(s) + #raise TypeError(f'Mismatched labels on {a}: {s} {out[a][0]}') + + # breakpoint() + return sr, ar, out, achild, schild class PaxSrAr_4(PaxSrAr): sourceFile = auth.get_path('resources') / 'pax-4th-ed-indexes.txt' + # sourceFile = auth.get_path('resources') / 'pax-spine-2009.txt' artifact = Artifacts.PaxRat4 @@ -457,22 +551,22 @@ class PaxMFix(LocalSource): _data = ({}, {}) -class PaxSpineSource2009(Source): - sourceFile = auth.get_path('resources') / 'pax-spine-2009.txt' - artifact = Artifacts.PaxSpine2009 +# class PaxSpineSource2009(PaxSrAr2): +# sourceFile = auth.get_path('resources') / 'pax-spine-2009.txt' +# artifact = Artifacts.PaxSpine2009 - @classmethod - def validate(cls, ???): - return records, errata +# # # @classmethod +# # # def validate(cls, ???): +# # # return records, errata -class PaxSpineSource2013(Source): - sourceFile = auth.get_path('resources') / 'pax-spine-2013.txt' - artifact = Artifacts.PaxSpine2013 +# class PaxSpineSource2013(PaxSrAr2): +# sourceFile = auth.get_path('resources') / 'pax-spine-2013.txt' +# artifact = Artifacts.PaxSpine2013 - @classmethod - def validate(cls, ???): - return records, errata + # @classmethod + # def validate(cls, ???): + # return records, errata class PaxLabels(LabelsBase): @@ -658,7 +752,7 @@ def do_abbrev_prov(abbrev, primary_struct, source=None, artiri=None, overwrite=F for se in self.sources: source, errata = se - breakpoint() + # breakpoint() for t in se.isVersionOf: self.addTrip(*t) for a, (ss, f, *_) in source.items(): # *_ eat the tree for now @@ -935,14 +1029,14 @@ def curate(self): abrv_match_not_name = {k:v[0] for k, v in PaxRatLabels().records()[0].items() if len(v[0]) > 1} _ = [print(k, *v[0]) for k, v in PaxRatLabels().records()[0].items() if len(v[0]) > 1] - breakpoint() + # breakpoint() #self.in_tree_not_in_six = in_tree_not_in_six # need for skipping things that were not actually named by paxinos -class PaxSpinalLabels(PaxLabels): - sources = PaxSpineSource2009, PaxSpineSource2013 - # TODO +# class PaxSpinalLabels(PaxLabels): +# sources = PaxSpineSource2009, PaxSpineSource2013 +# # # TODO class PaxRecord: diff --git a/nifstd/resources/pax-spine-2009.txt b/nifstd/resources/pax-spine-2009.txt index 8aca6fb1..7b06f4ca 100644 --- a/nifstd/resources/pax-spine-2009.txt +++ b/nifstd/resources/pax-spine-2009.txt @@ -62,7 +62,7 @@ lamina 6 of the spinal gray, medial part 6SpM lamina 7 of the spinal gray 7Sp lamina 8 of the spinal gray 8Sp lamina 9 of the spinal gray 9Sp -lamina5 of the spinal gray, medial part 5SpM +lamina 5 of the spinal gray, medial part 5SpM lateral cervical nucleus LatC lateral funiculus lf lateral spinal nucleus LSp @@ -128,7 +128,7 @@ List of Abbreviations 4Sp lamina 4 of the spinal gray 5Sp lamina 5 of the spinal gray 5SpL lamina 5 of the spinal gray, lateral part -5SpM lamina5 of the spinal gray, medial part +5SpM lamina 5 of the spinal gray, medial part 6Sp lamina 6 of the spinal gray 6SpL lamina 6 of the spinal gray, lateral part 6SpM lamina 6 of the spinal gray, medial part @@ -150,12 +150,12 @@ CoVert coccygeal vertebra Cr9 cremaster motoneurons of lamina 9 cu cuneate fasciculus ; D -D dorsal nucleus (Clarke) +D dorsal nucleus DRG dorsal root ganglion De9 deltoid motoneurons of lamina 9 dcs dorsal corticospinal tract df dorsal funiculus -dl dorsolateral fasciculus (Lissauer) +dl dorsolateral fasciculus dr dorsal root ; E ExA9 external anal sphincter motoneurons of lamina 9 @@ -165,7 +165,7 @@ FEx9 forearm extensor motoneurons of lamina 9 FFl9 forearm flexor motoneurons of lamina 9 ; G Gl9 gluteal motoneurons of lamina 9 -gr Gl9 gracile fasciculus +gr gracile fasciculus ; H Hm9 hamstring motoneurons of lamina 9 ; I From be7b19b3f77f395b42f5e19318f8b2326f6cc822 Mon Sep 17 00:00:00 2001 From: Troy Sincomb Date: Thu, 7 Jan 2021 10:04:20 -0800 Subject: [PATCH 03/10] still need to figure out why im getting a duplicate labels error --- nifstd/nifstd_tools/parcellation/__init__.py | 2 + nifstd/nifstd_tools/parcellation/paxinos.py | 105 +++++++++++++------ 2 files changed, 75 insertions(+), 32 deletions(-) diff --git a/nifstd/nifstd_tools/parcellation/__init__.py b/nifstd/nifstd_tools/parcellation/__init__.py index f9044c6d..d820acda 100644 --- a/nifstd/nifstd_tools/parcellation/__init__.py +++ b/nifstd/nifstd_tools/parcellation/__init__.py @@ -368,6 +368,8 @@ def addPair(self, *args, **kwargs): @classmethod def prov(cls): + cls.iri = URIRef('https://lol.com') + return from inspect import getsourcelines #source_lines = getSourceLine diff --git a/nifstd/nifstd_tools/parcellation/paxinos.py b/nifstd/nifstd_tools/parcellation/paxinos.py index 94c7fd7b..8811cd03 100644 --- a/nifstd/nifstd_tools/parcellation/paxinos.py +++ b/nifstd/nifstd_tools/parcellation/paxinos.py @@ -109,26 +109,26 @@ class PaxSpinalAt(Atlas): class_label = 'Paxinos Spinal Atlas' PaxSpinalAtlas = Atlas(iri=PaxSpinalAt.iri, - species=NCBITaxon['???'], + species=NCBITaxon['10116'], # todo change me devstage=UBERON['0000113'], - region=UBERON['???'], - citation='???',) + region=UBERON['0000955'], # todo change me + citation='blah, blah',) # todo change me PaxSpine2009 = PaxRatAt(iri=ilx['paxinos/uris/spinal/versions/2009'], - label='Spine 2009', - synonyms=tuple(), - abbrevs=tuple(), - shortname='PAXSPINE2009', - copyrighted='2009', - version='??',) + label='Spine 2009', + # synonyms=tuple(), + # abbrevs=tuple(), + shortname='PAXSPINE2009', + copyrighted='2009', + version='??',) # todo change me PaxSpine2013 = PaxRatAt(iri=ilx['paxinos/uris/spinal/versions/2013'], - label='Spine 2013', - synonyms=tuple(), - abbrevs=tuple(), - shortname='PAXSPINE2013', - copyrighted='2013', - version='??',) + label='Spine 2013', + # synonyms=tuple(), + # abbrevs=tuple(), + shortname='PAXSPINE2013', + copyrighted='2013', + version='??',) # todo change me class PaxSr_6(resSource): @@ -292,7 +292,7 @@ def missing(a, b): errata = {'nodes with layers':achild} return out, errata -class PaxSrAr2(resSource): +class PaxSrArSpinal(resSource): artifact = None @classmethod @@ -384,6 +384,44 @@ def processData(cls): # breakpoint() return sr, ar, out, achild, schild + @classmethod + def validate(cls, sr, ar, out, achild, schild): + def missing(a, b): + am = a - b + bm = b - a + return am, bm + sabs = set(_[0] for _ in sr) + aabs = set(_[0] for _ in ar) + ssts = set(_[1] for _ in sr) + asts = set(_[1] for _ in ar) + ar2 = set(_[:2] for _ in ar) + aam, sam = missing(aabs, sabs) + asm, ssm = missing(asts, ssts) + ar2m, sr2m = missing(ar2, set(sr)) + print('OK to skip') + print(sorted(aam)) + print('Need to be created') + print(sorted(sam)) + print() + print(sorted(asm)) + print() + print(sorted(ssm)) + print() + #print(sorted(ar2m)) + #print() + #print(sorted(sr2m)) + #print() + + assert all(s in achild for s in schild), f'somehow the kids dont match {achild} {schild}\n' + str(sorted(set(a) - set(s) | set(s) - set(a) + for a, s in ((tuple(sorted(achild.items())), + tuple(sorted(schild.items()))),))) + for k, (structs, figs) in out.items(): + for struct in structs: + assert not re.match('\d+-\d+', struct) and not re.match('\d+$', struct), f'bad struct {struct} in {k}' + + errata = {'nodes with layers':achild} + return out, errata + class PaxSrAr_4(PaxSrAr): sourceFile = auth.get_path('resources') / 'pax-4th-ed-indexes.txt' # sourceFile = auth.get_path('resources') / 'pax-spine-2009.txt' @@ -551,23 +589,14 @@ class PaxMFix(LocalSource): _data = ({}, {}) -# class PaxSpineSource2009(PaxSrAr2): -# sourceFile = auth.get_path('resources') / 'pax-spine-2009.txt' -# artifact = Artifacts.PaxSpine2009 - -# # # @classmethod -# # # def validate(cls, ???): -# # # return records, errata +class PaxSpineSource2009(PaxSrArSpinal): + sourceFile = auth.get_path('resources') / 'pax-spine-2009.txt' + artifact = Artifacts.PaxSpine2009 - -# class PaxSpineSource2013(PaxSrAr2): +# class PaxSpineSource2013(PaxSrArSpinal): # sourceFile = auth.get_path('resources') / 'pax-spine-2013.txt' # artifact = Artifacts.PaxSpine2013 - # @classmethod - # def validate(cls, ???): - # return records, errata - class PaxLabels(LabelsBase): """ Base class for processing paxinos indexes. """ @@ -1034,9 +1063,21 @@ def curate(self): #self.in_tree_not_in_six = in_tree_not_in_six # need for skipping things that were not actually named by paxinos -# class PaxSpinalLabels(PaxLabels): -# sources = PaxSpineSource2009, PaxSpineSource2013 -# # # TODO +class PaxSpinalLabels(PaxLabels): + filename = 'paxinos-spina-labels' + name = 'Paxinos & Watson Spinal Labels' + shortname = 'paxmus' + namespace = PAXMUS + prefixes = {**makePrefixes('NIFRID', 'ilxtr', 'prov', 'dcterms'), + 'PAXMUS':str(PAXMUS), + 'paxmusver':str(paxmusver), + } + sources = PaxFix, PaxSpineSource2009#, PaxSpineSource2013 + root = LabelRoot(iri=nsExact(namespace), # PAXMUS['0'], + label='Paxinos mouse parcellation label root', + shortname=shortname, + definingArtifactsS=(Artifacts.PaxMouseAt.iri,), + ) class PaxRecord: From 8a4c400a79db77c4a31e887e17f5c36003ff72e0 Mon Sep 17 00:00:00 2001 From: Troy Sincomb Date: Thu, 7 Jan 2021 12:07:59 -0800 Subject: [PATCH 04/10] resulting file looks empty --- nifstd/nifstd_tools/parcellation/paxinos.py | 26 +-- nifstd/resources/pax-spine-2009.txt | 108 +++++------ nifstd/resources/pax-spine-2013.txt | 196 ++++++++++---------- 3 files changed, 165 insertions(+), 165 deletions(-) diff --git a/nifstd/nifstd_tools/parcellation/paxinos.py b/nifstd/nifstd_tools/parcellation/paxinos.py index 8811cd03..e0a0c384 100644 --- a/nifstd/nifstd_tools/parcellation/paxinos.py +++ b/nifstd/nifstd_tools/parcellation/paxinos.py @@ -116,16 +116,16 @@ class PaxSpinalAt(Atlas): PaxSpine2009 = PaxRatAt(iri=ilx['paxinos/uris/spinal/versions/2009'], label='Spine 2009', - # synonyms=tuple(), - # abbrevs=tuple(), + synonyms=tuple(), + abbrevs=tuple(), shortname='PAXSPINE2009', copyrighted='2009', version='??',) # todo change me PaxSpine2013 = PaxRatAt(iri=ilx['paxinos/uris/spinal/versions/2013'], label='Spine 2013', - # synonyms=tuple(), - # abbrevs=tuple(), + synonyms=tuple(), + abbrevs=tuple(), shortname='PAXSPINE2013', copyrighted='2013', version='??',) # todo change me @@ -593,9 +593,9 @@ class PaxSpineSource2009(PaxSrArSpinal): sourceFile = auth.get_path('resources') / 'pax-spine-2009.txt' artifact = Artifacts.PaxSpine2009 -# class PaxSpineSource2013(PaxSrArSpinal): -# sourceFile = auth.get_path('resources') / 'pax-spine-2013.txt' -# artifact = Artifacts.PaxSpine2013 +class PaxSpineSource2013(PaxSrArSpinal): + sourceFile = auth.get_path('resources') / 'pax-spine-2013.txt' + artifact = Artifacts.PaxSpine2013 class PaxLabels(LabelsBase): @@ -1072,12 +1072,12 @@ class PaxSpinalLabels(PaxLabels): 'PAXMUS':str(PAXMUS), 'paxmusver':str(paxmusver), } - sources = PaxFix, PaxSpineSource2009#, PaxSpineSource2013 - root = LabelRoot(iri=nsExact(namespace), # PAXMUS['0'], - label='Paxinos mouse parcellation label root', - shortname=shortname, - definingArtifactsS=(Artifacts.PaxMouseAt.iri,), - ) + sources = PaxSpineSource2009, PaxSpineSource2013 + # root = LabelRoot(iri=nsExact(namespace), # PAXMUS['0'], + # label='Paxinos spinal parcellation label root', + # shortname=shortname, + # definingArtifactsS=(Artifacts.PaxSpinalAt.iri,), + # ) class PaxRecord: diff --git a/nifstd/resources/pax-spine-2009.txt b/nifstd/resources/pax-spine-2009.txt index 7b06f4ca..cd977929 100644 --- a/nifstd/resources/pax-spine-2009.txt +++ b/nifstd/resources/pax-spine-2009.txt @@ -3,112 +3,112 @@ List of Structures ; A accessory nerve nucleus 11N adductor motoneurons of lamina 9 Ad9 -anterior spinal artery asp -axial muscle motoneurons of lamina 9 Ax9 +anterior spinal artery asp +axial muscle motoneurons of lamina 9 Ax9 ; B -biceps motoneurons of lamina 9 Bi9 +biceps motoneurons of lamina 9 Bi9 ; C -cauda equina CE +cauda equina CE central canal CC central cervical nucleus CeCv coccygeal vertebra CoVert cremaster motoneurons of lamina 9 Cr9 crural extensor motoneurons of lamina 9 CEx9 crural flexor motoneurons of lamina 9 CFl9 -cuneate fasciculus cu +cuneate fasciculus cu ; D deltoid motoneurons of lamina 9 De9 -dorsal corticospinal tract dcs +dorsal corticospinal tract dcs dorsal funiculus df -dorsal nucleus (Clarke) D -dorsal root dr +dorsal nucleus (Clarke) D +dorsal root dr dorsal root ganglion DRG dorsolateral fasciculus (Lissauer) dl ; E -external anal sphincter motoneurons of lamina 9 ExA9 +external anal sphincter motoneurons of lamina 9 ExA9 external urethral sphincter motoneurons of lamina 9 ExU9 ; F -forearm extensor motoneurons of lamina 9 FEx9 -forearm flexor motoneurons of lamina 9 FFl9 +forearm extensor motoneurons of lamina 9 FEx9 +forearm flexor motoneurons of lamina 9 FFl9 ; G -Gl9 gracile fasciculus gr -gluteal motoneurons of lamina 9 Gl9 +Gl9 gracile fasciculus gr +gluteal motoneurons of lamina 9 Gl9 ; H -hamstring motoneurons of lamina 9 Hm9 +hamstring motoneurons of lamina 9 Hm9 ; I -iliopsoas motoneurons of lamina 9 IPs9 -infrahyoid muscle motoneurons of lamina 9 IH9 +iliopsoas motoneurons of lamina 9 IPs9 +infrahyoid muscle motoneurons of lamina 9 IH9 intercalated nucleus ICl intercalated nucleus, paraependymal part IClPe intercostal muscle motoneurons of lamina 9 ICo9 intermediolateral column IML -intermediomedial column IMM +intermediomedial column IMM internal basilar nucleus IB ; J ; K ; L lamina 1 of the spinal gray 1Sp -lamina 10 of the spinal gray 10Sp +lamina 10 of the spinal gray 10Sp lamina 2 of the spinal gray 2Sp -lamina 2 of the spinal gray, inner part 2SpI +lamina 2 of the spinal gray, inner part 2SpI lamina 2 of the spinal gray, outer part 2SpO lamina 3 of the spinal gray 3Sp lamina 4 of the spinal gray 4Sp lamina 5 of the spinal gray 5Sp -lamina 5 of the spinal gray, lateral part 5SpL +lamina 5 of the spinal gray, lateral part 5SpL lamina 6 of the spinal gray 6Sp -lamina 6 of the spinal gray, lateral part 6SpL -lamina 6 of the spinal gray, medial part 6SpM +lamina 6 of the spinal gray, lateral part 6SpL +lamina 6 of the spinal gray, medial part 6SpM lamina 7 of the spinal gray 7Sp lamina 8 of the spinal gray 8Sp lamina 9 of the spinal gray 9Sp -lamina 5 of the spinal gray, medial part 5SpM -lateral cervical nucleus LatC -lateral funiculus lf -lateral spinal nucleus LSp -latissimus dorsi motoneurons of lamina 9 LD9 -levator scapulae motoneurons of lamina 9 LS9 -lumbar dorsal commissural nucleus LDCom -lumbar precerebellar nucleus LPrCb +lamina 5 of the spinal gray, medial part 5SpM +lateral cervical nucleus LatC +lateral funiculus lf +lateral spinal nucleus LSp +latissimus dorsi motoneurons of lamina 9 LD9 +levator scapulae motoneurons of lamina 9 LS9 +lumbar dorsal commissural nucleus LDCom +lumbar precerebellar nucleus LPrCb ; M -manus motoneurons of lamina 9 Man9 +manus motoneurons of lamina 9 Man9 ; N ; O ; P pectoral muscle motoneurons of lamina 9 Pec9 -pes motoneurons of lamina 9 Pes9 -phrenic motoneurons of lamina 9 Ph9 -postsynaptic dorsal column pathway psdc -psoas motoneurons of lamina 9 Ps9 +pes motoneurons of lamina 9 Pes9 +phrenic motoneurons of lamina 9 Ph9 +postsynaptic dorsal column pathway psdc +psoas motoneurons of lamina 9 Ps9 ; Q -quadratus lumborum motoneurons of lamina 9 QL9 -quadriceps motoneurons of lamina 9 Q9 +quadratus lumborum motoneurons of lamina 9 QL9 +quadriceps motoneurons of lamina 9 Q9 ; R -rhomboid muscle motoneurons of lamina 9 Rh9 -rubrospinal tract rs +rhomboid muscle motoneurons of lamina 9 Rh9 +rubrospinal tract rs ; S -sacral dorsal commissural nucleus SDCom +sacral dorsal commissural nucleus SDCom sacral parasympathetic nucleus SPSy -sacral precerebellar nucleus SPrCb +sacral precerebellar nucleus SPrCb scalene muscle motoneurons of lamina 9 Sc9 -serratus anterior motoneurons in lamina 9 Sr9 -spinal accessory nerve 11n -spinous process of vertebra SpPr -sternomastoid motoneurons of lamina 9 SM9 -supraspinatus and infraspinatus motoneurons of lamina 9 SI9 +serratus anterior motoneurons in lamina 9 Sr9 +spinal accessory nerve 11n +spinous process of vertebra SpPr +sternomastoid motoneurons of lamina 9 SM9 +supraspinatus and infraspinatus motoneurons of lamina 9 SI9 ; T tail muscle motoneurons of lamina 9 Tail9 -thoracoabdominal wall muscle motoneurons of lamina 9 ThAb9 -trapezius and sternomastoid motoneurons of lamina 9 TzSM9 -trapezius motoneurons of lamina 9 Tz9 -triceps motoneurons of lamina 9 Tr9 +thoracoabdominal wall muscle motoneurons of lamina 9 ThAb9 +trapezius and sternomastoid motoneurons of lamina 9 TzSM9 +trapezius motoneurons of lamina 9 Tz9 +triceps motoneurons of lamina 9 Tr9 ; U ; V ventral funiculus vf -ventral median fissure vmf -ventral root vr -ventral white commissure vwc -vertebral arch VAr +ventral median fissure vmf +ventral root vr +ventral white commissure vwc +vertebral arch VAr vertebral body VB ; W ; X diff --git a/nifstd/resources/pax-spine-2013.txt b/nifstd/resources/pax-spine-2013.txt index 6143055d..44ca2297 100644 --- a/nifstd/resources/pax-spine-2013.txt +++ b/nifstd/resources/pax-spine-2013.txt @@ -130,126 +130,126 @@ vertebral body VB List of Abbreviations ; # ; A -adductor motoneurons of lamina 9 Ad9 -anterior corticospinal tract acs -anterior spinal artery asp -area 10 of the spinal gray 10Sp -axial muscle motoneurons of lamina 9 Ax9 +Ad9 adductor motoneurons of lamina 9 +acs anterior corticospinal tract +asp anterior spinal artery +10Sp area 10 of the spinal gray +Ax9 axial muscle motoneurons of lamina 9 ; B -biceps motoneurons of lamina 9 Bi9 +Bi9 biceps motoneurons of lamina 9 ; C -cauda equina CE -caudal reticulospinal tract crsp -central canal CC -central cervical nucleus CeCv -coccygeal vertebra CoVert -cremaster motoneurons of lamina 9 Cr9 -crural extensor motoneurons of lamina 9 CEx9 -crural flexor motoneurons of lamina 9 CF19 -cuneate fasciculus cu +CE cauda equina +crsp caudal reticulospinal tract +CC central canal +CeCv central cervical nucleus +CoVert coccygeal vertebra +Cr9 cremaster motoneurons of lamina 9 +CEx9 crural extensor motoneurons of lamina 9 +CF19 crural flexor motoneurons of lamina 9 +cu cuneate fasciculus ; D -deltoid motoneurons of lamina 9 De9 -dorsal corticospinal tract dcs -dorsal funiculus df -dorsal nucleus (clarke) D -dorsal root dr -dorsal root ganglion DRG +De9 deltoid motoneurons of lamina 9 +dcs dorsal corticospinal tract +df dorsal funiculus +D dorsal nucleus +dr dorsal root +DRG dorsal root ganglion dorsal spinocerebellar tract dsc -dorsolateral fasciculus (lissauer) dl -dorsolateral spinothalamic tract dlst +dl dorsolateral fasciculus +dlst dorsolateral spinothalamic tract ; E -external anal sphincter motoneurons of lamina 9 ExA9 -external urethral sphincter motoneurons of lamina 9 ExU9 +ExA9 external anal sphincter motoneurons of lamina 9 +ExU9 external urethral sphincter motoneurons of lamina 9 ; F -forearm extensor motoneurons of lamina 9 FEx9 -forearm flexor motoneurons of lamina 9 FFl9 +FEx9 forearm extensor motoneurons of lamina 9 +FFl9 forearm flexor motoneurons of lamina 9 ; G -gluteal motoneurons of lamina 9 Gl9 -gracile fasciculus gr +Gl9 gluteal motoneurons of lamina 9 +gr gracile fasciculus ; H -hamstring motoneurons of lamina 9 Hm9 +Hm9 hamstring motoneurons of lamina 9 ; I -iliopsoas motoneurons of lamina 9 IPs9 -infrahyoid muscle motoneurons of lamina 9 IH9 -intercalated nucleus ICl -intercalated nucleus, paraependymal part ICIPe -intercostal muscle motoneurons of lamina 9 ICo9 -intermediolateral column IML -intermediolateral column, funicular part IMFL -intermediomedial column IMM -internal basilar nucleus IB +IPs9 iliopsoas motoneurons of lamina 9 +IH9 infrahyoid muscle motoneurons of lamina 9 +ICl intercalated nucleus +ICIPe intercalated nucleus, paraependymal part +ICo9 intercostal muscle motoneurons of lamina 9 +IML intermediolateral column +IMFL intermediolateral column, funicular part +IMM intermediomedial column +IB internal basilar nucleus ; J ; K ; L -lamina 1 of the spinal gray 1Sp -lamina 2 of the spinal gray 2Sp -lamina 2 of the spinal gray, inner part 2SpI -lamina 2 of the spinal gray, outer part 2SpO -lamina 3 of the spinal gray 3Sp -lamina 4 of the spinal gray 4Sp -lamina 5 of the spinal gray 5Sp -lamina 5 of the spinal gray, lateral part 5SpL -lamina 5 of the spinal gray, medial part 5SpM -lamina 6 of the spinal gray 6Sp -lamina 6 of the spinal gray, lateral part 6SpL -lamina 6 of the spinal gray, medial part 6SpM -lamina 7 of the spinal gray 7Sp -lamina 8 of the spinal gray 8Sp -lamina 9 of the spinal gray 9Sp -lateral cervical nucleus LatC -lateral corticospinal tract lcs -lateral funiculus lf -lateral spinal nucleus LSp -lateral spinothalamic tract lst -lateral vestibulospinal tract lvs -latissimus dorsi motoneurons of lamina 9 LD9 -levator scapulae motoneurons of lamina 9 LS9 -lumbar dorsal commissural nucleus LDCom -lumbar precerebellar nucleus LPrCb +1Sp lamina 1 of the spinal gray +2Sp lamina 2 of the spinal gray +2SpI lamina 2 of the spinal gray, inner part +2SpO lamina 2 of the spinal gray, outer part +3Sp lamina 3 of the spinal gray +4Sp lamina 4 of the spinal gray +5Sp lamina 5 of the spinal gray +5SpL lamina 5 of the spinal gray, lateral part +5SpM lamina 5 of the spinal gray, medial part +6Sp lamina 6 of the spinal gray +6SpL lamina 6 of the spinal gray, lateral part +6SpM lamina 6 of the spinal gray, medial part +7Sp lamina 7 of the spinal gray +8Sp lamina 8 of the spinal gray +9Sp lamina 9 of the spinal gray +LatC lateral cervical nucleus +lcs lateral corticospinal tract +lf lateral funiculus +LSp lateral spinal nucleus +lst lateral spinothalamic tract +lvs lateral vestibulospinal tract +LD9 latissimus dorsi motoneurons of lamina 9 +LS9 levator scapulae motoneurons of lamina 9 +LDCom lumbar dorsal commissural nucleus +LPrCb lumbar precerebellar nucleus ; M -manus motoneurons of lamina 9 Man9 -medial vestibulospinal tract mvs +Man9 manus motoneurons of lamina 9 +mvs medial vestibulospinal tract ; N ; O ; P -pectoral muscle motoneurons of lamina 9 Pec9 -pes motoneurons of lamina 9 Pes9 -phrenic motoneurons of lamina 9 Ph9 -postsynaptic dorsal column pathway psdc -psoas muscle motoneurons of lamina 9 Ps9 +Pec9 pectoral muscle motoneurons of lamina 9 +Pes9 pes motoneurons of lamina 9 +Ph9 phrenic motoneurons of lamina 9 +psdc postsynaptic dorsal column pathway +psdc psoas muscle motoneurons of lamina 9 ; Q -quadratus lumborum motoneurons of lamina 9 QL9 -quadriceps motoneurons of lamina 9 Q9 +QL9 quadratus lumborum motoneurons of lamina 9 +Q9 quadriceps motoneurons of lamina 9 ; R -rhomboid muscle motoneurons of lamina 9 Rh9 -rostral reticulospinal tract rrsp -rubrospinal tract rs +Rh9 rhomboid muscle motoneurons of lamina 9 +rrsp rostral reticulospinal tract +rs rubrospinal tract ; S -sacral dorsal commissural nucleus SDCom -sacral parasympathetic nucleus SPSy -sacral precerebellar nucleus SPrCb -scalene muscle motoneurons of lamina 9 Sc9 -serratus anterior motoneurons in lamina 9 Sr9 -spinal accessory nerve 11n -spinous process of vertebra SpPr -sternomastoid motoneurons of lamina 9 SM9 -supraspinatus and infraspinatus motoneurons of lamina 9 SI9 +SDCom sacral dorsal commissural nucleus +SPSy sacral parasympathetic nucleus +SPrCb sacral precerebellar nucleus +Sc9 scalene muscle motoneurons of lamina 9 +Sr9 serratus anterior motoneurons in lamina 9 +11n spinal accessory nerve +SpPr spinous process of vertebra +SM9 sternomastoid motoneurons of lamina 9 +SI9 supraspinatus and infraspinatus motoneurons of lamina 9 ; T -tail muscle motoneurons of lamina 9 Tail9 -thoracoabdominal wall muscle motoneurons of lamina 9 ThAb9 -trapezius and sternomastoid motoneurons of lamina 9 TzSM9 -trapezius motoneurons of lamina 9 Tz9 -triceps motoneurons of lamina 9 Tr9 +Tail9 tail muscle motoneurons of lamina 9 +ThAb9 thoracoabdominal wall muscle motoneurons of lamina 9 +TzSM9 trapezius and sternomastoid motoneurons of lamina 9 +Tz9 trapezius motoneurons of lamina 9 +Tr9 triceps motoneurons of lamina 9 ; U ; V -ventral funiculus vf -ventral median fissure vmf -ventral root vr -ventral spinocerebellar tract vsc -ventral spinothalamic tract vst -ventral white commissure vwc -vertebral arch VAr -vertebral body VB +vf ventral funiculus +vmf ventral median fissure +vr ventral root +vsc ventral spinocerebellar tract +vst ventral spinothalamic tract +vwc ventral white commissure +VAr vertebral arch +VB vertebral body ; W ; X ; Y From 54ea4c394fc67e5767757b9748213cd21bfee05f Mon Sep 17 00:00:00 2001 From: Troy Sincomb Date: Thu, 7 Jan 2021 13:59:08 -0800 Subject: [PATCH 05/10] added PAXSPN prefix for paxinos spinal --- nifstd/scigraph/curie_map.yaml | 1 + pyontutils/namespaces.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/nifstd/scigraph/curie_map.yaml b/nifstd/scigraph/curie_map.yaml index 6417e5e2..d6a083e1 100644 --- a/nifstd/scigraph/curie_map.yaml +++ b/nifstd/scigraph/curie_map.yaml @@ -52,6 +52,7 @@ DICOM: http://uri.interlex.org/dicom/uris/terms/ PAR: http://uri.interlex.org/fakeobo/uris/obo/PAR_ PAXRAT: http://uri.interlex.org/paxinos/uris/rat/labels/ PAXMUS: http://uri.interlex.org/paxinos/uris/mouse/labels/ +PAXSPN: http://uri.interlex.org/paxinos/uris/spine/labels/ NDA.CDE: http://uri.interlex.org/NDA/uris/datadictionary/elements/ ilxtr: http://uri.interlex.org/tgbugs/uris/readable/ ilxti: http://uri.interlex.org/tgbugs/uris/indexes/ diff --git a/pyontutils/namespaces.py b/pyontutils/namespaces.py index 8ff3e791..5b6f03c8 100644 --- a/pyontutils/namespaces.py +++ b/pyontutils/namespaces.py @@ -236,10 +236,10 @@ def makeURIs(*prefixes): # namespaces (HBA, MBA, NCBITaxon, NIFSTD, NIFRID, NIFTTL, UBERON, BFO, SO, ilxtr, - TEMP, TEMPRAW, ILX, PAXRAT, PAXMUS, tech, CL, ilxti, ilxtib, ilxtio, + TEMP, TEMPRAW, ILX, PAXRAT, PAXMUS, PAXSPN, tech, CL, ilxti, ilxtib, ilxtio, ) = makeNamespaces('HBA', 'MBA', 'NCBITaxon', 'NIFSTD', 'NIFRID', 'NIFTTL', 'UBERON', 'BFO', 'SO', 'ilxtr', - 'TEMP', 'TEMPRAW', 'ILX', 'PAXRAT', 'PAXMUS', + 'TEMP', 'TEMPRAW', 'ILX', 'PAXRAT', 'PAXMUS', 'PAXSPN', 'tech', 'CL', 'ilxti', 'ilxtib', 'ilxtio', ) From 4cb2b99c57a3d3ff0851e7f70b567c827465d7e8 Mon Sep 17 00:00:00 2001 From: Troy Sincomb Date: Thu, 7 Jan 2021 14:01:38 -0800 Subject: [PATCH 06/10] modified text references to fix abbrev errors --- nifstd/resources/pax-spine-2009.txt | 4 ++-- nifstd/resources/pax-spine-2013.txt | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/nifstd/resources/pax-spine-2009.txt b/nifstd/resources/pax-spine-2009.txt index cd977929..4779b84f 100644 --- a/nifstd/resources/pax-spine-2009.txt +++ b/nifstd/resources/pax-spine-2009.txt @@ -20,10 +20,10 @@ cuneate fasciculus cu deltoid motoneurons of lamina 9 De9 dorsal corticospinal tract dcs dorsal funiculus df -dorsal nucleus (Clarke) D +dorsal nucleus (clarke) D dorsal root dr dorsal root ganglion DRG -dorsolateral fasciculus (Lissauer) dl +dorsolateral fasciculus (lissauer) dl ; E external anal sphincter motoneurons of lamina 9 ExA9 external urethral sphincter motoneurons of lamina 9 ExU9 diff --git a/nifstd/resources/pax-spine-2013.txt b/nifstd/resources/pax-spine-2013.txt index 44ca2297..3ac693c8 100644 --- a/nifstd/resources/pax-spine-2013.txt +++ b/nifstd/resources/pax-spine-2013.txt @@ -16,7 +16,7 @@ central cervical nucleus CeCv coccygeal vertebra CoVert cremaster motoneurons of lamina 9 Cr9 crural extensor motoneurons of lamina 9 CEx9 -crural flexor motoneurons of lamina 9 CF19 +crural flexor motoneurons of lamina 9 CFl9 cuneate fasciculus cu ; D deltoid motoneurons of lamina 9 De9 @@ -44,7 +44,7 @@ hamstring motoneurons of lamina 9 Hm9 iliopsoas motoneurons of lamina 9 IPs9 infrahyoid muscle motoneurons of lamina 9 IH9 intercalated nucleus ICl -intercalated nucleus, paraependymal part ICIPe +intercalated nucleus, paraependymal part IClPe intercostal muscle motoneurons of lamina 9 ICo9 intermediolateral column IML intermediolateral column, funicular part IMFL @@ -64,7 +64,7 @@ lamina 5 of the spinal gray, lateral part 5SpL lamina 5 of the spinal gray, medial part 5SpM lamina 6 of the spinal gray 6Sp lamina 6 of the spinal gray, lateral part 6SpL -lamina 6 of the spinal gray, medial part 6SpM +lamina 6 of the spinal gray, medial part 6SpM lamina 7 of the spinal gray 7Sp lamina 8 of the spinal gray 8Sp lamina 9 of the spinal gray 9Sp @@ -75,11 +75,11 @@ lateral spinal nucleus LSp lateral spinothalamic tract lst lateral vestibulospinal tract lvs latissimus dorsi motoneurons of lamina 9 LD9 -levator scapulae motoneurons of lamina 9 LS9 -lumbar dorsal commissural nucleus LDCom +levator scapulae motoneurons of lamina 9 LS9 +lumbar dorsal commissural nucleus LDCom lumbar precerebellar nucleus LPrCb ; M -manus motoneurons of lamina 9 Man9 +manus motoneurons of lamina 9 Man9 medial vestibulospinal tract mvs ; N ; O @@ -145,7 +145,7 @@ CeCv central cervical nucleus CoVert coccygeal vertebra Cr9 cremaster motoneurons of lamina 9 CEx9 crural extensor motoneurons of lamina 9 -CF19 crural flexor motoneurons of lamina 9 +CFl9 crural flexor motoneurons of lamina 9 cu cuneate fasciculus ; D De9 deltoid motoneurons of lamina 9 @@ -172,7 +172,7 @@ Hm9 hamstring motoneurons of lamina 9 IPs9 iliopsoas motoneurons of lamina 9 IH9 infrahyoid muscle motoneurons of lamina 9 ICl intercalated nucleus -ICIPe intercalated nucleus, paraependymal part +IClPe intercalated nucleus, paraependymal part ICo9 intercostal muscle motoneurons of lamina 9 IML intermediolateral column IMFL intermediolateral column, funicular part From 5b191566244f4fbd7b95199a536324fc4816e8b6 Mon Sep 17 00:00:00 2001 From: Troy Sincomb Date: Thu, 7 Jan 2021 14:02:23 -0800 Subject: [PATCH 07/10] paxinos spine function working, will be adding versios etc --- nifstd/nifstd_tools/parcellation/paxinos.py | 62 ++++++--------------- 1 file changed, 18 insertions(+), 44 deletions(-) diff --git a/nifstd/nifstd_tools/parcellation/paxinos.py b/nifstd/nifstd_tools/parcellation/paxinos.py index e0a0c384..491aab7e 100644 --- a/nifstd/nifstd_tools/parcellation/paxinos.py +++ b/nifstd/nifstd_tools/parcellation/paxinos.py @@ -7,7 +7,7 @@ from pyontutils.namespaces import nsExact from pyontutils.namespaces import NIFRID, ilx, ilxtr, TEMP from pyontutils.namespaces import NCBITaxon, UBERON -from pyontutils.namespaces import PAXMUS, PAXRAT, paxmusver, paxratver +from pyontutils.namespaces import PAXSPN, PAXMUS, PAXRAT, paxmusver, paxratver from pyontutils.namespaces import rdf, rdfs, owl from pyontutils.combinators import annotations from nifstd_tools.parcellation import log @@ -105,7 +105,7 @@ class PaxRatAt(Atlas): version='7th Edition',) class PaxSpinalAt(Atlas): - iri = ilx['paxinos/uris/spina'] # ilxtr.paxinosMouseAtlas + iri = ilx['paxinos/uris/spinal'] # ilxtr.paxinosMouseAtlas class_label = 'Paxinos Spinal Atlas' PaxSpinalAtlas = Atlas(iri=PaxSpinalAt.iri, @@ -118,7 +118,7 @@ class PaxSpinalAt(Atlas): label='Spine 2009', synonyms=tuple(), abbrevs=tuple(), - shortname='PAXSPINE2009', + shortname='PAXSPN2009', copyrighted='2009', version='??',) # todo change me @@ -126,7 +126,7 @@ class PaxSpinalAt(Atlas): label='Spine 2013', synonyms=tuple(), abbrevs=tuple(), - shortname='PAXSPINE2013', + shortname='PAXSPN2013', copyrighted='2013', version='??',) # todo change me @@ -218,7 +218,6 @@ def parseData(cls): else int(p)) for p in (_.rstrip(',') for _ in parts[-i:])) figs = tuple(f for f in figs if f) # zero marks abbrevs in index that are not in figures - #print(struct) ar.append((abbrev, struct, figs)) return sr, ar @@ -251,7 +250,6 @@ def processData(cls): out[a][0].append(s) #raise TypeError(f'Mismatched labels on {a}: {s} {out[a][0]}') - # breakpoint() return sr, ar, out, achild, schild @classmethod @@ -311,9 +309,6 @@ def parseData(cls): l, *comment = l.split(';') l = l.strip() print(l, comment) - - #asdf = l.rsplit(' ', 1) - #print(asdf) struct, abbrev = l.rsplit(' ', 1) sr.append((abbrev, struct)) @@ -324,31 +319,12 @@ def parseData(cls): l, *comment = l.split(';') l = l.strip() print(l, comment) - - #asdf = l.rsplit(' ', 1) - #print(asdf) l = l.strip() abbrev, rest = l.split(' ', 1) parts = rest.split(' ') - # print(parts, abbrev) - #print(parts) - for i, pr in enumerate(parts[::-1]): - #print(i, pr) - z = pr[0].isdigit() - if not z or i > 0 and z and pr[-1] != ',': - break - - struct = ' '.join(parts[:-i]) - figs = tuple(tuple(int(_) for _ in p.split('-')) - if '-' in p - else (tuple(f'{nl[:-1]}{l}' - for nl, *ls in p.split(',') - for l in (nl[-1], *ls)) - if ',' in p or p[-1].isalpha() - else int(p)) - for p in (_.rstrip(',') for _ in parts[-i:])) - figs = tuple(f for f in figs if f) # zero marks abbrevs in index that are not in figures - #print(struct) + struct = ' '.join(parts[:]) + # some labels end with numbers so figs need to be disabled + figs = tuple() ar.append((abbrev, struct, figs)) return sr, ar @@ -381,7 +357,6 @@ def processData(cls): out[a][0].append(s) #raise TypeError(f'Mismatched labels on {a}: {s} {out[a][0]}') - # breakpoint() return sr, ar, out, achild, schild @classmethod @@ -781,7 +756,6 @@ def do_abbrev_prov(abbrev, primary_struct, source=None, artiri=None, overwrite=F for se in self.sources: source, errata = se - # breakpoint() for t in se.isVersionOf: self.addTrip(*t) for a, (ss, f, *_) in source.items(): # *_ eat the tree for now @@ -1058,26 +1032,26 @@ def curate(self): abrv_match_not_name = {k:v[0] for k, v in PaxRatLabels().records()[0].items() if len(v[0]) > 1} _ = [print(k, *v[0]) for k, v in PaxRatLabels().records()[0].items() if len(v[0]) > 1] - # breakpoint() #self.in_tree_not_in_six = in_tree_not_in_six # need for skipping things that were not actually named by paxinos class PaxSpinalLabels(PaxLabels): - filename = 'paxinos-spina-labels' + filename = 'paxinos-spinal-labels' name = 'Paxinos & Watson Spinal Labels' - shortname = 'paxmus' - namespace = PAXMUS + shortname = 'paxspn' + namespace = PAXSPN prefixes = {**makePrefixes('NIFRID', 'ilxtr', 'prov', 'dcterms'), - 'PAXMUS':str(PAXMUS), - 'paxmusver':str(paxmusver), + 'PAXSPN':str(PAXSPN), + # 'paxmusver':str(paxmusver), } sources = PaxSpineSource2009, PaxSpineSource2013 - # root = LabelRoot(iri=nsExact(namespace), # PAXMUS['0'], - # label='Paxinos spinal parcellation label root', - # shortname=shortname, - # definingArtifactsS=(Artifacts.PaxSpinalAt.iri,), - # ) + # If getting insertion errors there are errors with data most likely abbrevs + root = LabelRoot(iri=nsExact(namespace), # PAXMUS['0'], + label='Paxinos spinal parcellation label root', + shortname=shortname, + definingArtifactsS=(Artifacts.PaxSpinalAt.iri,), + ) class PaxRecord: From 992e701949caf6f2827afbd4adb3317dee5f0017 Mon Sep 17 00:00:00 2001 From: Troy Sincomb Date: Thu, 7 Jan 2021 14:53:02 -0800 Subject: [PATCH 08/10] just need to update the species id; there are multiple, but im not sure which one is the real focus --- nifstd/nifstd_tools/parcellation/paxinos.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/nifstd/nifstd_tools/parcellation/paxinos.py b/nifstd/nifstd_tools/parcellation/paxinos.py index 491aab7e..693c6bda 100644 --- a/nifstd/nifstd_tools/parcellation/paxinos.py +++ b/nifstd/nifstd_tools/parcellation/paxinos.py @@ -111,24 +111,28 @@ class PaxSpinalAt(Atlas): PaxSpinalAtlas = Atlas(iri=PaxSpinalAt.iri, species=NCBITaxon['10116'], # todo change me devstage=UBERON['0000113'], - region=UBERON['0000955'], # todo change me - citation='blah, blah',) # todo change me + region=UBERON['0000955'],) PaxSpine2009 = PaxRatAt(iri=ilx['paxinos/uris/spinal/versions/2009'], - label='Spine 2009', + label='The Spinal Cord: A Christopher and Dana Reeve Foundation Text and Atlas 2009', synonyms=tuple(), abbrevs=tuple(), shortname='PAXSPN2009', copyrighted='2009', - version='??',) # todo change me + version='1st edition', + citation=('Watson, C., Paxinos, G., & Kayalioglu, G. (2009). ' + 'The spinal cord: A Christopher and Dana Reeve foundation text and atlas. ' + 'Amsterdam: Elsevier/Academic Press.'),) PaxSpine2013 = PaxRatAt(iri=ilx['paxinos/uris/spinal/versions/2013'], - label='Spine 2013', + label='Atlas of the Spinal Cord 2013', synonyms=tuple(), abbrevs=tuple(), shortname='PAXSPN2013', copyrighted='2013', - version='??',) # todo change me + version='1st edition', + citation=('Sengul, G. (2013). Atlas of the spinal cord of the ' + 'rat, mouse, marmoset, rhesus, and human. London: Elsevier Academic Press.')) class PaxSr_6(resSource): @@ -1046,7 +1050,7 @@ class PaxSpinalLabels(PaxLabels): # 'paxmusver':str(paxmusver), } sources = PaxSpineSource2009, PaxSpineSource2013 - # If getting insertion errors there are errors with data most likely abbrevs + # If getting errors it is most likely the data. Abbrevs were a common mistake root = LabelRoot(iri=nsExact(namespace), # PAXMUS['0'], label='Paxinos spinal parcellation label root', shortname=shortname, From 56272362bda0f4b9ce491343979b9886179c2ed5 Mon Sep 17 00:00:00 2001 From: Troy Sincomb Date: Thu, 7 Jan 2021 21:44:48 -0800 Subject: [PATCH 09/10] added tuple of species --- nifstd/nifstd_tools/parcellation/paxinos.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nifstd/nifstd_tools/parcellation/paxinos.py b/nifstd/nifstd_tools/parcellation/paxinos.py index 693c6bda..bf7cbfab 100644 --- a/nifstd/nifstd_tools/parcellation/paxinos.py +++ b/nifstd/nifstd_tools/parcellation/paxinos.py @@ -109,7 +109,12 @@ class PaxSpinalAt(Atlas): class_label = 'Paxinos Spinal Atlas' PaxSpinalAtlas = Atlas(iri=PaxSpinalAt.iri, - species=NCBITaxon['10116'], # todo change me + species=(NCBITaxon['10116'], # rat + NCBITaxon['10090'], # mouse + NCBITaxon['9483'], # marmoset + NCBITaxon['1088310'], # rhesus + NCBITaxon['9606'],), # human + # species=NCBITaxon['10116'], # Could be: rat, mouse, marmoset, rhesus, or human devstage=UBERON['0000113'], region=UBERON['0000955'],) From 532fa25599a6a75d3663470138e83339a96fb8db Mon Sep 17 00:00:00 2001 From: Troy Sincomb Date: Thu, 14 Jan 2021 14:33:22 -0800 Subject: [PATCH 10/10] added mammalia as general species for spinal --- nifstd/nifstd_tools/parcellation/paxinos.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/nifstd/nifstd_tools/parcellation/paxinos.py b/nifstd/nifstd_tools/parcellation/paxinos.py index bf7cbfab..16d48fe2 100644 --- a/nifstd/nifstd_tools/parcellation/paxinos.py +++ b/nifstd/nifstd_tools/parcellation/paxinos.py @@ -109,11 +109,7 @@ class PaxSpinalAt(Atlas): class_label = 'Paxinos Spinal Atlas' PaxSpinalAtlas = Atlas(iri=PaxSpinalAt.iri, - species=(NCBITaxon['10116'], # rat - NCBITaxon['10090'], # mouse - NCBITaxon['9483'], # marmoset - NCBITaxon['1088310'], # rhesus - NCBITaxon['9606'],), # human + species=NCBITaxon['40674'], # mammalia # species=NCBITaxon['10116'], # Could be: rat, mouse, marmoset, rhesus, or human devstage=UBERON['0000113'], region=UBERON['0000955'],)