Title: | Poly-Pharmacology Toolkit for Traditional Chinese Medicine Research |
---|---|
Description: | Toolkit for Poly-pharmacology Research of Traditional Chinese Medicine. Based on the biological descriptors and drug-disease interaction networks, it can analyze the potential poly-pharmacological mechanisms of Traditional Chinese Medicine and be used for drug-repositioning in Traditional Chinese Medicine. |
Authors: | Yuanlong Hu [aut, cre] |
Maintainer: | Yuanlong Hu <[email protected]> |
License: | GPL (>= 3) |
Version: | 1.0.5 |
Built: | 2024-11-10 04:47:32 UTC |
Source: | https://github.com/yuanlonghu/immcp |
BasicData
This class represents the basic input data.Class BasicData
This class represents the basic input data.
drugnet
A directed graph
diseasenet
Disease network.
biomarker
Disease-related gene.
Yuanlong Hu
BioDescr
This class represents the biological descriptor data.Class BioDescr
This class represents the biological descriptor data.
drug_geneset
from drug to geneset.
geneset_gene
from geneset to gene for each drug.
anno
Geneset ID and description.
Yuanlong Hu
Create BasicData Object
CreateBasicData(..., diseasenet = NULL, biomarker = NULL)
CreateBasicData(..., diseasenet = NULL, biomarker = NULL)
... |
Drug graph from |
diseasenet |
A graph of Disease-related gene from |
biomarker |
Character vector, the vector of Disease-related gene. |
A BasicData object.
Yuanlong Hu
data(drugdemo) drug_herb <- PrepareData(drugdemo$drug_herb, from = "drug", to="herb") herb_compound <- PrepareData(drugdemo$herb_compound, from = "herb", to="compound") compound_target <- PrepareData(drugdemo$compound_target, from = "compound", to="target") disease <- PrepareData(drugdemo$disease, diseaseID = "disease",from = "target", to="target") BasicData <- CreateBasicData(drug_herb, herb_compound, compound_target, diseasenet = disease)
data(drugdemo) drug_herb <- PrepareData(drugdemo$drug_herb, from = "drug", to="herb") herb_compound <- PrepareData(drugdemo$herb_compound, from = "herb", to="compound") compound_target <- PrepareData(drugdemo$compound_target, from = "compound", to="target") disease <- PrepareData(drugdemo$disease, diseaseID = "disease",from = "target", to="target") BasicData <- CreateBasicData(drug_herb, herb_compound, compound_target, diseasenet = disease)
Create Disease-Drug Network
CreateDisDrugNet(BasicData, drug, disease)
CreateDisDrugNet(BasicData, drug, disease)
BasicData |
BasicData object. |
drug |
Character vector, the drug. |
disease |
Character vector, the disease. |
A igraph object.
Yuanlong Hu
data(drugdemo) drug_herb <- PrepareData(drugdemo$drug_herb, from = "drug", to="herb") herb_compound <- PrepareData(drugdemo$herb_compound, from = "herb", to="compound") compound_target <- PrepareData(drugdemo$compound_target, from = "compound", to="target") disease <- PrepareData(drugdemo$disease, diseaseID = "disease",from = "target", to="target") BasicData <- CreateBasicData(drug_herb, herb_compound, compound_target, diseasenet = disease) DisDrugNet <- CreateDisDrugNet(BasicData, drug = "Drug1", disease = "disease")
data(drugdemo) drug_herb <- PrepareData(drugdemo$drug_herb, from = "drug", to="herb") herb_compound <- PrepareData(drugdemo$herb_compound, from = "herb", to="compound") compound_target <- PrepareData(drugdemo$compound_target, from = "compound", to="target") disease <- PrepareData(drugdemo$disease, diseaseID = "disease",from = "target", to="target") BasicData <- CreateBasicData(drug_herb, herb_compound, compound_target, diseasenet = disease) DisDrugNet <- CreateDisDrugNet(BasicData, drug = "Drug1", disease = "disease")
Calculate the difference of network characters in two network
diff_network_char(graph1, graph2, output_all = FALSE)
diff_network_char(graph1, graph2, output_all = FALSE)
graph1 |
A igraph object. |
graph2 |
A igraph object. |
output_all |
FALSE |
A number vector.
Yuanlong Hu
Enrich Analysis
enrich_f( target_character, geneset = c("kegg", "mkegg", "go", "wp"), arguments = list(minGSSize = 5, maxGSSize = 500, pvalue = 0.05, qvalue = 0.1), out_dataframe = TRUE, to_ENTREZID = TRUE )
enrich_f( target_character, geneset = c("kegg", "mkegg", "go", "wp"), arguments = list(minGSSize = 5, maxGSSize = 500, pvalue = 0.05, qvalue = 0.1), out_dataframe = TRUE, to_ENTREZID = TRUE )
target_character |
Charactor vector of gene. |
geneset |
Charactor vector, one of "kegg"(KEGG), "mkegg"(KEGG Module), "go"(GO-BP), and "wp"(WikiPathways); a data frame and list. |
arguments |
A list of the arguments of |
out_dataframe |
Logical, whether to output data frame,defaults to |
to_ENTREZID |
Logical, whether to translate to ENTREZID from SYMBOL, defaults to |
data frame
Yuanlong Hu
Export an xlsx file to Cytoscape.
exportCytoscape(graph, file)
exportCytoscape(graph, file)
graph |
igraph object. |
file |
file |
A workbook object
Yuanlong Hu
Extract Biological descriptor
extr_biodescr( BasicData, geneset = c("kegg", "mkegg", "go", "wp"), arguments = list(minGSSize = 5, maxGSSize = 500, pvalue = 0.05, qvalue = 0.1), ref_type = "drug", ref = NULL, to_ENTREZID = TRUE )
extr_biodescr( BasicData, geneset = c("kegg", "mkegg", "go", "wp"), arguments = list(minGSSize = 5, maxGSSize = 500, pvalue = 0.05, qvalue = 0.1), ref_type = "drug", ref = NULL, to_ENTREZID = TRUE )
BasicData |
BasicData object. |
geneset |
Charactor vector, one of "kegg"(KEGG), "mkegg"(KEGG Module), "go"(GO-BP), and "wp"(WikiPathways); a data frame and list. |
arguments |
A list of the arguments of |
ref_type |
Charactor vector, one of "drug", "herb", "compound" or "target", defaults to "drug". |
ref |
Charactor vector, reference drug, herb, compound or target, defaults to |
to_ENTREZID |
Logical, whether to translate to ENTREZID from SYMBOL, defaults to TRUE. |
A BioDescr object.
Yuanlong Hu
Extract Biological descriptor
## S4 method for signature 'BasicData' extr_biodescr( BasicData, geneset = c("kegg", "mkegg", "go", "wp"), arguments = list(minGSSize = 5, maxGSSize = 500, pvalue = 0.05, qvalue = 0.1), ref_type = "drug", ref = NULL, to_ENTREZID = TRUE )
## S4 method for signature 'BasicData' extr_biodescr( BasicData, geneset = c("kegg", "mkegg", "go", "wp"), arguments = list(minGSSize = 5, maxGSSize = 500, pvalue = 0.05, qvalue = 0.1), ref_type = "drug", ref = NULL, to_ENTREZID = TRUE )
BasicData |
BasicData object. |
geneset |
Charactor vector, one of "kegg"(KEGG), "mkegg"(KEGG Module), "go"(GO-BP), and "wp"(WikiPathways); a data frame and list. |
arguments |
A list of the arguments of |
ref_type |
Charactor vector, one of "drug", "herb", "compound" or "target", defaults to "drug". |
ref |
Charactor vector, reference drug, herb, compound or target, defaults to |
to_ENTREZID |
Logical, whether to translate to ENTREZID from SYMBOL, defaults to TRUE. |
A BioDescr object.
## Not run: data(drugdemo) drug_herb <- PrepareData(drugdemo$drug_herb, from = "drug", to="herb") herb_compound <- PrepareData(drugdemo$herb_compound, from = "herb", to="compound") compound_target <- PrepareData(drugdemo$compound_target, from = "compound", to="target") disease <- PrepareData(drugdemo$disease, diseaseID = "disease",from = "target", to="target") BasicData <- CreateBasicData(drug_herb, herb_compound, compound_target, diseasenet = disease) biodescr <- extr_biodescr(BasicData, geneset= "kegg") ## End(Not run)
## Not run: data(drugdemo) drug_herb <- PrepareData(drugdemo$drug_herb, from = "drug", to="herb") herb_compound <- PrepareData(drugdemo$herb_compound, from = "herb", to="compound") compound_target <- PrepareData(drugdemo$compound_target, from = "compound", to="target") disease <- PrepareData(drugdemo$disease, diseaseID = "disease",from = "target", to="target") BasicData <- CreateBasicData(drug_herb, herb_compound, compound_target, diseasenet = disease) biodescr <- extr_biodescr(BasicData, geneset= "kegg") ## End(Not run)
HerbResult
This class represents the biological descriptor data.Class HerbResult
This class represents the biological descriptor data.
Drug_Herb
Data frame, Drug-herb relationship.
Herb_Herb
Herb-herb association Rule Graph, it is a directed graph.
Yuanlong Hu
Calculate the natural connectivity
natural_connectivity(graph)
natural_connectivity(graph)
graph |
A igraph object. |
A numeric vector.
Yuanlong Hu
Calculate the network characters
network_char(graph, total_network = FALSE)
network_char(graph, total_network = FALSE)
graph |
The graph. |
total_network |
Calculate for total network or each nodes. |
A number vector or data frame.
Yuanlong Hu
Kolmogorov-Smirnov tests for node characters between networks
network_node_ks(graph1, graph2, replicate = 1000)
network_node_ks(graph1, graph2, replicate = 1000)
graph1 |
A igraph object. |
graph2 |
A igraph object. |
replicate |
Number vector, the number of conduct bootstrapping sampling replications. |
A data frame
Yuanlong Hu
Plot Biological descriptor
plot_BioDescr( BioDescr, type = "heatmap", cluster_k = 2, colors = c("#2E9FDF", "#E7B800") )
plot_BioDescr( BioDescr, type = "heatmap", cluster_k = 2, colors = c("#2E9FDF", "#E7B800") )
BioDescr |
BioDescr object. |
type |
one of "heatmap" and "clusterplot". |
cluster_k |
Number vector, number of cluster. |
colors |
vector of colors. |
Returns NULL, invisibly.
Plot Disease-Drug Network
plot_graph( graph, drug, disease, Isolated = TRUE, vis = "visNetwork", color = c(drug = "#cca4e3", herb = "#ff461f", compound = "#ffc773", target = "#70f3ff"), width = 1, size = 20, ... ) ## S4 method for signature 'BasicData' plot_graph( graph, drug, disease, Isolated = TRUE, vis = "visNetwork", color = c(drug = "#cca4e3", herb = "#ff461f", compound = "#ffc773", target = "#70f3ff"), width = 1, size = 20, ... ) ## S4 method for signature 'igraph' plot_graph( graph, drug, disease, Isolated = TRUE, vis = "visNetwork", color = c(drug = "#cca4e3", herb = "#ff461f", compound = "#ffc773", target = "#70f3ff"), width = 1, size = 20, ... ) ## S4 method for signature 'HerbResult' plot_graph( graph, drug, disease, Isolated = TRUE, vis = "visNetwork", color = c(drug = "#cca4e3", herb = "#ff461f", compound = "#ffc773", target = "#70f3ff"), width = 1, size = 20, ... )
plot_graph( graph, drug, disease, Isolated = TRUE, vis = "visNetwork", color = c(drug = "#cca4e3", herb = "#ff461f", compound = "#ffc773", target = "#70f3ff"), width = 1, size = 20, ... ) ## S4 method for signature 'BasicData' plot_graph( graph, drug, disease, Isolated = TRUE, vis = "visNetwork", color = c(drug = "#cca4e3", herb = "#ff461f", compound = "#ffc773", target = "#70f3ff"), width = 1, size = 20, ... ) ## S4 method for signature 'igraph' plot_graph( graph, drug, disease, Isolated = TRUE, vis = "visNetwork", color = c(drug = "#cca4e3", herb = "#ff461f", compound = "#ffc773", target = "#70f3ff"), width = 1, size = 20, ... ) ## S4 method for signature 'HerbResult' plot_graph( graph, drug, disease, Isolated = TRUE, vis = "visNetwork", color = c(drug = "#cca4e3", herb = "#ff461f", compound = "#ffc773", target = "#70f3ff"), width = 1, size = 20, ... )
graph |
graph. |
drug |
drug. |
disease |
disease. |
Isolated |
Whether to delect Isolated nodes. |
vis |
one of "igraph", "visNetwork" and "shiny". |
color |
Nodes Color |
width |
Edges width |
size |
Nodes size |
... |
Arguments |
Returns NULL, invisibly.
Yuanlong Hu
Prepare input format.
PrepareData(..., from, to, diseaseID, format = "single", sep)
PrepareData(..., from, to, diseaseID, format = "single", sep)
... |
data frame, containing interaction information. |
from |
A charactor vector, containing "drug", "herb", "compound", or "target". |
to |
A character vector, containing "drug", "herb", "compound", or "target". |
diseaseID |
Charactor vector, diseaseID |
format |
one of "single" or "basket". |
sep |
Separator. |
A igraph object.
Yuanlong Hu
data(drugdemo) drug_herb <- PrepareData(drugdemo$drug_herb, from = "drug", to="herb") herb_compound <- PrepareData(drugdemo$herb_compound, from = "herb", to="compound") compound_target <- PrepareData(drugdemo$compound_target, from = "compound", to="target") disease <- PrepareData(drugdemo$disease, diseaseID = "disease",from = "target", to="target")
data(drugdemo) drug_herb <- PrepareData(drugdemo$drug_herb, from = "drug", to="herb") herb_compound <- PrepareData(drugdemo$herb_compound, from = "herb", to="compound") compound_target <- PrepareData(drugdemo$compound_target, from = "compound", to="target") disease <- PrepareData(drugdemo$disease, diseaseID = "disease",from = "target", to="target")
parse gmt file to a data.frame
read_gmt(gmtfile, out_dataframe = TRUE)
read_gmt(gmtfile, out_dataframe = TRUE)
gmtfile |
A GMT file name or URL containing gene sets. |
out_dataframe |
TRUE or FALSE |
data.frame, list
Yuanlong Hu
Calculating differences in disease network characteristics before and after removal of drug targets
score_network(BasicData, n = 1000)
score_network(BasicData, n = 1000)
BasicData |
A BasicData object. |
n |
Number vector, the number of times random permutation sampling, default to 1000. |
A list.
Yuanlong Hu
data(drugdemo) drug_herb <- PrepareData(drugdemo$drug_herb, from = "drug", to="herb") herb_compound <- PrepareData(drugdemo$herb_compound, from = "herb", to="compound") compound_target <- PrepareData(drugdemo$compound_target, from = "compound", to="target") disease <- PrepareData(drugdemo$disease, diseaseID = "disease",from = "target", to="target") BasicData <- CreateBasicData(drug_herb, herb_compound, compound_target, diseasenet = disease) res <- score_network(BasicData, n = 100)
data(drugdemo) drug_herb <- PrepareData(drugdemo$drug_herb, from = "drug", to="herb") herb_compound <- PrepareData(drugdemo$herb_compound, from = "herb", to="compound") compound_target <- PrepareData(drugdemo$compound_target, from = "compound", to="target") disease <- PrepareData(drugdemo$disease, diseaseID = "disease",from = "target", to="target") BasicData <- CreateBasicData(drug_herb, herb_compound, compound_target, diseasenet = disease) res <- score_network(BasicData, n = 100)
Mine herb-herb association rules of prescription using the Apriori algorithm.
score_rule(BasicData, drug = NULL, support = 0.1, confidence = 0.8, lift = 1)
score_rule(BasicData, drug = NULL, support = 0.1, confidence = 0.8, lift = 1)
BasicData |
BasicData object. |
drug |
Charactor vector of drug names to analyze, default to |
support |
A numeric value for the minimal support of an item set, default to 0.1. |
confidence |
A numeric value for the minimal confidence of an item set, default to 0.8. |
lift |
A numeric value for the minimal lift of an item set, default to 1. |
A HerbResult object.
Yuanlong Hu
## Not run: data(drugdemo) drug_herb <- PrepareData(drugdemo$drug_herb, from = "drug", to="herb") herb_compound <- PrepareData(drugdemo$herb_compound, from = "herb", to="compound") compound_target <- PrepareData(drugdemo$compound_target, from = "compound", to="target") disease <- PrepareData(drugdemo$disease, diseaseID = "disease",from = "target", to="target") BasicData <- CreateBasicData(drug_herb, herb_compound, compound_target, diseasenet = disease) res <- score_rule(BasicData, support = 0.1,confidence = 0.8, lift = 1) ## End(Not run)
## Not run: data(drugdemo) drug_herb <- PrepareData(drugdemo$drug_herb, from = "drug", to="herb") herb_compound <- PrepareData(drugdemo$herb_compound, from = "herb", to="compound") compound_target <- PrepareData(drugdemo$compound_target, from = "compound", to="target") disease <- PrepareData(drugdemo$disease, diseaseID = "disease",from = "target", to="target") BasicData <- CreateBasicData(drug_herb, herb_compound, compound_target, diseasenet = disease) res <- score_rule(BasicData, support = 0.1,confidence = 0.8, lift = 1) ## End(Not run)
Calculating drug-disease similarity based on biological descriptors
score_sim(BioDescr, method = "jaccard", n = 1000)
score_sim(BioDescr, method = "jaccard", n = 1000)
BioDescr |
BioDescr object. |
method |
method to compute similarity, default "jaccard". See |
n |
number. |
A list.
Yuanlong Hu
## Not run: data(drugdemo) drug_herb <- PrepareData(drugdemo$drug_herb, from = "drug", to="herb") herb_compound <- PrepareData(drugdemo$herb_compound, from = "herb", to="compound") compound_target <- PrepareData(drugdemo$compound_target, from = "compound", to="target") disease <- PrepareData(drugdemo$disease, diseaseID = "disease",from = "target", to="target") BasicData <- CreateBasicData(drug_herb, herb_compound, compound_target, diseasenet = disease) biodescr <- extr_biodescr(BasicData, geneset= "kegg") res <- score_sim(biodescr, method="jaccard", n=1000) ## End(Not run)
## Not run: data(drugdemo) drug_herb <- PrepareData(drugdemo$drug_herb, from = "drug", to="herb") herb_compound <- PrepareData(drugdemo$herb_compound, from = "herb", to="compound") compound_target <- PrepareData(drugdemo$compound_target, from = "compound", to="target") disease <- PrepareData(drugdemo$disease, diseaseID = "disease",from = "target", to="target") BasicData <- CreateBasicData(drug_herb, herb_compound, compound_target, diseasenet = disease) biodescr <- extr_biodescr(BasicData, geneset= "kegg") res <- score_sim(biodescr, method="jaccard", n=1000) ## End(Not run)
Convert BioDescr object to a list of adjacency matrix
to_biodescr(BioDescr)
to_biodescr(BioDescr)
BioDescr |
A BioDescr object. |
A list.
Yuanlong Hu
## Not run: to_biodescr(BioDescr) ## End(Not run)
## Not run: to_biodescr(BioDescr) ## End(Not run)
Convert list to data.frame
to_df(list)
to_df(list)
list |
A list containing gene sets. |
A data frame.
Yuanlong Hu
## Not run: to_df(list) ## End(Not run)
## Not run: to_df(list) ## End(Not run)
Create a new list from a data.frame of drug target and disease biomarker as input
to_list(dataframe, input = "single", sep = ", ")
to_list(dataframe, input = "single", sep = ", ")
dataframe |
a data frame of 2 column with term/drug and gene |
input |
one of the single or basket |
sep |
When 'input' is 'basket'. |
list
Yuanlong Hu
## Not run: to_list(dataframe) ## End(Not run)
## Not run: to_list(dataframe) ## End(Not run)
prints data frame to a gmt file
write_gmt(geneset, gmt_file)
write_gmt(geneset, gmt_file)
geneset |
A data.frame of 2 column with term/drug and gene. |
gmt_file |
A character of gmt file name. |
gmt file
Yuanlong Hu