forked from galerp/hpo_sim_gene
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhpo_dee_sim.R
79 lines (60 loc) · 2.73 KB
/
hpo_dee_sim.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
library(tidyverse)
library(memoise)
if(file.exists("input.yml") == T){
input.yaml <- yaml::read_yaml("input.yml")
}else{
message('\n Input YAML not found. Please Save the TAML file in current Directory \n')
break;
}
if(is.null(input.yaml$output_dir) == T){
message('\n Please mention the Field output_dir in input config file - Cant Proceed without that \n')
break;
}
if(is.null(input.yaml$patient_phenome) == F){
exp321 <- read_csv(input.yaml$patient_phenome)
}else{
message('\n Please mention the Patient Phenome File in the specified format - Cant Proceed without that \n')
break;
}
if(is.null(input.yaml$hpo_tree) == F){
allHPOs <- read_csv(input.yaml$hpo_tree)
}else{
message('\n Please mention the HPO tree File (Should be able to get it from here "link to be added")- Cant Proceed without that \n')
break;
}
if(is.null(input.yaml$hpo_ancestor) == F){
hpo_ancs <- read_csv(input.yaml$hpo_ancestor)
}else{
message('\n Please mention the HPO Ancestor File (Should be able to get it from here "link to be added")- Cant Proceed without that \n')
break;
}
options(stringsAsFactors = F)
if(is.null(input.yaml$hpo_path) == F){
path <- read_csv(input.yaml$hpo_path)
}else{
message('\n Please mention the HPO Path File (Should be able to get it from here "link to be added")- Cant Proceed without that \n')
break;
}
if(is.null(input.yaml$variant_file) == F){
variant <- read_csv(input.yaml$variant_file)
}else{
message('\n Please mention the Variants File in the specified format - Cant Proceed without that \n')
break;
}
if( is.null(input.yaml$local_IC)) {
message("\n The minimum required input files were read. The program will run entirely, generating these files : computing the Information Content, Similarity Matrix and Permutation Analysis \n \n ")
source("hpo_dist.R")
} else if(is.null(input.yaml$sim_matrix)) {
message("\n The minimum required input files along with the Local_IC, hpo_base and hpo_prop were read. The program will only run the steps for generating these files : computing Similarity Matrix and Permutation Analysis \n \n ")
local_IC <- read_csv(input.yaml$local_IC)
pat_table_base <- read_csv(input.yaml$patient_hpo_base)
pat_table_prop <- read_csv(input.yaml$patient_hpo_prop)
source("precalc_IC.R")
} else {
message("\n The minimum required input files along with the Local_IC, hpo_base, hpo_prop and sim_matrix were read. The program will only run the steps for generating the files from Permutation Analysis \n \n ")
local_IC <- read_csv(input.yaml$local_IC)
pat_table_base <- read_csv(input.yaml$patient_hpo_base)
pat_table_prop <- read_csv(input.yaml$patient_hpo_prop)
sim_score <- read.csv(input.yaml$sim_matrix, row.names = 1)
source("precalc_sim_matrix.R")
}