bioversions 0.5.330__py3-none-any.whl → 0.5.331__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.
@@ -16,6 +16,7 @@ from .cellosaurus import CellosaurusGetter
16
16
  from .chebi import ChEBIGetter
17
17
  from .chembl import ChEMBLGetter
18
18
  from .chemidplus import ChemIDplusGetter
19
+ from .civic import CiVICGetter
19
20
  from .complexportal import ComplexPortalGetter
20
21
  from .daily import NCBIGeneGetter
21
22
  from .depmap import DepMapGetter
@@ -135,6 +136,7 @@ def get_getters() -> List[Type[Getter]]:
135
136
  ICFGetter,
136
137
  ICD10Getter,
137
138
  ICD11Getter,
139
+ CiVICGetter,
138
140
  ]
139
141
  getters.extend(iter_obo_getters())
140
142
  extend_ols_getters(getters)
@@ -151,9 +153,9 @@ def get_getter_dict() -> Mapping[str, Type[Getter]]:
151
153
  rv[norm(getter.bioregistry_id)] = getter
152
154
  rv[getter.name] = getter
153
155
  rv[norm(getter.name)] = getter
154
- # TODO engineer this into the data model and backfill them
155
- rv["omim.ps"] = OMIMGetter
156
- rv["omimps"] = OMIMGetter
156
+ for pp in getter.collection or []:
157
+ rv[pp] = getter
158
+ rv[norm(pp)] = getter
157
159
  return rv
158
160
 
159
161
 
@@ -0,0 +1,41 @@
1
+ """Get the version for CiVIC."""
2
+
3
+ import requests
4
+
5
+ from bioversions.utils import Getter, VersionType
6
+
7
+ URL = "https://civicdb.org/releases/main"
8
+ API = "https://civicdb.org/api/graphql"
9
+ GRAPHQL_QUERY = """\
10
+ query dataReleases {
11
+ dataReleases {
12
+ geneTsv {
13
+ filename
14
+ path
15
+ }
16
+ name
17
+ }
18
+ }
19
+ """
20
+ # see https://griffithlab.github.io/civic-v2/#query-dataReleases
21
+ # and https://griffithlab.github.io/civic-v2/#definition-DownloadableFile
22
+
23
+
24
+ class CiVICGetter(Getter):
25
+ """A getter for CiVIC."""
26
+
27
+ name = "CiVIC"
28
+ date_fmt = "%d-%b-%Y"
29
+ version_type = VersionType.date
30
+ homepage = "https://civicdb.org"
31
+ collection = ["civic.gid", "civic.eid"]
32
+
33
+ def get(self):
34
+ """Get the latest ChEMBL version number."""
35
+ res = requests.post(API, json={"query": GRAPHQL_QUERY})
36
+ # 0 element is always nightly, 1 is latest
37
+ return res.json()["data"]["dataReleases"][1]["name"]
38
+
39
+
40
+ if __name__ == "__main__":
41
+ CiVICGetter.print()
@@ -23,6 +23,7 @@ class GuideToPharmacologyGetter(Getter):
23
23
  homepage_fmt = "https://www.guidetopharmacology.org/DATA/public_iuphardb_v{version}.zip"
24
24
  date_fmt = "%Y-%m-%d"
25
25
  version_type = VersionType.year_minor
26
+ collection = ["iuphar.family", "iuphar.ligand", "iuphar.receptor"]
26
27
 
27
28
  def get(self) -> Dict[str, str]:
28
29
  """Get the latest Guide to Pharmacology version number."""
@@ -16,10 +16,10 @@ URL = "https://www.kegg.jp/kegg/docs/relnote.html"
16
16
  class KEGGGetter(Getter):
17
17
  """A getter for KEGG."""
18
18
 
19
- bioregistry_id = "kegg.pathway"
20
19
  name = "KEGG"
21
20
  date_fmt = "%B %d, %Y"
22
21
  version_type = VersionType.semver_minor
22
+ collection = ["kegg.pathway", "kegg.gene", "kegg.species"] # TODO add more
23
23
 
24
24
  def get(self) -> Mapping[str, str]:
25
25
  """Get the latest KEGG version number."""
@@ -18,6 +18,7 @@ class MirbaseGetter(Getter):
18
18
  name = "miRBase"
19
19
  homepage_fmt = "https://www.mirbase.org/download/PREVIOUS_RELEASES/{version}"
20
20
  version_type = VersionType.semver_minor
21
+ collection = ["mirbase", "mirbase.family", "mirbase.mature"]
21
22
 
22
23
  def get(self):
23
24
  """Get the latest miRBase version number."""
@@ -13,10 +13,10 @@ __all__ = [
13
13
  class OMIMGetter(Getter):
14
14
  """A getter for OMIM."""
15
15
 
16
- bioregistry_id = "omim"
17
16
  name = "Online Mendelian Inheritance in Man"
18
17
  date_version_fmt = "%B %d, %Y"
19
18
  version_type = VersionType.date
19
+ collection = ["omim.ps", "omim"]
20
20
 
21
21
  def get(self) -> str:
22
22
  """Get the latest OMIM version number."""
bioversions/utils.py CHANGED
@@ -6,7 +6,7 @@ import datetime
6
6
  import enum
7
7
  import ftplib
8
8
  import os
9
- from typing import Any, ClassVar, Mapping, Optional, Union
9
+ from typing import Any, ClassVar, List, Mapping, Optional, Union
10
10
 
11
11
  import bioregistry
12
12
  import pydantic
@@ -47,7 +47,9 @@ def norm(s: str) -> str:
47
47
  return s.lower().replace(" ", "").replace("-", "").replace(".", "")
48
48
 
49
49
 
50
- def get_soup(url: str, verify: bool = True, timeout: Optional[int] = None) -> BeautifulSoup:
50
+ def get_soup(
51
+ url: str, verify: bool = True, timeout: Optional[int] = None, user_agent: Optional[str] = None
52
+ ) -> BeautifulSoup:
51
53
  """Get a beautiful soup parsed version of the given web page.
52
54
 
53
55
  :param url: The URL to download and parse with BeautifulSoup
@@ -55,9 +57,13 @@ def get_soup(url: str, verify: bool = True, timeout: Optional[int] = None) -> Be
55
57
  except for Ensembl, which makes a big pain
56
58
  :param timeout: How many integer seconds to wait for a response?
57
59
  Defaults to 15 if none given.
60
+ :param user_agent: A custom user-agent to set, e.g., to avoid anti-crawling mechanisms
58
61
  :returns: A BeautifulSoup object
59
62
  """
60
- res = requests.get(url, verify=verify, timeout=timeout or 15)
63
+ headers = {}
64
+ if user_agent:
65
+ headers["User-Agent"] = user_agent
66
+ res = requests.get(url, verify=verify, timeout=timeout or 15, headers=headers)
61
67
  soup = BeautifulSoup(res.text, features="html.parser")
62
68
  return soup
63
69
 
@@ -186,6 +192,9 @@ class Getter(metaclass=MetaGetter):
186
192
  date: ClassVar[str]
187
193
  homepage: ClassVar[str]
188
194
 
195
+ #: Prefixes this getter works for
196
+ collection: ClassVar[Optional[List[str]]] = None
197
+
189
198
  def get(self) -> Union[str, Mapping[str, str], datetime.datetime]:
190
199
  """Get the latest of this database."""
191
200
  raise NotImplementedError
bioversions/version.py CHANGED
@@ -9,7 +9,7 @@ __all__ = [
9
9
  "VERSION",
10
10
  ]
11
11
 
12
- VERSION = "0.5.330"
12
+ VERSION = "0.5.331"
13
13
 
14
14
 
15
15
  def get_git_hash() -> str:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bioversions
3
- Version: 0.5.330
3
+ Version: 0.5.331
4
4
  Summary: What's the current version for each biological database?
5
5
  Home-page: https://github.com/biopragmatics/bioversions
6
6
  Download-URL: https://github.com/biopragmatics/bioversions/releases
@@ -5,12 +5,12 @@ bioversions/cli.py,sha256=vFwSyuWWFly07g_9hcd_70pwKV7U-OZPqRWhn4FxIjU,1589
5
5
  bioversions/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  bioversions/slack_client.py,sha256=42kl4TbjtXimVRULcBfe8i3pdJLScEPvJr1vw72tv-4,1271
7
7
  bioversions/twitter_client.py,sha256=TQhsdp6avlzoZLoZlndJlwsYhIYI-uabehZJ1W1mNuY,1353
8
- bioversions/utils.py,sha256=QKnfFNU8aYmKBpXspODCRk7VgSRUI8fTeGK3SuydEZc,10100
9
- bioversions/version.py,sha256=63vKCY-6BETFZK4G0XMrPjyNT0pKtbnEuqq27yyr7VE,645
8
+ bioversions/utils.py,sha256=6ygaoe5rRArtrCXHrVygpl2cD7Otrbs4D1rADmpXDrA,10425
9
+ bioversions/version.py,sha256=cz88ucmI9DBByfmOw7rfMs3LNxfOcxrHZnjhKCYqK_Y,645
10
10
  bioversions/wsgi.py,sha256=Z1HYFmnrWKNGwHq4R4DRfBuLzAEAAZ5UfHjvJUpnDfs,826
11
11
  bioversions/resources/__init__.py,sha256=0E1yGGT5SztSGEa30Tai4wCUki4nqfynqCSNAvjzEOk,1173
12
12
  bioversions/resources/update.py,sha256=21LprPktMKXdFI7llKjn7gsAQq01TGSKFbWQEhhwDJ0,3215
13
- bioversions/sources/__init__.py,sha256=4jY2a9HuF1u27PqjDtXbXBz2cfcL9-yWknIlZqWZSpI,5929
13
+ bioversions/sources/__init__.py,sha256=gxSQDIbe0bURXXEvQmD-7QWOEa8gCubr62CSUH-nbNQ,5962
14
14
  bioversions/sources/antibodyregistry.py,sha256=VIgnYZ_Jtcx0u19X60Ee7qTqDgbub5C2EBtK_Bz7Twc,705
15
15
  bioversions/sources/bigg.py,sha256=qPBpX8qap8MlnlcntWO30jIgWD4c9RV57cKp_EZhnE0,672
16
16
  bioversions/sources/biogrid.py,sha256=k32iXtno-Q2M2SVDX_S-22_B1rwSTzQNZwJCL9nwoW4,759
@@ -18,6 +18,7 @@ bioversions/sources/cellosaurus.py,sha256=x3kAjDAoy2YQY3ZroiZxdsh7_-AQg1bWTWa-0y
18
18
  bioversions/sources/chebi.py,sha256=TRQ7DZ-Dz8b3mNaKRe52QVfQFahvTwVsBQjXapxBl_M,856
19
19
  bioversions/sources/chembl.py,sha256=HHasQ9F1Utm9LLsN1h-NrwfNifN-Y-Ss928_0Iz3CtY,1408
20
20
  bioversions/sources/chemidplus.py,sha256=USdDBPGcNULiw19ZFzz5QFIVzG_h80IaFbxsJH4Fb1w,1207
21
+ bioversions/sources/civic.py,sha256=1uGaTy2ipZ2Nm5Nn_Ojv6biJfLr3sB3djc6AmOT3sO0,970
21
22
  bioversions/sources/complexportal.py,sha256=SPJ3ryJNtXwvArtHaeeWCSau6uVBJTDxPX6XPvKmDlY,696
22
23
  bioversions/sources/daily.py,sha256=mq8NLnhRRDjTzwGQl9LxCBiO6BSWyGOJcfyg7qqNsno,281
23
24
  bioversions/sources/depmap.py,sha256=EjpScMRwqItvitso57ah3f53bkWbTK0bjLWOBr4ym1E,654
@@ -28,7 +29,7 @@ bioversions/sources/drugcentral.py,sha256=EWYatYEqZbwjH-0lUXYEfe5P5VNHsNJAtNDlSP
28
29
  bioversions/sources/ensembl.py,sha256=BHssnbJMI-jONB8W1mKERYsccRmIETI0NeWLnTTiDdk,760
29
30
  bioversions/sources/expasy.py,sha256=EQXDz1LJSc0J-BE5Gy5tI-T4e6j4D5jid6c6ajzQjG8,830
30
31
  bioversions/sources/flybase.py,sha256=5S0gI8tULx3sfNVy2O4grvyqIUwI4teS9S6khDh-JzQ,779
31
- bioversions/sources/guidetopharmacology.py,sha256=Lw0H0QDCwVMdvXdfIzySNLtP1WO7BANpab6gwPeURwc,1306
32
+ bioversions/sources/guidetopharmacology.py,sha256=B3W5I01v1a0OuvPJB-LHoSYvuJBN_cpXulnGrBs009o,1377
32
33
  bioversions/sources/hgnc.py,sha256=OH8E9dF2oPbh_BshPgKrWSFkYWDq9rj9J7DN06pVFxQ,970
33
34
  bioversions/sources/homologene.py,sha256=_f6SQRXe67t1jqQ6HjQIEOGApPUHLlfHMZojChumWzc,647
34
35
  bioversions/sources/icd10.py,sha256=cfiJcueTr6Z1dIzdP68QeCPlnJhr3Yd3U97TZplR1JI,716
@@ -37,17 +38,17 @@ bioversions/sources/icf.py,sha256=iTWjjScSlKDJZRRi1cKTZyTpP4p5Illv6LoZEvo-PSw,73
37
38
  bioversions/sources/intact.py,sha256=bRBnGm3-PHGdKlyYGkCabzQue9RG2MmF1A3CVF_U9e4,621
38
39
  bioversions/sources/interpro.py,sha256=UELzp1FBKBcul09DiK3eqkHZ31kkBPT4vuDD9A_9hz0,1261
39
40
  bioversions/sources/itis.py,sha256=u9h72y5JijXTprOe1SlaTW0adllj6NNoRP95AwuhzjE,831
40
- bioversions/sources/kegg.py,sha256=E5gQWlRs3HbcXy0MY0-tyo7TBKQfkZ4GkYk5I789S30,824
41
+ bioversions/sources/kegg.py,sha256=3JpmkmQJNw-Txp7LQFXgW975zGOz4ekfgEOZKhPtYis,868
41
42
  bioversions/sources/mesh.py,sha256=U3brzrzPjhzgSWxG2MILP-bqIgZpr62ns_izFnZzqe0,807
42
43
  bioversions/sources/mgi.py,sha256=68xCDcnWUckM_GDGW24MjtWwFf0vZHkS0H3NWKwUdr0,866
43
- bioversions/sources/mirbase.py,sha256=4qvzOQAvZmS8dIJ_dJfP-td9daDFxUzCnyHpv8weD_U,840
44
+ bioversions/sources/mirbase.py,sha256=5_D4EeB-K64eQ897xOSzoZQYFOiXNqtAugcexzR9oBg,905
44
45
  bioversions/sources/moalmanac.py,sha256=HxrJmOzqVJiHn9FQKCbOlBPCvxBHst1DI420TYERCvU,774
45
46
  bioversions/sources/msigdb.py,sha256=KGYZjjhqm0uUT0Wg_pb5kF9OVW33dgIh2r-yKMBqbWg,803
46
47
  bioversions/sources/ncit.py,sha256=ylubS3ntMyimaZDHFNFrjc2pkDfpyrBkhrl8Dq4duyQ,1064
47
48
  bioversions/sources/npass.py,sha256=-EL6Ej-23cdGKehn8nusP8LJ3z4oRX4ZPPDnjx_ItXQ,739
48
49
  bioversions/sources/obo.py,sha256=n2_Auh0ccu3WKOwq8JqFldzS8-KY0GVC1fReazPLr78,1735
49
50
  bioversions/sources/ols.py,sha256=PqL_CfpS0NxAfo1iSh2shakcnywRl_zfHXBcNrcLdiA,2754
50
- bioversions/sources/omim.py,sha256=l1dApi8xBidUIwWZTYwc7bHtPQBuernxDfdOVOnf34s,847
51
+ bioversions/sources/omim.py,sha256=y586CrSXrwldoiiGOJwL64yAPbJBkwwHCgFNDjsPMYk,856
51
52
  bioversions/sources/oncotree.py,sha256=Z-zZWFeVEfCyZcEMcrdVTcEoHIDfYB-v7oK_iYVSGEI,1026
52
53
  bioversions/sources/pathbank.py,sha256=_oMfaJs02FBJ6kIWHPW-M2euxAn5ylsGKqseRSJ3m2M,718
53
54
  bioversions/sources/pathwaycommons.py,sha256=lLVmJkf3qDuMk316Aia0CzJyp_-ahAASLupaAuQS9iw,686
@@ -68,9 +69,9 @@ bioversions/sources/uniprot.py,sha256=_rootal_mrESkiXJh3udfr1UGrlzP7CQQIMsa35tyc
68
69
  bioversions/sources/unversioned.py,sha256=noHxGmy9cpVv5xegMHouBF6oCbW6CP1jpOeCVdE7Eak,78
69
70
  bioversions/sources/wikipathways.py,sha256=HTva8vsXRQWU6bia83Et4vveo-QhzJS6dDWeu9Syc6c,823
70
71
  bioversions/sources/zfin.py,sha256=D7csziZ3UsW8dncm6XKA0t3x6XB4cFbG9PTYcT-g2bg,708
71
- bioversions-0.5.330.dist-info/LICENSE,sha256=GzLA83qaovFgoZWRYwaAmY-lkHZyDySJHU-YKE9NdVs,1076
72
- bioversions-0.5.330.dist-info/METADATA,sha256=YMyFW9Uj8qqGxzSOeDBKAf91d8S6dwyWECXCH6pySp4,9443
73
- bioversions-0.5.330.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
74
- bioversions-0.5.330.dist-info/entry_points.txt,sha256=A3qrS-nvKNZPZWQbYlmsmiDTge524C4yR-arRJwdHls,53
75
- bioversions-0.5.330.dist-info/top_level.txt,sha256=0QO2OEUMchj5GSlWEFi0cvUpsm4b_uwuuvr6uSEmfY0,12
76
- bioversions-0.5.330.dist-info/RECORD,,
72
+ bioversions-0.5.331.dist-info/LICENSE,sha256=GzLA83qaovFgoZWRYwaAmY-lkHZyDySJHU-YKE9NdVs,1076
73
+ bioversions-0.5.331.dist-info/METADATA,sha256=t-VZ8z1ZiX5hUJOTL0zIj16H83D2rRQNj0o36hMX7B4,9443
74
+ bioversions-0.5.331.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
75
+ bioversions-0.5.331.dist-info/entry_points.txt,sha256=A3qrS-nvKNZPZWQbYlmsmiDTge524C4yR-arRJwdHls,53
76
+ bioversions-0.5.331.dist-info/top_level.txt,sha256=0QO2OEUMchj5GSlWEFi0cvUpsm4b_uwuuvr6uSEmfY0,12
77
+ bioversions-0.5.331.dist-info/RECORD,,