NORDic DS module

NORDic.NORDic_DS.functions module

NORDic.NORDic_DS.functions.baseline(signatures, phenotype, is_binary=False)

Compute the cosine scores between a set of signatures S and a differential phenotype P

Parameters

SPandas DataFrame

signatures rows/[genes] x columns/[drug names] [Treated || Control]

PPandas DataFrame

differential phenotype rows/[genes] x column/[disease name] [Diseased || Healthy]

is_binaryPython bool

[default=False] : if set to True, the signatures and phenotypes might be binary (that is, with values in {0,1})

Returns

scoresPython float dictionary

dictionary (keys=drug names, values=scores), the higher the score, the higher the repurposing power

NORDic.NORDic_DS.functions.compute_frontier(df, samples, nbseed=0, quiet=False)

Fit a model to classify control/treated phenotypes

Parameters

dfPandas DataFrame

rows/[genes] x columns/[samples] (either 1: active expression, -1: inactive expression, 0: undetermined expression)

samplesPandas DataFrame

rows/[“annotation”] x columns/[samples ], values are 1 (healthy sample) or 2 (patient sample).

nbseedPython integer

[default=0] : random seed

quietPython bool

[default=False] : prints out verbose

Returns

modelPython object

object with a function “predict” that returns predictions (1: control, or 2: treated) on phenotypes

NORDic.NORDic_DS.functions.compute_metrics(rewards, ground_truth, K=[2, 5, 10], use_negative_class=False, nperms=10000, thres=0.0, beta=1.0)

Compute AUC, Hit Ratio @ k of method for positive/negative class with p-value

Parameters

rewardsPython float list

predicted scores

ground_truthPython float list

ground truth scores

KPython integer list

[default=[2,5,10]] : ranks at which the hit ratio should be computed

use_negative_classPython bool

[default=False] : if set to True, compute the performance with respect to the negative class instead of the positive class

npermsPython integer

[default=10000] : number of permutations to perform

thresPython float

[default=0.] : decision threshold to determine the positive (resp. negative) class

betaPython float

[default=1.] : value of the coefficient in the F-measure

Returns

res_diPython dictionary

(keys=metrics, values=values of the metrics)

NORDic.NORDic_DS.functions.compute_score(f, x0, A, score, genes, nb_sims, experiments, repeat=1, exp_name='', quiet=False)

Compute similarities between any attractor in WT and in mutants, weighted by their probabilities

Parameters

fBoolean Network (MPBN) object

the mutated network

x0MPBN object

initial state

AAttractor list

list of attractors in mutant network

scorePython object

scoring of attractors

genesPython character string list

list of genes in the model frontier

nb_simsPython integer

number of iterations to compute the probabilities

experimentsPython dictionary list

list of experiments (different rates/depths)

repeatPython integer

[default=1] : how many times should these experiments be repeated

exp_namePython character string

[default=””] : printable for an experiment

quietPython bool

[default=False] : prints out verbose

Returns

scorePython float

change in attractors induced by the mutation

NORDic.NORDic_DS.functions.empirical_pvalue(sorted_rewards, sorted_ground_truth, nperms, method='ks_2samp')

Compute an empirical p-value corresponding to testing whether the distributions in the predicted scores and the ground truth are similar by randomly permuting the values of the predictions and averaging the number of significant statistics across all permutations

Parameters

sorted_rewardsPython float list

predicted scores sorted by genes of increasing predicted value

sorted_ground_truthPython float list

ground truth scores sorted by genes of increasing predicted value

npermsPython integer

number of permutations to perform

methodPython character string

[default=”ks_2samp”] : statistical test to perform at each permutation (should belong to scipy.stats)

Returns

pvaluePython float

empirical p-value corresponding to the test across all @nperms permutations

NORDic.NORDic_DS.functions.simulate(network_fname, targets, patients, score, simu_params={}, nbseed=0, quiet=False)

Simulate and score the individual effects of drugs on patient phenotypes, compared to controls

Parameters

network_fnamePython character string

(relative) path to a network .BNET file

targetsPandas DataFrame

rows/[genes] x columns/[drugs to test] (either 1: active expression, -1: inactive expression, 0: undetermined expression)

patientsPandas DataFrame

rows/[genes] x columns/[samples] (either 1: activatory, -1: inhibitory, 0: no regulation).

scorePython object

scoring of attractors

simu_paramsPython dictionary

[default={}] : arguments to MPBN-SIM

nbseedPython integer

[default=0] : random seed

quietPython bool

[default=False] : prints out verbose

Returns

scoresPandas DataFrame

rows/[patient phenotypes] x columns/[drug names], values are the associated scores

NORDic.NORDic_DS.functions.simulate_treatment(network_name, targets, score, state, simu_params={}, quiet=False)

Compute the score assigned to a drug with targets in @targets[[drug]] in network

Parameters

network_namePython character string

filename of the network in .bnet (needs to be pickable)

targetsPandas DataFrame

rows/[genes] x columns/[columns]

scorePython object

scoring of attractors

statePandas DataFrame

binary patient initial state rows/[genes] x columns/[values in {-1,0,1}]

simu_paramsPython dictionary

[default={}] : arguments to MPBN-SIM

seednbPython integer

[default=0] : random seed

quietPython bool

[default=False] : prints out verbose

Returns

effectsPython float dictionary

distance from attractors from treated networks to control profiles

NORDic.NORDic_DS.get_drug_signatures module

NORDic.NORDic_DS.get_drug_signatures.compute_drug_signatures_L1000(pubchem_cids, lincs_args, binarize=True, gene_list=None, chunksize=10)

Get drug signatures from LINCS L1000

Parameters

pubchem_cidsPython integer list

list of drug PubChem CIDs

lincs_argsPython dictionary

additional arguments for LINCS L1000 requests

binarizePython bool

[default=True] : should the resulting signatures be binarized?

Returns

sigsPandas DataFrame

rows/[genes] x columns/[drug names]

NORDic.NORDic_DS.get_drug_signatures.drugname2pubchem(drug_names, lincs_args)

Convert drug names into PubChem CIDs

Parameters

drug_namesPython character string list

list of drug names

lincs_argsPython dictionary

additional arguments for LINCS L1000 requests

Returns

pubchem_cidsPython dictionary

(keys=drug names, values=PubChem CIDs)

NORDic.NORDic_DS.get_drug_signatures.get_ranking(CD)

Retrieve ranking (50 first drugs) from L1000 CDS^2 search engine

Parameters

CDPandas DataFrame

rows/[genes] x column/[value] differential phenotype

Returns

resulsPandas DataFrame

rows/[drug names] x column/[“L1000 CDS2”] ranking of the drugs according to their ability to reverse the phenotype

NORDic.NORDic_DS.get_drug_signatures.pubchem2drugname(pubchem_cids, lincs_args)

Convert drug names into PubChem CIDs

Parameters

pubchem_cidsPython integer list

list of drug PubChem CIDs

lincs_argsPython dictionary

additional arguments for LINCS L1000 requests

Returns

pert_inamesPython dictionary

(keys=PubChem CIDs, values=drug names)

NORDic.NORDic_DS.get_drug_signatures.retrieve_drug_signature(pubchem_cid, cell_ids, gene_list, lincs_args, binarize, quiet=False)

Retrieve control & treated samples from LINCS L1000 and compute the corresponding drug signature

Parameters

pubchem_cidPython integer

drug PubChem CID

cell_idsPython character string list

list of candidate cell lines in LINCS L1000

gene_listPython integer list

list of EntrezID genes

lincs_argsPython dictionary

additional arguments for LINCS L1000 requests

binarizePython bool

should the resulting signatures be binarized?

quietPython bool

[default=False] : prints out verbose

Returns

sigPandas DataFrame

rows/[genes] x column/[drug PubChem]

NORDic.NORDic_DS.get_drug_targets module

NORDic.NORDic_DS.get_drug_targets.get_targets_DrugBank(drug_names, path_to_drugbank, drug_fname, target_fname, quiet=False)

Utility function which gets drug targets from a local DrugBank database

Parameters

drug_namesPython character string list

list of common drug names

path_to_drugbankPython character string

(relative) path to DrugBank files

drug_fnamePython character string

file name of .XML file of the complete database (full_database.xml) in DrugBank

target_fnamePython character string

file name of .CSV file of the protein targets (all.csv) in DrugBank

quietPython bool

prints out verbose (default=False)

Returns

target_dfPandas DataFrame

rows/[lists of HGNC symbols of targets] x columns/[drug names], values are “*” (known regulator) or “” (no known regulation)

NORDic.NORDic_DS.get_drug_targets.get_targets_DrugCentral(drug_names, quiet=False)

Utility function to retrieve drug targets from the DrugCentral 2021

Parameters

drug_namePython character string list

list of common drug names

quietPython bool

prints out verbose (default=False)

Returns

target_dfPandas DataFrame

rows/[lists of HGNC symbols of targets] x columns/[drug names], values are “*” (known regulator) or “” (no known regulation)

NORDic.NORDic_DS.get_drug_targets.get_targets_LINCS(drug_names, path_to_lincs, credentials, selection=None, nsigs=None, quiet=False)

Utility function to retrieve drug targets from the LINCS L1000 database

Parameters

drug_namesPython character string list

list of common drug names

path_to_lincsPython character string

(relative) path to LINCS files

credentialsPython character string

(relative) path to LINCS credentials file

quietPython bool

prints out verbose (default=False)

Returns

target_dfPandas DataFrame

rows/[lists of HGNC symbols of targets] x columns/[drug names], values are “*” (known regulator) or “” (no known regulation)

NORDic.NORDic_DS.get_drug_targets.get_targets_MINERVA(drug_names, quiet=False)

Utility function using httr:GET to send queries to a given MINERVA Platform instance

Parameters

drug_namesPython character string list

list of common drug names

quietPython bool

[default=False] : prints out verbose

Returns

target_dfPandas DataFrame

rows/[lists of HGNC symbols of targets] x columns/[drug names], values are “*” (known regulator) or “” (no known regulation)

NORDic.NORDic_DS.get_drug_targets.get_targets_TTD(drug_names, quiet=False)

Utility function to retrieve drug targets from the Therapeutic Target Database (TTD)

Parameters

drug_namePython character string list

list of common drug names

quietPython bool

prints out verbose (default=False)

Returns

target_dfPandas DataFrame

rows/[lists of HGNC symbols of targets] x columns/[drug names], values are “-” (inhibitor) or “+” (activator) or “” (no known regulation)

NORDic.NORDic_DS.get_drug_targets.retrieve_drug_targets(file_folder, drug_names, TARGET_args={}, gene_list=[], sources=['DrugBank', 'MINERVA', 'LINCS', 'TTD', 'DrugCentral'], quiet=False)

Retrieve drug targets from several online sources

Parameters

drug_namesPython character string list

list of common drug names

TARGET_argsPython dictionary

[default={}] : see for each source

gene_listPython character string list

[default=[]] : list of HGNC symbols

sourcesPython character string list

[default=[“DrugBank”,”MINERVA”,”LINCS”,”TTD”,”DrugCentral”]] : list of source names (in [“DrugBank”,”MINERVA”,”LINCS”,”TTD”,”DrugCentral”])

quietPython bool

[default=False] : prints out verbose

Returns

targets_dfPandas DataFrame

rows/[genes] x columns/[drug names], values are the number of times a target is connected to a drug across all queried databases