-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
23 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,35 @@ | ||
"""MetGem plugin to download ISDB""" | ||
|
||
__version__ = '1.0' | ||
__version__ = '1.1' | ||
__description__ = "MetGem plugin to download ISDB" | ||
__author__ = "Nicolas Elie" | ||
__email__ = "[email protected]" | ||
__copyright__ = "Copyright 2019, CNRS/ICSN" | ||
__copyright__ = "Copyright 2019-2022, CNRS/ICSN" | ||
__license__ = "GPLv3" | ||
|
||
import json | ||
|
||
|
||
# noinspection PyUnresolvedReferences | ||
class ISDB(DbSource): | ||
|
||
name = "ISDB" | ||
items_base_url = "https://raw.githubusercontent.com/oolonek/ISDB/master/Data/dbs/" | ||
page = "https://doi.org/10.5281/zenodo.5607185" | ||
items_base_url = "" | ||
|
||
def get_items(self, tree): | ||
json_s = tree.find('.//script[@type="application/ld+json"]').text | ||
json_load = json.loads(json_s) | ||
description = json_load['description'] | ||
identifier = json_load['identifier'] | ||
version = json_load['version'] | ||
date = json_load['datePublished'] | ||
|
||
hrefs = [] | ||
|
||
def get_items(self): | ||
yield "In-Silico Database", [f'UNPD_ISDB_R_p0{i}.mgf' for i in range(1, 10)],\ | ||
'A database of In-Silico predicted MS/MS spectrum of Natural Products' | ||
for distrib in json_load['distribution']: | ||
if distrib['@type'] == 'DataDownload': | ||
href = distrib['contentUrl'] | ||
hrefs.append(href) | ||
yield "In-Silico Database", hrefs,\ | ||
f"Version {version} ({date}) <a href='{identifier}'>{identifier}</a>\n{description}" |