bioversions 0.5.376__py3-none-any.whl → 0.7.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- bioversions/__init__.py +7 -3
- bioversions/__main__.py +0 -2
- bioversions/charts.py +3 -7
- bioversions/cli.py +3 -5
- bioversions/py.typed +0 -0
- bioversions/resources/__init__.py +18 -7
- bioversions/resources/update.py +20 -12
- bioversions/resources/versions.json +20536 -0
- bioversions/slack_client.py +2 -5
- bioversions/sources/__init__.py +32 -17
- bioversions/sources/antibodyregistry.py +9 -6
- bioversions/sources/bigg.py +5 -7
- bioversions/sources/biogrid.py +0 -2
- bioversions/sources/cellosaurus.py +3 -5
- bioversions/sources/chebi.py +1 -3
- bioversions/sources/chembl.py +3 -4
- bioversions/sources/chemidplus.py +1 -3
- bioversions/sources/civic.py +9 -4
- bioversions/sources/complexportal.py +0 -2
- bioversions/sources/daily.py +0 -2
- bioversions/sources/depmap.py +1 -3
- bioversions/sources/dgi.py +9 -12
- bioversions/sources/disgenet.py +1 -3
- bioversions/sources/drugbank.py +2 -4
- bioversions/sources/drugcentral.py +2 -4
- bioversions/sources/ensembl.py +1 -3
- bioversions/sources/expasy.py +1 -4
- bioversions/sources/flybase.py +0 -2
- bioversions/sources/gtdb.py +35 -0
- bioversions/sources/guidetopharmacology.py +3 -5
- bioversions/sources/hgnc.py +13 -14
- bioversions/sources/homologene.py +0 -2
- bioversions/sources/icd10.py +1 -3
- bioversions/sources/icd11.py +1 -3
- bioversions/sources/icf.py +1 -3
- bioversions/sources/intact.py +0 -2
- bioversions/sources/interpro.py +1 -3
- bioversions/sources/itis.py +8 -15
- bioversions/sources/kegg.py +7 -7
- bioversions/sources/mesh.py +10 -5
- bioversions/sources/mgi.py +0 -2
- bioversions/sources/mirbase.py +13 -8
- bioversions/sources/moalmanac.py +0 -2
- bioversions/sources/msigdb.py +0 -2
- bioversions/sources/ncit.py +1 -4
- bioversions/sources/npass.py +0 -2
- bioversions/sources/obo.py +4 -6
- bioversions/sources/ols.py +6 -8
- bioversions/sources/omim.py +5 -6
- bioversions/sources/oncotree.py +4 -4
- bioversions/sources/pathbank.py +0 -2
- bioversions/sources/pathwaycommons.py +0 -2
- bioversions/sources/pfam.py +0 -2
- bioversions/sources/pombase.py +0 -2
- bioversions/sources/pr.py +1 -3
- bioversions/sources/pubchem.py +0 -2
- bioversions/sources/reactome.py +0 -2
- bioversions/sources/rfam.py +0 -2
- bioversions/sources/rgd.py +1 -3
- bioversions/sources/rhea.py +0 -2
- bioversions/sources/rxnorm.py +0 -2
- bioversions/sources/sgd.py +0 -2
- bioversions/sources/signor.py +36 -0
- bioversions/sources/slm.py +4 -3
- bioversions/sources/stringdb.py +2 -4
- bioversions/sources/umls.py +0 -2
- bioversions/sources/uniprot.py +1 -3
- bioversions/sources/unversioned.py +0 -2
- bioversions/sources/wikipathways.py +0 -2
- bioversions/sources/zfin.py +0 -2
- bioversions/templates/base.html +28 -0
- bioversions/templates/home.html +60 -0
- bioversions/twitter_client.py +5 -8
- bioversions/utils.py +30 -31
- bioversions/version.py +3 -5
- bioversions/wsgi.py +2 -4
- bioversions-0.7.1.dist-info/METADATA +393 -0
- bioversions-0.7.1.dist-info/RECORD +81 -0
- bioversions-0.7.1.dist-info/WHEEL +4 -0
- {bioversions-0.5.376.dist-info → bioversions-0.7.1.dist-info}/entry_points.txt +1 -0
- {bioversions-0.5.376.dist-info → bioversions-0.7.1.dist-info/licenses}/LICENSE +1 -1
- bioversions-0.5.376.dist-info/METADATA +0 -166
- bioversions-0.5.376.dist-info/RECORD +0 -77
- bioversions-0.5.376.dist-info/WHEEL +0 -5
- bioversions-0.5.376.dist-info/top_level.txt +0 -1
@@ -0,0 +1,60 @@
|
|
1
|
+
{% extends "base.html" %}
|
2
|
+
|
3
|
+
{% block title %}Bioversions{% endblock %}
|
4
|
+
|
5
|
+
{% block content %}
|
6
|
+
<div class="container" style="margin-top: 50px; margin-bottom: 50px">
|
7
|
+
<div class="row justify-content-center">
|
8
|
+
<div class="card">
|
9
|
+
<h5 class="card-header text-center">Biological Database Latest Versions</h5>
|
10
|
+
<div class="card-body">
|
11
|
+
<p>
|
12
|
+
This web application lists the latest versions for biological databases.
|
13
|
+
It refreshes once per day.
|
14
|
+
</p>
|
15
|
+
</div>
|
16
|
+
<table class="table table-striped table-hover">
|
17
|
+
<thead>
|
18
|
+
<tr>
|
19
|
+
<th>Name</th>
|
20
|
+
<th>Version</th>
|
21
|
+
<th>Date</th>
|
22
|
+
<th class="text-center">JSON</th>
|
23
|
+
</tr>
|
24
|
+
</thead>
|
25
|
+
<tbody>
|
26
|
+
{% for row in rows %}
|
27
|
+
<tr>
|
28
|
+
<td>{{ row.name }}</td>
|
29
|
+
<td>
|
30
|
+
{% if row.homepage %}
|
31
|
+
<a href="{{ row.homepage }}">{{ row.version }} <i class="fas fa-link"></i></a>
|
32
|
+
{% else %}
|
33
|
+
{{ row.version }}
|
34
|
+
{% endif %}
|
35
|
+
</td>
|
36
|
+
<td>
|
37
|
+
{% if row.date %}{{ row.date }}{% endif %}
|
38
|
+
</td>
|
39
|
+
<td class="text-center">
|
40
|
+
<a href="{{ url_for('database', name=row.name.lower().replace(" ", "")) }}">
|
41
|
+
<i class="fas fa-download"></i>
|
42
|
+
</a>
|
43
|
+
</td>
|
44
|
+
</tr>
|
45
|
+
{% endfor %}
|
46
|
+
</tbody>
|
47
|
+
</table>
|
48
|
+
<div class="card-footer">
|
49
|
+
<p style="text-align: center">
|
50
|
+
Developed with ❤️ by the <a href="https://indralab.github.io">INDRA Lab</a> in the
|
51
|
+
<a href="https://hits.harvard.edu">Harvard Program in Therapeutic Science (HiTS)</a>.<br/>
|
52
|
+
Funded by the DARPA Young Faculty Award W911NF2010255 (PI: Benjamin M. Gyori).<br/>
|
53
|
+
Point of contact: <a href="https://github.com/cthoyt">@cthoyt</a>.
|
54
|
+
(<a href="https://github.com/biopragmatics/bioversions">Source code</a>)
|
55
|
+
</p>
|
56
|
+
</div>
|
57
|
+
</div>
|
58
|
+
</div>
|
59
|
+
</div>
|
60
|
+
{% endblock %}
|
bioversions/twitter_client.py
CHANGED
@@ -1,9 +1,6 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
1
|
"""Utilities for interacting with Twitter."""
|
4
2
|
|
5
3
|
from functools import lru_cache
|
6
|
-
from typing import Optional
|
7
4
|
|
8
5
|
import pystow
|
9
6
|
import tweepy
|
@@ -11,11 +8,11 @@ import tweepy
|
|
11
8
|
|
12
9
|
@lru_cache(maxsize=1)
|
13
10
|
def _get_api(
|
14
|
-
consumer_key:
|
15
|
-
consumer_secret:
|
16
|
-
access_token:
|
17
|
-
access_token_secret:
|
18
|
-
) ->
|
11
|
+
consumer_key: str | None = None,
|
12
|
+
consumer_secret: str | None = None,
|
13
|
+
access_token: str | None = None,
|
14
|
+
access_token_secret: str | None = None,
|
15
|
+
) -> tweepy.API | None:
|
19
16
|
consumer_key = pystow.get_config("bioversions", "consumer_key", passthrough=consumer_key)
|
20
17
|
consumer_secret = pystow.get_config(
|
21
18
|
"bioversions", "consumer_secret", passthrough=consumer_secret
|
bioversions/utils.py
CHANGED
@@ -1,18 +1,16 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
1
|
"""Utilities and implementation for bioversions."""
|
4
2
|
|
5
3
|
import datetime
|
6
4
|
import enum
|
7
5
|
import ftplib
|
8
6
|
import os
|
9
|
-
from
|
7
|
+
from collections.abc import Mapping
|
8
|
+
from typing import Any, ClassVar
|
10
9
|
|
11
10
|
import bioregistry
|
12
11
|
import pydantic
|
13
12
|
import pystow
|
14
13
|
import requests
|
15
|
-
import requests_ftp
|
16
14
|
from bs4 import BeautifulSoup
|
17
15
|
from cachier import cachier
|
18
16
|
|
@@ -21,8 +19,6 @@ HERE = os.path.abspath(os.path.dirname(__file__))
|
|
21
19
|
DOCS = os.path.abspath(os.path.join(HERE, os.pardir, os.pardir, "docs"))
|
22
20
|
IMG = os.path.join(DOCS, "img")
|
23
21
|
|
24
|
-
requests_ftp.monkeypatch_session()
|
25
|
-
|
26
22
|
|
27
23
|
class VersionType(enum.Enum):
|
28
24
|
"""Different types of versions."""
|
@@ -48,7 +44,7 @@ def norm(s: str) -> str:
|
|
48
44
|
|
49
45
|
|
50
46
|
def get_soup(
|
51
|
-
url: str, verify: bool = True, timeout:
|
47
|
+
url: str, verify: bool = True, timeout: int | None = None, user_agent: str | None = None
|
52
48
|
) -> BeautifulSoup:
|
53
49
|
"""Get a beautiful soup parsed version of the given web page.
|
54
50
|
|
@@ -82,9 +78,9 @@ class MetaGetter(type):
|
|
82
78
|
|
83
79
|
_cache = None
|
84
80
|
|
85
|
-
date_fmt:
|
86
|
-
date_version_fmt:
|
87
|
-
homepage_fmt:
|
81
|
+
date_fmt: str | None
|
82
|
+
date_version_fmt: str | None
|
83
|
+
homepage_fmt: str | None
|
88
84
|
|
89
85
|
@property
|
90
86
|
def _cache_prop(cls):
|
@@ -105,7 +101,7 @@ class MetaGetter(type):
|
|
105
101
|
raise TypeError(f"_cache_prop was a {type(cls._cache_prop)}")
|
106
102
|
|
107
103
|
@property
|
108
|
-
def date(cls) ->
|
104
|
+
def date(cls) -> datetime.date | None:
|
109
105
|
"""Get the date if it's set."""
|
110
106
|
vp = cls.version_date_parsed
|
111
107
|
if vp is not None:
|
@@ -122,10 +118,12 @@ class MetaGetter(type):
|
|
122
118
|
try:
|
123
119
|
return datetime.datetime.strptime(date, cls.date_fmt).date()
|
124
120
|
except ValueError:
|
125
|
-
raise ValueError(
|
121
|
+
raise ValueError(
|
122
|
+
f"Issue in {cls.__name__} with date {date} and fmt {cls.date_fmt}"
|
123
|
+
) from None
|
126
124
|
|
127
125
|
@property
|
128
|
-
def version_date_parsed(cls) ->
|
126
|
+
def version_date_parsed(cls) -> datetime.date | None:
|
129
127
|
"""Get the date as a parsed class there's a format string."""
|
130
128
|
if cls.date_version_fmt is None:
|
131
129
|
return None
|
@@ -133,11 +131,12 @@ class MetaGetter(type):
|
|
133
131
|
return datetime.datetime.strptime(cls.version, cls.date_version_fmt).date()
|
134
132
|
except ValueError:
|
135
133
|
raise ValueError(
|
136
|
-
f"Issue parsing {cls.__name__} version {cls.version}
|
137
|
-
|
134
|
+
f"Issue parsing {cls.__name__} version {cls.version} "
|
135
|
+
f"with fmt {cls.date_version_fmt}"
|
136
|
+
) from None
|
138
137
|
|
139
138
|
@property
|
140
|
-
def homepage(cls) ->
|
139
|
+
def homepage(cls) -> str | None:
|
141
140
|
"""Get the homepage's URL if a format string was specified."""
|
142
141
|
if cls.homepage_fmt is None:
|
143
142
|
return None
|
@@ -163,11 +162,11 @@ class Bioversion(pydantic.BaseModel):
|
|
163
162
|
#: The version type
|
164
163
|
vtype: VersionType
|
165
164
|
#: The date of the current release
|
166
|
-
date:
|
165
|
+
date: datetime.date | None
|
167
166
|
#: The URL for the homepage of the specific version of the database
|
168
|
-
homepage:
|
167
|
+
homepage: str | None
|
169
168
|
#: The database prefix
|
170
|
-
bioregistry_id:
|
169
|
+
bioregistry_id: str | None
|
171
170
|
|
172
171
|
|
173
172
|
class Getter(metaclass=MetaGetter):
|
@@ -179,13 +178,13 @@ class Getter(metaclass=MetaGetter):
|
|
179
178
|
version_type: ClassVar[VersionType]
|
180
179
|
|
181
180
|
#: The URL with `{version}` to format in the version. Specify this in the inheriting class.
|
182
|
-
homepage_fmt: ClassVar[
|
181
|
+
homepage_fmt: ClassVar[str | None] = None
|
183
182
|
|
184
|
-
date_fmt: ClassVar[
|
183
|
+
date_fmt: ClassVar[str | None] = None
|
185
184
|
|
186
|
-
date_version_fmt: ClassVar[
|
185
|
+
date_version_fmt: ClassVar[str | None] = None
|
187
186
|
|
188
|
-
bioregistry_id: ClassVar[
|
187
|
+
bioregistry_id: ClassVar[str | None] = None
|
189
188
|
|
190
189
|
# The following are automatically calculated based on the metaclass
|
191
190
|
version: ClassVar[str]
|
@@ -193,21 +192,21 @@ class Getter(metaclass=MetaGetter):
|
|
193
192
|
homepage: ClassVar[str]
|
194
193
|
|
195
194
|
#: Prefixes this getter works for
|
196
|
-
collection: ClassVar[
|
195
|
+
collection: ClassVar[list[str] | None] = None
|
197
196
|
|
198
|
-
def get(self) ->
|
197
|
+
def get(self) -> str | Mapping[str, str] | datetime.datetime:
|
199
198
|
"""Get the latest of this database."""
|
200
199
|
raise NotImplementedError
|
201
200
|
|
202
201
|
@classmethod
|
203
|
-
def print(cls, sep: str = "\t", file=None):
|
202
|
+
def print(cls, sep: str = "\t", file=None):
|
204
203
|
"""Print the latest version of this database."""
|
205
204
|
x = [cls.bioregistry_id, cls.name, cls.version]
|
206
205
|
if cls.date:
|
207
206
|
x.append(f"({cls.date})")
|
208
207
|
if cls.homepage:
|
209
208
|
x.append(cls.homepage)
|
210
|
-
print(*x, sep=sep, file=file)
|
209
|
+
print(*x, sep=sep, file=file)
|
211
210
|
|
212
211
|
@classmethod
|
213
212
|
def resolve(cls) -> Bioversion:
|
@@ -225,7 +224,7 @@ class Getter(metaclass=MetaGetter):
|
|
225
224
|
@classmethod
|
226
225
|
def to_dict(cls) -> Mapping[str, Any]:
|
227
226
|
"""Get a dict with the data for this database."""
|
228
|
-
return cls.resolve().
|
227
|
+
return cls.resolve().model_dump()
|
229
228
|
|
230
229
|
|
231
230
|
class DailyGetter(Getter):
|
@@ -233,7 +232,7 @@ class DailyGetter(Getter):
|
|
233
232
|
|
234
233
|
version_type = VersionType.daily
|
235
234
|
|
236
|
-
def get(self) ->
|
235
|
+
def get(self) -> str | Mapping[str, str]:
|
237
236
|
"""Return a constant "daily" string."""
|
238
237
|
return "daily"
|
239
238
|
|
@@ -246,14 +245,14 @@ class UnversionedGetter(Getter):
|
|
246
245
|
#: Has this database been apparently abandoned (true) or is it still updated (false)
|
247
246
|
abandoned: ClassVar[bool]
|
248
247
|
|
249
|
-
def get(self) ->
|
248
|
+
def get(self) -> str | Mapping[str, str]:
|
250
249
|
"""Return a constant unversioned string."""
|
251
250
|
return "unversioned"
|
252
251
|
|
253
252
|
|
254
253
|
def get_obo_version(url: str) -> str:
|
255
254
|
"""Get the data version from an OBO file."""
|
256
|
-
with requests.get(url, stream=True) as res:
|
255
|
+
with requests.get(url, stream=True, timeout=60) as res:
|
257
256
|
for line in res.iter_lines():
|
258
257
|
line = line.decode("utf-8")
|
259
258
|
if line.startswith("data-version:"):
|
bioversions/version.py
CHANGED
@@ -1,22 +1,20 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
1
|
"""Version information for bioversions."""
|
4
2
|
|
5
3
|
import os
|
6
|
-
from subprocess import CalledProcessError, check_output
|
4
|
+
from subprocess import CalledProcessError, check_output
|
7
5
|
|
8
6
|
__all__ = [
|
9
7
|
"VERSION",
|
10
8
|
]
|
11
9
|
|
12
|
-
VERSION = "0.
|
10
|
+
VERSION = "0.7.1"
|
13
11
|
|
14
12
|
|
15
13
|
def get_git_hash() -> str:
|
16
14
|
"""Get the bioversions git hash."""
|
17
15
|
with open(os.devnull, "w") as devnull:
|
18
16
|
try:
|
19
|
-
ret = check_output(
|
17
|
+
ret = check_output(
|
20
18
|
["git", "rev-parse", "HEAD"],
|
21
19
|
cwd=os.path.dirname(__file__),
|
22
20
|
stderr=devnull,
|
bioversions/wsgi.py
CHANGED
@@ -1,8 +1,6 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
1
|
"""A web application for listing database versions."""
|
4
2
|
|
5
|
-
from typing import Any
|
3
|
+
from typing import Any
|
6
4
|
|
7
5
|
import flask
|
8
6
|
from flask_bootstrap import Bootstrap
|
@@ -22,7 +20,7 @@ def home():
|
|
22
20
|
@app.route("/database/<name>.json")
|
23
21
|
def database(name: str):
|
24
22
|
"""Resolve information about a given database."""
|
25
|
-
rv:
|
23
|
+
rv: dict[str, Any] = {"query": name}
|
26
24
|
try:
|
27
25
|
bioversion = resolve(name)
|
28
26
|
except KeyError:
|