chemicalchecker.database.datasource.Datasource
- class Datasource(**kwargs)[source]
Bases:
Base
Datasource table class.
- Parameters:
name (str) – primary key, simple unique name for the Datasource.
url (str) – the download link.
user (str) – few downloads require credentials.
password (str) – few downloads require credentials.
description (str) – free text description of the resource.
filename (str) – optional, a molrepo name. NB this name is the value of Molrepo.molrepo_name also is defininf the Parser that will be used.
calcdata (bool) – the datasource is actually from one of the calculated data.
A simple constructor that allows initialization from kwargs.
Sets attributes on the constructed instance using the names and values in
kwargs
.Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.
Methods
Add a new row to the table.
Download the Datasource.
Run HPC jobs downloading the resources.
Add entries from CSV file.
Get Datasources associated to the given dataset.
Check if all Datasources have been downloaded.
Check if all Datasources urls are valid.
Attributes
Check if Datasource is available.
calcdata
Check if Datasource is available.
datasets
datasource_name
description
filename
is_db
metadata
molrepos
password
registry
url
username
Check if Datasource url is valid.
- static add(kwargs)[source]
Add a new row to the table.
- Parameters:
kwargs (dict) – The data in dictionary format.
- property available
Check if Datasource is available.
- property data_path
Check if Datasource is available.
- download(force=False)[source]
Download the Datasource.
force(bool): Force download overwriting previous download.
- static download_hpc(job_path, only_essential=False, **kwargs)[source]
Run HPC jobs downloading the resources.
- Parameters:
job_path (str) – Path (usually in scratch) where the script files are generated.
only_essential (bool) – Download only the essential datasources (default: False).
- static from_csv(filename)[source]
Add entries from CSV file.
- Parameters:
filename (str) – Path to a CSV file.
- static get(name=None)[source]
Get Datasources associated to the given dataset.
- Parameters:
name (str) – The Datasource name, e.g “chebi”
- static test_all_downloaded(only_essential=False)[source]
Check if all Datasources have been downloaded.
- Parameters:
only_essential (bool) – Check only datasources that are essential
- property valid_url
Check if Datasource url is valid.