QuartataWeb Server Functions

This module defines classes and functions for browsing QuartataWeb.

Based on code written by the CHARMM-GUI team (http://charmm-gui.org) and modified by James Krieger

This suite uses the following softwares: - python Splinter package (https://splinter.readthedocs.org/en/latest/) - a web browser, such as Google Chrome or Mozilla Firefox - the corresponding driver such as chromedriver (https://sites.google.com/a/chromium.org/chromedriver/downloads)

for Chrome or geckodriver (https://github.com/mozilla/geckodriver/releases) for Firefox
class QuartataWebBrowser(data_source=None, drug_group=None, input_type=None, query_type=None, data=None, num_predictions=None, browser_type=None, job_id=None, tsv=None, chem_type='known')[source]

Class to browse the QuartataWeb website.

Parameters:
  • data_source (str) – source database for QuartataWeb analysis options are "DrugBank" or "STITCH". Default is "DrugBank"
  • drug_group (str) – group of drugs if using DrugBank options are "Approved" or "All". Default is "All"
  • input_type (int) – number corresponding to the input type, options are 1 (Chemical and/or target) or 2 (A list of chemicals, targets or chemical combinations). Default is 1
  • query_type (int) –

    number corresponding to the query type. Options are dependent on input_type.

    With input_type 1, they are: * 1 (chemical-target interaction) * 2 (chemical-chemical similarity) * 3 (target-target similarity)

    With input_type 2, they are: * 1 (chemicals) * 2 (targets) * 3 (chemical combinations)

    Default is 1

  • data (list) –

    data to enter into the box or boxes. This varies depending on input type and query type, but will always be a list of strings.

    For input_type 1, a list with two items is expected. These will be one of the following depending on query_type: * With query_type 1, the first would be a chemical and the second a target.

    One of these can also be left blank.
    • With query_type 2, the first would be a chemical and the second a chemical.
    • With query_type 3, the first would be a target and the second a target.

    For input_type 2, a list with any length is expected. These will be one of the following depending on query_type: * With query_type 1, these would be chemicals. * With query_type 2, these would be targets. * With query_type 3, these would be pairs of chemicals, separated by semicolons.

  • num_predictions (int, list) – number of predictions to show or consider in addition to known interactions. Default is 0. With DrugBank and input_type 1, a second number can be provided in a list for secondary interactions.
  • browser_type (str) – browser type for navigation Default is "Chrome"
  • job_id (int) – job ID for accessing previous jobs Default is None
  • tsv (str) – a filename for a file that contains the results or a file to save the results in tsv format
goToDownloads()[source]

Go to downloads page

goToWorkDir()[source]

Go to working directory

parseChemicals(filename=None, chem_type='known')[source]

Go to working directory and parse chemicals for query protein. Updates self.chemical_data

setBrowserType(browser_type)[source]

Set browser_type and update home page

Parameters:browser_type (str) – browser type for navigation Default is "Chrome"
setData(data)[source]

Set data and update home page

Parameters:data (list) –

data to enter into the box or boxes. This varies depending on input type and query type, but will always be a list of strings.

For input_type 1, a list with two items is expected. These will be one of the following depending on query_type: * With query_type 1, the first would be a chemical and the second a target.

One of these can also be left blank.
  • With query_type 2, the first would be a chemical and the second a chemical.
  • With query_type 3, the first would be a target and the second a target.

For input_type 2, a list with any length is expected. These will be one of the following depending on query_type: * With query_type 1, these would be chemicals. * With query_type 2, these would be targets. * With query_type 3, these would be pairs of chemicals, separated by semicolons.

setDataSource(data_source)[source]

Set data_source and update home page

Parameters:data_source (str) – source database for QuartataWeb analysis options are "DrugBank" or "STITCH". Default is "DrugBank"
setDrugGroup(group)[source]

Set drug_group and update home page

Parameters:group (str) – group of drugs if using DrugBank options are "Approved" or "All". Default is "All"
setInputType(input_type)[source]

Set input_type and update home page

Parameters:input_type (int) – number corresponding to the input type, options are 1 (Chemical and/or target) or 2 (A list of chemicals, targets or chemical combinations). Default is 1
setJObID(job_id)[source]

Set job_id and view results

Parameters:job_id (int) – job ID for accessing previous jobs Default is None
setNumPredictions(num_predictions)[source]

Set num_predictions and update home page

Parameters:num_predictions (int, list) – number of predictions to show or consider in addition to known interactions. Default is 0. With DrugBank and input_type 1, a second number can be provided in a list for secondary interactions.
setQueryType(query_type)[source]

Set query_type and update home page

Parameters:query_type (int) –

number corresponding to the query type. Options are dependent on input_type.

With input_type 1, they are: * 1 (chemical-target interaction) * 2 (chemical-chemical similarity) * 3 (target-target similarity)

With input_type 2, they are: * 1 (chemicals) * 2 (targets) * 3 (chemical combinations)

Default is 1

updateHomePage()[source]

Update the home page with data from setting variables

viewResults()[source]

View results by clicking submit or using a job_id

class QuartataChemicalRecord(data_source=None, drug_group=None, input_type=None, query_type=None, data=None, num_predictions=None, browser_type=None, job_id=None, filename=None)[source]

Class for handling chemical data from QuartataWebBrowser

Instantiate a QuartataChemicalRecord object instance. Inputs are the same as QuartataWebBrowser.

fetch(data_source=None, drug_group=None, input_type=None, query_type=None, data=None, num_predictions=None, browser_type=None, job_id=None, filename=None)[source]

Fetch data

filter(lower_weight=None, upper_weight=None, cutoff_score=None)[source]

Filters out chemicals from the list and returns the updated list. Chemicals that satisfy any of the following criterion will be filtered out. (1) Molecular weight < lower_weight (must be a positive number); (2) Molecular weight > upper_weight (must be a positive number); (3) Confidence score < cutoff_score (must be a positive number);

Please note that every time this function is run, this overrides any previous runs. Therefore, please provide all filters at once.

getChemicalList(filtered=True)[source]

Returns chemical list (filters may be applied)

getFilterList()[source]

Returns a list of chemicals for the entries that were filtered out

getParticularSMILES(key)[source]

Returns SMILES for a particular chemical

getSMILESList(filtered=True)[source]

Returns SMILES list (filters may be applied)

searchQuartataWeb(data_source=None, drug_group=None, input_type=None, query_type=None, data=None, num_predictions=None, browser_type=None, job_id=None, filename=None, result_type='Chemical')[source]

Wrapper function for searching QuartataWeb.

Parameters:result_type (str) – type of results to get from QuartataWeb. So far only 'Chemical' is supported.

All other arguments are the same as QuartataWebBrowser.