Skip to content

Commit

Permalink
apinat pops more include link to raw svg on github under dc:source
Browse files Browse the repository at this point in the history
  • Loading branch information
tgbugs committed May 31, 2023
1 parent bd9d082 commit 33a7912
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions neurondm/neurondm/models/apinat_pops_more.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ def parse_refs(refs):

neuron_classes = {
sn: type(f'Neuron{sn.capitalize()}', (Neuron,), {'owlClass': f'ilxtr:Neuron{sn.capitalize()}',
'_model_refs': mrefs[sn_id[sn]]
'_model_refs': mrefs[sn_id[sn]],
'_model_id': sn_id[sn],
})
for sn in [('kblad' if _ == 'keast' else
('bolew' if _ == 'unbranched' else _))
Expand Down Expand Up @@ -222,10 +223,16 @@ def dophen(oid, bag, refs):

def citations(ncs, neus):
p = OntId('ilxtr:literatureCitation').u
#hsa = OntId('ilxtr:hasSourceArtifact').u # XXX doesn't quite match usage because it is pseudo ontological
source = OntId('dc:source').u # more reasonable given the complexity of the process
for things, attr, idf in ((ncs, '_model_refs', lambda c: OntId(c.owlClass).u),
(neus, '_refs', lambda c: c.identifier)):
for thing in things:
s = idf(thing)

if attr == '_model_refs':
yield s, source, OntId(svg_template.format(id_model=thing._model_id)).u

for ref in getattr(thing, attr):
if isinstance(ref, dict):
ref = ref['id'] # XXX FIXME WARNING EVIL
Expand Down Expand Up @@ -256,7 +263,7 @@ def citations(ncs, neus):
ng = OntGraph().populate_from_triples((t for t in og if 'able' not in t[1] and 'abel' not in t[1]))
ng.populate_from(citations(neuron_classes.values(), neus))
ng.namespace_manager.populate_from(og)
ng.namespace_manager.populate_from(makePrefixes('PMID', 'doi'))
ng.namespace_manager.populate_from(makePrefixes('PMID', 'doi', 'dc'))
ng.write(ogp)

if False:
Expand Down

0 comments on commit 33a7912

Please sign in to comment.