Skip to content

Commit

Permalink
Add uniprot
Browse files Browse the repository at this point in the history
  • Loading branch information
cthoyt committed Jan 2, 2021
1 parent 3ea5f18 commit 5932899
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
15 changes: 15 additions & 0 deletions docs/_data/versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
- homepage: https://downloads.thebiogrid.org/BioGRID/Release-Archive/BIOGRID-4.2.192
retrieved: '2020-12-11'
version: 4.2.192
- homepage: https://downloads.thebiogrid.org/BioGRID/Release-Archive/BIOGRID-4.2.193
retrieved: '2021-01-02'
version: 4.2.193
- name: Cell Ontology
releases:
- retrieved: '2020-12-22'
Expand All @@ -11,6 +14,9 @@
releases:
- retrieved: '2020-12-11'
version: '194'
- homepage: ftp://ftp.ebi.ac.uk/pub/databases/chebi/archive/rel195/
retrieved: '2021-01-02'
version: '195'
- name: ChEBML
releases:
- date: 18/05/2020
Expand Down Expand Up @@ -43,6 +49,10 @@
releases:
- retrieved: '2020-12-22'
version: 9/18/2020
- name: ExPASy
releases:
- retrieved: '2021-01-02'
version: 02-Dec-2020
- name: Gene Ontology
releases:
- retrieved: '2020-12-11'
Expand Down Expand Up @@ -101,6 +111,11 @@
- homepage: ftp://ftp.ebi.ac.uk/pub/databases/Rfam/14.4/
retrieved: '2020-12-25'
version: '14.4'
- name: UniProt
releases:
- homepage: ftp://ftp.uniprot.org/pub/databases/uniprot/previous_releases/release-2020_06/
retrieved: '2021-01-02'
version: '2020_06'
- name: WikiPathways
releases:
- homepage: http://data.wikipathways.org/20201210/
Expand Down
2 changes: 2 additions & 0 deletions src/bioversions/sources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from .pfam import PfamGetter
from .reactome import ReactomeGetter
from .rfam import RfamGetter
from .uniprot import UniProtGetter
from .wikipathways import WikiPathwaysGetter
from ..utils import Bioversion, Getter, norm, refresh_daily

Expand Down Expand Up @@ -57,6 +58,7 @@
PfamGetter,
ClGetter,
ZfaGetter,
UniProtGetter,
]
getters = sorted(getters, key=lambda cls: cls.__name__.lower())

Expand Down
36 changes: 36 additions & 0 deletions src/bioversions/sources/uniprot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# -*- coding: utf-8 -*-

"""A getter for UniProt."""

from xml.etree import ElementTree # noqa:S405

import requests
import requests_ftp

from bioversions.utils import Getter

__all__ = [
'UniProtGetter',
]

requests_ftp.monkeypatch_session()


class UniProtGetter(Getter):
"""A getter for UniProt."""

name = 'UniProt'
homepage_fmt = 'ftp://ftp.uniprot.org/pub/databases/uniprot/previous_releases/release-{version}/'
date_version_fmt = '%Y_%m'

def get(self):
"""Get the latest UniProt version number."""
session = requests.Session()
f = session.get('ftp://ftp.uniprot.org/pub/databases/uniprot/current_release/RELEASE.metalink')
tree = ElementTree.fromstring(f.text) # noqa:S314
version_tag = tree.find('{http://www.metalinker.org/}version')
return version_tag.text


if __name__ == '__main__':
UniProtGetter.print()

0 comments on commit 5932899

Please sign in to comment.