Function to apply dcGO algorithm to infer domain-centric ontology

Description

dcAlgo is supposed to apply dcGO algorithm to infer domain-centric ontology from input files. It requires two input files: 1) an annotation file containing annotations between proteins/genes and ontology terms; 2) an architecture file containing domain architectures for proteins/genes.

Usage

dcAlgo(anno.file, architecture.file, output.file = NULL, ontology = c(NA, "GOBP", 
  "GOMF", "GOCC", "DO", "HPPA", "HPMI", "HPON", "MP", "EC", "KW", "UP"), feature.mode = c("supra", 
      "individual", "comb"), min.overlap = 3, fdr.cutoff = 0.001, hscore.type = c("zscore", 
      "fdr"), parallel = TRUE, multicores = NULL, verbose = T, RData.ontology.customised = NULL, 
      RData.location = "https://github.com/hfang-bristol/RDataCentre/blob/master/dcGOR")

Arguments

anno.file
an annotation file containing annotations between proteins/genes and ontology terms. For example, a file containing annotations between human genes and HP terms can be found in http://dcgor.r-forge.r-project.org/data/Algo/HP_anno.txt. As seen in this example, the input file must contain the header (in the first row) and two columns: 1st column for 'SeqID' (actually these IDs can be anything), 2nd column for 'termID' (HP terms). Note: the file should use the tab delimiter as the field separator between columns
architecture.file
an architecture file containing domain architectures (including individual domains) for proteins/genes. For example, a file containing human genes and domain architectures can be found in http://dcgor.r-forge.r-project.org/data/Algo/SCOP_architecture.txt. As seen in this example, the input file must contain the header (in the first row) and two columns: 1st column for 'SeqID' (actually these IDs can be anything), 2nd column for 'Architecture' (SCOP domain architectures, each represented as comma-separated domains). Note: the file should use the tab delimiter as the field separator between columns
output.file
an output file containing results. If not NULL, a tab-delimited text file will be also written out, with 1st column 'Feature_id' for features/domains, 2nd column 'Term_id' for ontology terms, 3rd column 'Score' for hypergeometric scores (indicative of strength for feature-term associations). Otherwise, there is no output file (by default)
ontology
the ontology identity. It can be "GOBP" for Gene Ontology Biological Process, "GOMF" for Gene Ontology Molecular Function, "GOCC" for Gene Ontology Cellular Component, "DO" for Disease Ontology, "HPPA" for Human Phenotype Phenotypic Abnormality, "HPMI" for Human Phenotype Mode of Inheritance, "HPON" for Human Phenotype ONset and clinical course, "MP" for Mammalian Phenotype, "EC" for Enzyme Commission, "KW" for UniProtKB KeyWords, "UP" for UniProtKB UniPathway. For details on the eligibility for pairs of input domain and ontology, please refer to the online Documentations at http://supfam.org/dcGOR/docs.html. If NA, then the user has to input a customised RData-formatted file (see RData.ontology.customised below)
feature.mode
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)
min.overlap
the minimum number of overlaps with each term in consideration. By default, it sets to a minimum of 3
fdr.cutoff
the fdr cutoff to call the significant associations between features and terms. By default, it sets to 1e-3
hscore.type
the type of defining the hypergeometric score. It can be: "zscore" for z-score (by default), "fdr" for fdr (after being transformed via -1*log_2(fdr))
parallel
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("http://bioconductor.org/biocLite.R"); biocLite(c("foreach","doMC")). If not yet installed, this option will be disabled
multicores
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
verbose
logical to indicate whether the messages will be displayed in the screen. By default, it sets to TRUE for display
RData.ontology.customised
a file name for RData-formatted file containing an object of S4 class 'Onto' (i.g. ontology). By default, it is NULL. It is only needed when the user wants to perform customised analysis using their own ontology. See dcBuildOnto for how to creat this object
RData.location
the characters to tell the location of built-in RData files. By default, it remotely locates at "https://github.com/hfang-bristol/RDataCentre/blob/master/dcGOR" and "http://dcgor.r-forge.r-project.org/data". 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 "http://dcgor.r-forge.r-project.org/data"

Value

a data frame containing three columns: 1st column 'Feature_id' for features, 2nd 'Term_id' for terms, and 3rd 'Score' for the hypergeometric score indicative of strength of associations beteen features and terms

Note

When 'output.file' is specified, a tab-delimited text file is output, with the column names: 1st column 'Feature_id' for features, 2nd 'Term_id' for terms, and 3rd 'Score' for the hypergeometric score indicative of strength of associations beteen features and terms

Examples

# 1) Prepare input file: anno.file and architecture.file anno.file <- "http://dcgor.r-forge.r-project.org/data/Algo/HP_anno.txt" architecture.file <- "http://dcgor.r-forge.r-project.org/data/Algo/SCOP_architecture.txt" # 2) Do inference using built-in ontology res <- dcAlgo(anno.file, architecture.file, ontology="HPPA", feature.mode="supra", parallel=FALSE)
Start at 2015-07-23 12:25:16 First, load the ontology 'HPPA' (2015-07-23 12:25:16) ... 'onto.HPPA' (from package 'dcGOR' version 1.0.5) has been loaded into the working environment Second, import files for annotations 'http://dcgor.r-forge.r-project.org/data/Algo/HP_anno.txt' and architectures 'http://dcgor.r-forge.r-project.org/data/Algo/SCOP_architecture.txt' (2015-07-23 12:25:16) ... Third, propagate annotations (2015-07-23 12:25:17) ... At level 16, there are 2 nodes, and 5 incoming neighbors. At level 15, there are 7 nodes, and 9 incoming neighbors. At level 14, there are 21 nodes, and 42 incoming neighbors. At level 13, there are 54 nodes, and 82 incoming neighbors. At level 12, there are 105 nodes, and 105 incoming neighbors. At level 11, there are 274 nodes, and 188 incoming neighbors. At level 10, there are 463 nodes, and 294 incoming neighbors. At level 9, there are 782 nodes, and 441 incoming neighbors. At level 8, there are 1004 nodes, and 538 incoming neighbors. At level 7, there are 1182 nodes, and 581 incoming neighbors. At level 6, there are 1295 nodes, and 527 incoming neighbors. At level 5, there are 940 nodes, and 290 incoming neighbors. At level 4, there are 408 nodes, and 99 incoming neighbors. At level 3, there are 114 nodes, and 21 incoming neighbors. At level 2, there are 21 nodes, and 1 incoming neighbors. At level 1, there are 1 nodes, and 0 incoming neighbors. There are 6673 terms used (2015-07-23 12:26:26). Fourth, define groups using feature mode 'supra' (2015-07-23 12:26:26) ... i) split into features (2015-07-23 12:26:26) ... 1 out of 4351 (2015-07-23 12:26:26) 436 out of 4351 (2015-07-23 12:26:27) 872 out of 4351 (2015-07-23 12:26:27) 1308 out of 4351 (2015-07-23 12:26:27) 1744 out of 4351 (2015-07-23 12:26:28) 2180 out of 4351 (2015-07-23 12:26:28) 2616 out of 4351 (2015-07-23 12:26:28) 3052 out of 4351 (2015-07-23 12:26:28) 3488 out of 4351 (2015-07-23 12:26:29) 3924 out of 4351 (2015-07-23 12:26:29) 4351 out of 4351 (2015-07-23 12:26:29) ii) obtain feature-based groups (2015-07-23 12:26:29) ... 1 out of 4351 (2015-07-23 12:26:29) 436 out of 4351 (2015-07-23 12:26:29) 872 out of 4351 (2015-07-23 12:26:29) 1308 out of 4351 (2015-07-23 12:26:29) 1744 out of 4351 (2015-07-23 12:26:29) 2180 out of 4351 (2015-07-23 12:26:29) 2616 out of 4351 (2015-07-23 12:26:29) 3052 out of 4351 (2015-07-23 12:26:29) 3488 out of 4351 (2015-07-23 12:26:29) 3924 out of 4351 (2015-07-23 12:26:29) 4351 out of 4351 (2015-07-23 12:26:29) There are 2194 features used (2015-07-23 12:26:29). Finally, estimate associations between 2194 features and 6673 terms, with 3 min overlaps and 1.0e-03 fdr cutoff (2015-07-23 12:26:29) ... 1 out of 2194 (2015-07-23 12:26:32) 220 out of 2194 (2015-07-23 12:26:33) 440 out of 2194 (2015-07-23 12:26:34) 660 out of 2194 (2015-07-23 12:26:35) 880 out of 2194 (2015-07-23 12:26:36) 1100 out of 2194 (2015-07-23 12:26:37) 1320 out of 2194 (2015-07-23 12:26:38) 1540 out of 2194 (2015-07-23 12:26:39) 1760 out of 2194 (2015-07-23 12:26:39) 1980 out of 2194 (2015-07-23 12:26:40) 2194 out of 2194 (2015-07-23 12:26:41) End at 2015-07-23 12:26:41 Runtime in total is: 85 secs
res[1:5,]
Feature_id Term_id Score 1 100895 HP:0004295 5.00 2 103025 HP:0001939 2.00 3 103025 HP:0003011 2.00 4 103025 HP:0011804 0.71 5 103473 HP:0004352 1.40
# 3) Advanced usage: using customised ontology x <- base::load(base::url("http://dcgor.r-forge.r-project.org/data/onto.HPPA.RData"))
Error: the input does not start with a magic number compatible with loading from a connection
RData.ontology.customised <- 'onto.HPPA.RData' base::save(list=x, file=RData.ontology.customised)
Error in base::save(list = x, file = RData.ontology.customised): object 'x' not found
#list.files(pattern='*.RData') ## you will see an RData file 'onto.HPPA.RData' in local directory res <- dcAlgo(anno.file, architecture.file, feature.mode="supra", parallel=FALSE, RData.ontology.customised=RData.ontology.customised)
Start at 2015-07-23 12:26:41 First, load customised ontology 'onto.HPPA.RData' (2015-07-23 12:26:41)... Second, import files for annotations 'http://dcgor.r-forge.r-project.org/data/Algo/HP_anno.txt' and architectures 'http://dcgor.r-forge.r-project.org/data/Algo/SCOP_architecture.txt' (2015-07-23 12:26:42) ... Third, propagate annotations (2015-07-23 12:26:42) ... At level 16, there are 2 nodes, and 5 incoming neighbors. At level 15, there are 7 nodes, and 9 incoming neighbors. At level 14, there are 21 nodes, and 42 incoming neighbors. At level 13, there are 54 nodes, and 82 incoming neighbors. At level 12, there are 105 nodes, and 105 incoming neighbors. At level 11, there are 274 nodes, and 188 incoming neighbors. At level 10, there are 463 nodes, and 294 incoming neighbors. At level 9, there are 782 nodes, and 441 incoming neighbors. At level 8, there are 1004 nodes, and 538 incoming neighbors. At level 7, there are 1182 nodes, and 581 incoming neighbors. At level 6, there are 1295 nodes, and 527 incoming neighbors. At level 5, there are 940 nodes, and 290 incoming neighbors. At level 4, there are 408 nodes, and 99 incoming neighbors. At level 3, there are 114 nodes, and 21 incoming neighbors. At level 2, there are 21 nodes, and 1 incoming neighbors. At level 1, there are 1 nodes, and 0 incoming neighbors. There are 6673 terms used (2015-07-23 12:27:53). Fourth, define groups using feature mode 'supra' (2015-07-23 12:27:53) ... i) split into features (2015-07-23 12:27:53) ... 1 out of 4351 (2015-07-23 12:27:53) 436 out of 4351 (2015-07-23 12:27:53) 872 out of 4351 (2015-07-23 12:27:54) 1308 out of 4351 (2015-07-23 12:27:54) 1744 out of 4351 (2015-07-23 12:27:54) 2180 out of 4351 (2015-07-23 12:27:55) 2616 out of 4351 (2015-07-23 12:27:55) 3052 out of 4351 (2015-07-23 12:27:55) 3488 out of 4351 (2015-07-23 12:27:56) 3924 out of 4351 (2015-07-23 12:27:56) 4351 out of 4351 (2015-07-23 12:27:56) ii) obtain feature-based groups (2015-07-23 12:27:56) ... 1 out of 4351 (2015-07-23 12:27:56) 436 out of 4351 (2015-07-23 12:27:56) 872 out of 4351 (2015-07-23 12:27:56) 1308 out of 4351 (2015-07-23 12:27:56) 1744 out of 4351 (2015-07-23 12:27:56) 2180 out of 4351 (2015-07-23 12:27:56) 2616 out of 4351 (2015-07-23 12:27:56) 3052 out of 4351 (2015-07-23 12:27:56) 3488 out of 4351 (2015-07-23 12:27:56) 3924 out of 4351 (2015-07-23 12:27:56) 4351 out of 4351 (2015-07-23 12:27:56) There are 2194 features used (2015-07-23 12:27:56). Finally, estimate associations between 2194 features and 6673 terms, with 3 min overlaps and 1.0e-03 fdr cutoff (2015-07-23 12:27:56) ... 1 out of 2194 (2015-07-23 12:27:59) 220 out of 2194 (2015-07-23 12:28:00) 440 out of 2194 (2015-07-23 12:28:02) 660 out of 2194 (2015-07-23 12:28:02) 880 out of 2194 (2015-07-23 12:28:03) 1100 out of 2194 (2015-07-23 12:28:04) 1320 out of 2194 (2015-07-23 12:28:05) 1540 out of 2194 (2015-07-23 12:28:06) 1760 out of 2194 (2015-07-23 12:28:07) 1980 out of 2194 (2015-07-23 12:28:08) 2194 out of 2194 (2015-07-23 12:28:09) End at 2015-07-23 12:28:09 Runtime in total is: 88 secs
res[1:5,]
Feature_id Term_id Score 1 100895 HP:0004295 5.00 2 103025 HP:0001939 2.00 3 103025 HP:0003011 2.00 4 103025 HP:0011804 0.71 5 103473 HP:0004352 1.40