# High-level function to get the *FULL* HPO annotation matrix (i.e. labels matrix) w.r.t. a given weighted adiacency matrix # Input: # anc.file.name: name of the list of ancestors to load (without rda extension). # It must be an rda file containing for each node the list of all its ancestor (def: anc.name) # anc.dir: relative path to directory where the ancestor file is stored (def: anc.dir) # net : name of the dataset to load (without rda extension). It must be an .rda file containing the weighted adjiacency matrix of the graph. (def: net) # net.dir: relative path to directory where the weighted adjiacency matrix is stored (def: net.dir) # ann.file.name: # ann.dir: # output.name : name of the output file without rda extension (def: output.name) # output.dir: relative path to directory where the final HPO annotation matrix is stored (def: output) # Output: # a matrix with annotations gene-phenotype stored in an .rda file in "/output" directory. # Rows correspond to genes and columns to phenotpyes. Let's denote "hpo.ann" the annotation matrix, the entries hpo.ann[i,j] # correspond to the i-th gene and j-th phenotype. hpo.ann[i,j]=1 means that gene i is annotated with phenotype j, O otherwise. Do.full.HPO.annotation.matrix <- function(anc.file.name=anc.file.name, anc.dir="/anc.dir" ,net=net, net.dir="/net.dir", ann.file.name=ann.file.name, ann.dir="/ann.dir", output.name=output.name, output.dir="/output"){ ## loading list of ancestors anc.path <- paste0(anc.dir, anc.file.name, ".rda"); anc.name <- load(anc.path); anc <- eval(parse(text=anc.name)); ## loading wadj matrix net.path <- paste0(net.dir, net, ".rda"); net.name <- load(net.path); W <- eval(parse(text=net.name)); ## loading the specific annotation matrix ann.path <- paste0(ann.dir, ann.file.name, ".rda"); ann.name <- load(ann.path); ann.spec <- eval(parse(text=ann.name)); ## costruction of full HPO annotation matrix hpo.ann <- full.annotation.matrix(W=W, anc=anc, ann.spec=ann.spec); ## saving labels matrix hpo.ann.file <- paste0(output.dir, output.name, ".rda"); save(hpo.ann, file=hpo.ann.file, compress=TRUE); }