-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding "Getter" for GTDB to be used in pyOBO module for GTDB I have in development. --------- Co-authored-by: Jose Pedro Lopes Faria <[email protected]> Co-authored-by: Charles Tapley Hoyt <[email protected]>
- Loading branch information
1 parent
c23a6f1
commit 7455e73
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
"""A getter for GTDB.""" | ||
|
||
import requests | ||
|
||
from bioversions.utils import Getter, VersionType | ||
|
||
__all__ = [ | ||
"GTDBGetter", | ||
] | ||
|
||
URL = "https://data.gtdb.ecogenomic.org/releases/latest/VERSION.txt" | ||
|
||
|
||
class GTDBGetter(Getter): | ||
"""A getter for the Genome Taxonomy Database (GTDB).""" | ||
|
||
bioregistry_id = "gtdb" | ||
name = "Genome Taxonomy Database" | ||
version_type = VersionType.sequential | ||
date_fmt = "%b %d, %Y" # Format to match "Apr 24, 2024" | ||
homepage_fmt = "https://gtdb.ecogenomic.org/" | ||
|
||
def get(self): | ||
"""Get the latest GTDB version number from VERSION.txt.""" | ||
res = requests.get(URL, timeout=15) | ||
lines = res.text.strip().split("\n") | ||
# First line contains version like "v220" | ||
version = lines[0].strip().lstrip("v") | ||
# Third line contains date like "Released Apr 24, 2024" | ||
date = lines[2].strip().removeprefix("Released ") | ||
return {"version": version, "date": date} | ||
|
||
|
||
if __name__ == "__main__": | ||
GTDBGetter.print() |