Open nrnhines opened 1 year ago
From a naive (or bull in a china shop) perspective, I see that
nrn-modeldb-ci$ getmodels 82894
...
Exception: Model IDs {82894} were explicitly requested, but are not known NEURON models.
On the other hand it is explicitly downloadable, eg.
curl -O https://modeldb.science/download/82894
So in the worst tradition of "hacking away", and the situation being that there are only a few (1?) of this kind of model, it would seem that a reasonable work around is to modify modeldb.py download_models to fix up its list of known NEURON model accession numbers by replacing 45539 with 82894. Is a manually maintained "special-case.yaml' file worthwhile?
The following seems to take care of the problem...
hines@hines-t7500:~/neuron/nrn-modeldb-ci/modeldb$ git diff
diff --git a/modeldb/modeldb.py b/modeldb/modeldb.py
index 87eb284..6ddafcf 100644
--- a/modeldb/modeldb.py
+++ b/modeldb/modeldb.py
@@ -126,6 +126,7 @@ class ModelDB(object):
return requests.get(MDB_NEURON_MODELS_URL.format(model_field=field)).json()
all_model_ids = query("id")
+ all_model_ids[all_model_ids.index(45539)] = 82894
all_model_timestamps = query("ver_date")
metadata = {
model_id: timestamp
and getmodels() generates a modeldb-meta.yaml fragment of
82894: !!python/object:modeldb.data.Model
_created: '2004-11-18T23:28:58'
_name: A single column thalamocortical network model (Traub et al 2005)
_object_id: 45539
_ver_date: '2017-07-03T22:08:21.927'
Not looking at the discussion, but we should rather "fix" modeldb than add an exception
I think modeldb is correct under the interpretation that the id request is for conceptual models. (the notions of model entry, conceptual model, publication(s) of that model, and model implementations are distinct. Generally one expects but does not always experience a one-to-one correspondence between the above 4 notions.) From the metadata of https://modeldb.science/api/v1/models/45539 One sees that
"modeling_application": {
"value": [
{"object_id": 1882, "object_name": "NEURON"},
{"object_id": 45540, "object_name": "FORTRAN"}
],
"attr_id": 114
}
which indicates there is more than one implementation (and one is for NEURON). However the default (base?) implementation is (I think things are a bit shakey at this point and it may be best to ignore this aspect)
"default_file_notes": {
"value": "ifc fortran",
"attr_id": 392
}
which suggest to me that the zip file for 45539 is for ifc fortran. Anyway, if there is more than one implementation and NEURON is not the default, then the one to get may appear in
"alternative_version": {
"value": [
{"object_id": 82894, "object_name": "NEURON"},
{"object_id": 82895, "object_name": "g77"},
{"object_id": 93318, "object_name": "nrntraub with pattern.mod"},
{"object_id": 116860, "object_name": "NEURON 7"},
{"object_id": 127353, "object_name": "neuroConstruct"}
],
"attr_id": 314
}
and it this case we would wish to use 82894. Note that the metadata for https://modeldb.science/api/v1/models/45539 is identical to that of https://modeldb.science/api/v1/models/82894
Note that in unzipping, it may be worthwhile to create an id folder and unzip there since zip files with different id names can unzip to the same folder name. That happens for the 45539 and 82894 though is not an issue if we only get 82894. Nevertheless there is no guaranteed that unrelated NEURON models unzip into different folders. edit: it appears that the curators took care to make the unzip folder names different. I.e.82894 unzips to nrntraub and 116860 unzips to nrntraub_v7
Things are a bit more interesting than I supposed. I've been looking at the results from test.py
from config import *
import requests
def query(field):
return requests.get(MDB_NEURON_MODELS_URL.format(model_field=field)).json()
nrnids = query("id")
alts = query("alternative_version")
apps = query("modeling_application")
for i, val in enumerate(apps):
if len(val['value']) > 1:
# print (i, nrnids[i], val['value'])
# print (" ", alts[i]['value']) if alts[i] else None
if alts[i]:
for sim in alts[i]['value']:
if "NEURON" in sim['object_name']:
print(i, nrnids[i], ": replace with ", sim["object_id"],
" ", sim['object_name'])
and see
hines@hines-t7500:~/neuron/nrn-modeldb-ci/modeldb$ python3 test.py
113 45539 : replace with 82894 NEURON
113 45539 : replace with 116860 NEURON 7
178 97747 : replace with 113435 NEURON
457 184142 : replace with 184144 Standalone NEURON
458 184145 : replace with 184146 Standalone NEURON
459 184148 : replace with 184149 Standalone NEURON
460 184152 : replace with 184153 Standalone NEURON
461 184157 : replace with 184158 Standalone NEURON
462 184159 : replace with 184160 Standalone NEURON
463 184161 : replace with 266824 Standalone NEURON python3
463 184161 : replace with 184162 Standalone NEURON
464 184163 : replace with 184165 Standalone NEURON
465 184166 : replace with 184167 Standalone NEURON
466 184168 : replace with 184169 Standalone NEURON
467 184171 : replace with 184172 Standalone NEURON
468 184173 : replace with 184174 Standalone NEURON
469 184176 : replace with 184177 Standalone NEURON
470 184178 : replace with 184179 Standalone NEURON
471 184180 : replace with 184181 Standalone NEURON
472 184182 : replace with 184183 Standalone NEURON
473 184184 : replace with 184185 Standalone NEURON
474 184186 : replace with 184187 Standalone NEURON
475 184196 : replace with 184197 Standalone NEURON
476 184202 : replace with 184203 Standalone NEURON
477 184231 : replace with 184232 Standalone NEURON
478 184274 : replace with 184278 Standalone NEURON
479 184297 : replace with 184298 Standalone NEURON
480 184299 : replace with 184300 Standalone NEURON
481 184301 : replace with 184302 Standalone NEURON
482 184303 : replace with 184304 Standalone NEURON
483 184305 : replace with 184306 Standalone NEURON
485 184310 : replace with 184311 Standalone NEURON
486 184312 : replace with 184313 Standalone NEURON
487 184314 : replace with 184315 Standalone NEURON
488 184316 : replace with 184317 Standalone NEURON
489 184319 : replace with 184320 Standalone NEURON
490 184321 : replace with 184322 Standalone NEURON
491 184323 : replace with 184324 Standalone NEURON
492 184325 : replace with 184326 Standalone NEURON
493 184327 : replace with 184328 Standalone NEURON
494 184329 : replace with 184330 Standalone NEURON
495 184331 : replace with 184332 Standalone NEURON
496 184333 : replace with 184334 Standalone NEURON
497 184335 : replace with 190566 Standalone NEURON
498 184337 : replace with 184338 Standalone NEURON
499 184339 : replace with 184340 Standalone NEURON
500 184341 : replace with 184342 Standalone NEURON
501 184344 : replace with 184345 Standalone NEURON
502 184346 : replace with 184347 Standalone NEURON
503 184348 : replace with 184349 Standalone NEURON
504 184350 : replace with 184351 Standalone NEURON
Also, as mentioned elsewhere, there are many cases of multiple simulators for a single id with combined files. That is not an issue in this context. The "Standalone NEURON" cases are merely preprocessed allen institute models which do not need their processing code. They are all very similar to each other and running one is probably sufficient.
it appears that the curators took care to make the unzip folder names different.
I was mistaken about that and am unfamiliar with the zip file handling in the python code so don't know if it matters, but
20212 CA1_multi
206244 CA1_multi
266844 code
267018 code
267610 code_pub
267621 code_pub
260972 Model
267184 Model
144392 modeldb
258844 modeldb
266797 modelDB
267594 modelDB
257747 ModelDB
267146 ModelDB
267646 ModelDB
The folder names are usually whatever the model submitter chooses. No attempt is made to make them unique.
I believe that in nrn-modeldb-ci
we add an extra {modelid}/
directory to avoid duplicates from the .zip
files.
traubEtAl2005 downloads as a fortran version of the model (45539). The modeldb/modeldb-meta.yaml fragment is
We should instead get the NEURON version https://modeldb.science/download/82894 or perhaps the github version https://github.com/ModelDBRepository/82894
Perhaps this issue is related to #75