Skip to content

Commit

Permalink
Generated all biomodels
Browse files Browse the repository at this point in the history
  • Loading branch information
pgleeson committed Jan 27, 2025
1 parent 7a5f7a0 commit 13bbd8f
Show file tree
Hide file tree
Showing 4 changed files with 626,873 additions and 60 deletions.
70 changes: 12 additions & 58 deletions libraries/client/biomodels_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

if __name__ == "__main__":
min_index = 0
max_index = 20
max_index = 78000
index = 0

from loadbiomodels import get_model_identifiers
Expand All @@ -29,66 +29,20 @@
% (index, len(selection), index + min_index, model_id)
)

model_link = f"[{model_id}](https://www.ebi.ac.uk/biomodels/{model_id})"
info = get_model_info(model_id)
model_name = info["name"]
print(f" {model_id}: \n {pprint.pformat(info['name'])}--")
model_url = f"https://www.ebi.ac.uk/biomodels/{model_id}"
model_link = f"[{model_id}]({model_url})"
try:
info = get_model_info(model_id)
model_name = info["name"]
print(f" {model_id}: \n {pprint.pformat(info['name'])}--")

info_all[model_id] = info
"""
son.loads(get_page('https://modeldb.science/api/v1/models/%s'%model))
info_all[model_id] = info
except Exception as e:
msg = f"Error retrieving model at {model_url}: {e}"

print(' %s'%info[model]['name'])
if 'gitrepo' in info[model] and info[model]['gitrepo']:
with_gitrepo+=1
print(' gitrepo: %s'%info[model]['gitrepo'])
else:
print(' gitrepo: %s'%False)
print(" ******* %s" % msg)

expected_forks = 0
possible_mdb_repo = 'ModelDBRepository/%s'%(info[model]['id'])
try:
mdb_repo = gh.get_repo(possible_mdb_repo)
repo_to_use = mdb_repo
print(' Exists at: %s (def branch: %s; forks: %i)'%(mdb_repo.html_url, mdb_repo.default_branch, mdb_repo.forks))
possible_osbgh_repo = 'OpenSourceBrain/%s'%(info[model]['id'])
try:
osb_repo = gh.get_repo(possible_osbgh_repo)
msg = ' Exists at: %s (def branch: %s; forks: %i), order %i'%(osb_repo.html_url, osb_repo.default_branch, osb_repo.forks, index+min_index)
on_osbv2.append(msg)
print(msg)
repo_to_use = osb_repo
expected_forks+=1
info[model]['osbv2_gh_repo'] = repo_to_use.html_url
info[model]['osbv2_gh_branch'] = repo_to_use.default_branch
except:
print(' Missing fork: %s, forking now: %s'%(possible_osbgh_repo, fork_if_missing))
if fork_if_missing:
print(' Forking to: %s...'%possible_osbgh_repo)
org = gh.get_organization('OpenSourceBrain')
org.create_fork(mdb_repo,default_branch_only=False)
msg = ' Forked to: %s...'%possible_osbgh_repo
print(msg)
forked_now.append(msg)
else:
msg = ' Yet to be forked: %i, order %i; %s'%(info[model]['id'], index+min_index,info[model]['name'])
print(msg)
to_be_forked.append(msg)
if (not mdb_repo.forks==expected_forks) and (not (info[model]['id'] in known_to_have_other_forks)):
msg = ' Unexpected forks for %i (%s != %s)...'%(info[model]['id'], mdb_repo.forks,expected_forks)
print(msg)
many_forks.append(msg)
except:
msg = ' Problem locating repo for: %i (%i/%i) %s'%(info[model]['id'],index, len(selection), info[model]['name'])
print(msg)
errors.append(msg)"""
info_all[model_id] = {"error": msg}

index += 1

Expand Down
Loading

0 comments on commit 13bbd8f

Please sign in to comment.