Function to predict ontology terms given domain architectures (including individual domains)


dcAlgoPredict is supposed to predict ontology terms given domain architectures (including individual domains). It involves 3 steps: 1) splitting an architecture into individual domains and all possible consecutive domain combinations (viewed as component features); 2) merging hscores among component features; 3) scaling merged hscores into predictive scores across terms.


dcAlgoPredict(data, RData.HIS = c(NA, "Feature2GOBP.sf", "Feature2GOMF.sf", "Feature2GOCC.sf", 
  "Feature2HPPA.sf", "Feature2GOBP.pfam", "Feature2GOMF.pfam", "Feature2GOCC.pfam", 
      "Feature2HPPA.pfam", "Feature2GOBP.interpro", "Feature2GOMF.interpro", "Feature2GOCC.interpro", 
      "Feature2HPPA.interpro"), merge.method = c("sum", "max", "sequential"), scale.method = c("log", 
      "linear", "none"), feature.mode = c("supra", "individual", "comb"), slim.level = NULL, 
      max.num = NULL, parallel = TRUE, multicores = NULL, verbose = T, RData.HIS.customised = NULL, 
      RData.location = "")


an input data vector containing domain architectures. An architecture is represented in the form of comma-separated domains
RData to load. This RData conveys two bits of information: 1) feature (domain) type; 2) ontology. It stores the hypergeometric scores (hscore) between features (individual domains or consecutive domain combinations) and ontology terms. The RData name tells which domain type and which ontology to use. It can be: SCOP sf domains/combinations (including "Feature2GOBP.sf", "Feature2GOMF.sf", "Feature2GOCC.sf", "Feature2HPPA.sf"), Pfam domains/combinations (including "Feature2GOBP.pfam", "Feature2GOMF.pfam", "Feature2GOCC.pfam", "Feature2HPPA.pfam"), InterPro domains (including "Feature2GOBP.interpro", "Feature2GOMF.interpro", "Feature2GOCC.interpro", "Feature2HPPA.interpro"). If NA, then the user has to input a customised RData-formatted file (see RData.HIS.customised below)
the method used to merge predictions for each component feature (individual domains and their combinations derived from domain architecture). It can be one of "sum" for summing up, "max" for the maximum, and "sequential" for the sequential weighting. The sequential weighting is done via: \sum_{i=1}{\frac{R_{i}}{i}}, where R_{i} is the i^{th} ranked highest hscore
the method used to scale the predictive scores. It can be: "none" for no scaling, "linear" for being linearily scaled into the range between 0 and 1, "log" for the same as "linear" but being first log-transformed before being scaled. The scaling between 0 and 1 is done via: \frac{S - S_{min}}{S_{max} - S_{min}}, where S_{min} and S_{max} are the minimum and maximum values for S
the mode of how to define the features thereof. It can be: "supra" for combinations of one or two successive domains (including individual domains; considering the order), "individual" for individual domains only, and "comb" for all possible combinations (including individual domains; ignoring the order)
whether only slim terms are returned. By defaut, it is NULL and all predicted terms will be reported. If it is specified as a vector containing any values from 1 to 4, then only slim terms at these levels will be reported. Here is the meaning of these values: '1' for very general terms, '2' for general terms, '3' for specific terms, and '4' for very specific terms
whether only top terms per sequence are returned. By defaut, it is NULL and no constraint is imposed. If an integer is specified, then all predicted terms (with scores in a decreasing order) beyond this number will be discarded. Notably, this parameter works after the preceding parameter slim.level
logical to indicate whether parallel computation with multicores is used. By default, it sets to true, but not necessarily does so. Partly because parallel backends available will be system-specific (now only Linux or Mac OS). Also, it will depend on whether these two packages "foreach" and "doMC" have been installed. It can be installed via: source(""); biocLite(c("foreach","doMC")). If not yet installed, this option will be disabled
an integer to specify how many cores will be registered as the multicore parallel backend to the 'foreach' package. If NULL, it will use a half of cores available in a user's computer. This option only works when parallel computation is enabled
logical to indicate whether the messages will be displayed in the screen. By default, it sets to TRUE for display
a file name for RData-formatted file containing an object of S3 class 'HIS'. By default, it is NULL. It is only needed when the user wants to perform customised analysis. See dcAlgoPropagate on how this object is created
the characters to tell the location of built-in RData files. By default, it remotely locates at "" and "". For the user equipped with fast internet connection, this option can be just left as default. But it is always advisable to download these files locally. Especially when the user needs to run this function many times, there is no need to ask the function to remotely download every time (also it will unnecessarily increase the runtime). For examples, these files (as a whole or part of them) can be first downloaded into your current working directory, and then set this option as: RData.location=".". If RData to load is already part of package itself, this parameter can be ignored (since this function will try to load it via function data first). Here is the UNIX command for downloading all RData files (preserving the directory structure): wget -r -l2 -A "*.RData" -np -nH --cut-dirs=0 ""


a named list of architectures, each containing predictive scores




# 1) randomly generate 5 domains and/or domain architectures x <- dcRDataLoader(RData="Feature2GOMF.sf")
'Feature2GOMF.sf' (from has been loaded into the working environment
data <- sample(names(x$hscore), 5) # 2) get predictive scores of all predicted terms for this domain architecture ## using 'sequential' method (by default) pscore <- dcAlgoPredict(data=data, RData.HIS="Feature2GOMF.sf", parallel=FALSE)
Start at 2015-07-23 12:28:12 Load the HIS object 'Feature2GOMF.sf' (2015-07-23 12:28:12) ... 'Feature2GOMF.sf' (from has been loaded into the working environment Predictions for 5 architectures using 'sum' merge method, 'log' scale method and 'supra' feature mode (2015-07-23 12:28:13)... 1 out of 5 (2015-07-23 12:28:13) 2 out of 5 (2015-07-23 12:28:13) 3 out of 5 (2015-07-23 12:28:13) 4 out of 5 (2015-07-23 12:28:13) 5 out of 5 (2015-07-23 12:28:13) End at 2015-07-23 12:28:13 Runtime in total is: 1 secs
## using 'max' method pscore_max <- dcAlgoPredict(data=data, RData.HIS="Feature2GOMF.sf", merge.method="max", parallel=FALSE)
Start at 2015-07-23 12:28:13 Load the HIS object 'Feature2GOMF.sf' (2015-07-23 12:28:13) ... 'Feature2GOMF.sf' (from has been loaded into the working environment Predictions for 5 architectures using 'max' merge method, 'log' scale method and 'supra' feature mode (2015-07-23 12:28:14)... 1 out of 5 (2015-07-23 12:28:14) 2 out of 5 (2015-07-23 12:28:14) 3 out of 5 (2015-07-23 12:28:14) 4 out of 5 (2015-07-23 12:28:14) 5 out of 5 (2015-07-23 12:28:14) End at 2015-07-23 12:28:14 Runtime in total is: 1 secs
## using 'sum' method pscore_sum <- dcAlgoPredict(data=data, RData.HIS="Feature2GOMF.sf", merge.method="sum", parallel=FALSE)
Start at 2015-07-23 12:28:14 Load the HIS object 'Feature2GOMF.sf' (2015-07-23 12:28:14) ... 'Feature2GOMF.sf' (from has been loaded into the working environment Predictions for 5 architectures using 'sum' merge method, 'log' scale method and 'supra' feature mode (2015-07-23 12:28:15)... 1 out of 5 (2015-07-23 12:28:15) 2 out of 5 (2015-07-23 12:28:15) 3 out of 5 (2015-07-23 12:28:15) 4 out of 5 (2015-07-23 12:28:15) 5 out of 5 (2015-07-23 12:28:15) End at 2015-07-23 12:28:15 Runtime in total is: 1 secs
# 3) advanced usage ## a) focus on those terms at the 2nd level (general) pscore <- dcAlgoPredict(data=data, RData.HIS="Feature2GOMF.sf", slim.level=2, parallel=FALSE)
Start at 2015-07-23 12:28:15 Load the HIS object 'Feature2GOMF.sf' (2015-07-23 12:28:15) ... 'Feature2GOMF.sf' (from has been loaded into the working environment Predictions for 5 architectures using 'sum' merge method, 'log' scale method and 'supra' feature mode (2015-07-23 12:28:16)... 1 out of 5 (2015-07-23 12:28:16) 2 out of 5 (2015-07-23 12:28:16) 3 out of 5 (2015-07-23 12:28:16) 4 out of 5 (2015-07-23 12:28:16) 5 out of 5 (2015-07-23 12:28:16) Focus on predicted terms at '2' slim level(s) End at 2015-07-23 12:28:16 Runtime in total is: 1 secs
## b) visualise predictive scores in the ontology hierarchy ### load the ontology g <- dcRDataLoader("onto.GOMF", verbose=FALSE) ig <- dcConverter(g, from='Onto', to='igraph', verbose=FALSE) ### do visualisation for the 1st architecture data <- pscore[[1]] subg <- dnet::dDAGinduce(ig, nodes_query=names(data), path.mode="shortest_paths") dnet::visDAG(g=subg, data=data,"term_id")