Commit 6f8419f1 authored by Raghvendra Mall's avatar Raghvendra Mall

Latest RGBM version

parent 96de8b87
This diff is collapsed.
auto_roxygenize_for_build_and_reload="0"
auto_roxygenize_for_build_package="1"
auto_roxygenize_for_check="1"
live_preview_website="1"
makefile_args=""
preview_website="1"
website_output_format="all"
{
"args" : [
"-I/usr/lib/rstudio/resources/libclang/builtin-headers/3.5",
"-I/usr/lib/rstudio/resources/libclang/builtin-headers/libc++/3.5",
"-I/usr/share/R/include",
"-DNDEBUG",
"-fpic",
"-fstack-protector-strong",
"-D_FORTIFY_SOURCE=2"
],
"hash" : "1494155054",
"is_cpp" : true,
"pch" : ""
}
\ No newline at end of file
This diff is collapsed.
{
"debugBreakpointsState" : {
"breakpoints" : [
{
"editor_line_number" : 93,
"editor_state" : 1,
"function_name" : "toplevel",
"function_steps" : "",
"id" : 0,
"is_package_breakpoint" : false,
"is_pending_debug_completion" : false,
"line_number" : 93,
"needs_updated_steps" : false,
"package_name" : "",
"path" : "~/QCRI_PostDoc/Michelle_Related/Michele_Glioma/gboostnet/RGBM-master/my_scripts/Simulated_Experiment_Scripts/meta_gbm_dream3.R",
"state" : 1,
"type" : 1
}
]
}
}
\ No newline at end of file
{
"path" : "~/QCRI_PostDoc/Michelle_Related/Michele_Glioma/gboostnet/RGBM-master/my_scripts/Simulated_Experiment_Scripts",
"sortOrder" : [
{
"ascending" : true,
"columnIndex" : 2
}
]
}
\ No newline at end of file
{
"activeTab" : 1
}
\ No newline at end of file
{
"left" : {
"panelheight" : 681,
"splitterpos" : 287,
"topwindowstate" : "NORMAL",
"windowheight" : 719
},
"right" : {
"panelheight" : 681,
"splitterpos" : 431,
"topwindowstate" : "NORMAL",
"windowheight" : 719
}
}
\ No newline at end of file
{
"TabSet1" : 2,
"TabSet2" : 0,
"TabZoom" : {
}
}
\ No newline at end of file
build-last-errors="[]"
build-last-errors-base-dir="~/QCRI_PostDoc/Michelle_Related/Michele_Glioma/gboostnet/RGBM-master/RGBM/"
build-last-outputs="[{\"output\":\"==> R CMD INSTALL --preclean --no-multiarch --with-keep.source RGBM\\n\\n\",\"type\":0},{\"output\":\"files ‘DESCRIPTION’, ‘R/proposed_steps.R’ have the wrong MD5 checksums\\n\",\"type\":1},{\"output\":\"gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c R_init_RGBM.c -o R_init_RGBM.o\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"* installing to library ‘/home/rmall/R/x86_64-pc-linux-gnu-library/3.3’\\n\",\"type\":1},{\"output\":\"* installing *source* package ‘RGBM’ ...\\n\",\"type\":1},{\"output\":\"** libs\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c pcg_basic.c -o pcg_basic.o\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"g++ -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c solver_test.cpp -o solver_test.o\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"g++ -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c test_regression_stump.cpp -o test_regression_stump.o\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"g++ -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c test_regression_stump_R.cpp -o test_regression_stump_R.o\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"g++ -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c train_regression_stump.cpp -o train_regression_stump.o\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"g++ -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c train_regression_stump_R.cpp -o train_regression_stump_R.o\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"g++ -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o RGBM.so R_init_RGBM.o pcg_basic.o solver_test.o test_regression_stump.o test_regression_stump_R.o train_regression_stump.o train_regression_stump_R.o -L/usr/lib/R/lib -lR\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"installing to /home/rmall/R/x86_64-pc-linux-gnu-library/3.3/RGBM/libs\\n\",\"type\":1},{\"output\":\"** R\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"** preparing package for lazy loading\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"** help\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"*** installing help indices\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"** building package indices\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"** testing if installed package can be loaded\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"* DONE (RGBM)\\n\",\"type\":1},{\"output\":\"\",\"type\":1}]"
compile_pdf_state="{\"errors\":[],\"output\":\"\",\"running\":false,\"tab_visible\":false,\"target_file\":\"\"}"
console_procs="[]"
files.monitored-path="~/QCRI_PostDoc/Michelle_Related/Michele_Glioma/gboostnet/RGBM-master/my_scripts/Simulated_Experiment_Scripts"
find-in-files-state="{\"handle\":\"\",\"input\":\"\",\"path\":\"\",\"regex\":true,\"results\":{\"file\":[],\"line\":[],\"lineValue\":[],\"matchOff\":[],\"matchOn\":[]},\"running\":false}"
imageDirtyState="1"
saveActionState="-1"
{"active_set":"","sets":[]}
\ No newline at end of file
{
}
\ No newline at end of file
{
}
\ No newline at end of file
{
}
\ No newline at end of file
~%2FQCRI_PostDoc%2FMichelle_Related%2FMichele_Glioma%2Fgboostnet%2FRGBM-master%2FRGBM%2FR%2Fproposed_steps.R="C99E9405"
~%2FQCRI_PostDoc%2FMichelle_Related%2FMichele_Glioma%2Fgboostnet%2FRGBM-master%2Fmy_scripts%2FSimulated_Experiment_Scripts%2Fmeta_gbm_dream3.R="E0443CE6"
~%2FQCRI_PostDoc%2FMichelle_Related%2FMichele_Glioma%2Fgboostnet%2FRGBM-master%2Fmy_scripts%2Fdemoscript.R="498E7ED6"
This diff is collapsed.
{
"collab_server" : "",
"contents" : "library(RGBM)\nlibrary(doMC)\nrequire(ROCR)\nlibrary(PRROC)\nlibrary(tseries)\nlibrary(data.table)\nlibrary(foreach)\nlibrary(doParallel)\nregisterDoParallel(4)\nsetwd('~/QCRI_PostDoc/Michelle_Related/Michele_Glioma/gboostnet/')\n\n#debugSource(\"RGBM-master/RGBM/R/RGBM.R\")\n#debugSource(\"RGBM-master/RGBM/R/proposed_steps.R\")\n\nfinal_aucroc <- c();\nfinal_aucpr <- c();\nno_rep <- 3;\nfor (k in 1:5)\n{\n file.data <- paste(\"../GRN_Inference/DREAM3_InSilico_Challenge/Size100/DREAM3_data/Network\",k,\"_mod_timeseries.tsv\",sep=\"\")\n #Knockout expression is the most useful one\n file.knockout <- paste(\"../GRN_Inference/DREAM3_InSilico_Challenge/Size100/DREAM3_data/Network\",k,\"_KO.tsv\",sep=\"\")\n file.knockdown <- paste(\"../GRN_Inference/DREAM3_InSilico_Challenge/Size100/DREAM3_data/Network\",k,\"_KD.tsv\",sep=\"\")\n \n #Get the data-frames \n #Time Series is worst source of information\n df_data <- read.table(file.data, header = TRUE);\n df_knockout <- read.table(file.knockout,header=TRUE);\n df_knockdown <- read.table(file.knockdown,header = TRUE);\n \n #Create the dataset E & K for knockout expression\n #dataset <- as.matrix(rbind(df_knockout[,(2:ncol(df_knockout))],df_knockdown[2:nrow(df_knockdown),2:ncol(df_knockdown)]))\n dataset <- as.matrix(df_knockout[,2:ncol(df_knockout)])\n N_ko <- ncol(df_knockout)-1;\n matrix_ko <- matrix(0, nrow = (nrow(df_knockout)-1),ncol = N_ko);\n matrix_data <- matrix(0,nrow = nrow(df_data),ncol=N_ko);\n diag(matrix_ko) <- 1;\n K_ko <- rbind(rep(0,N_ko),matrix_ko);\n gene_ids <- colnames(dataset);\n\n #Perform the RGBM procedure \n gene_ids <- colnames(dataset);\n outputpath <- 'DREAM_Results/DREAM3_Results/';\n g_M <- matrix(1,N_ko,N_ko);\n colnames(K_ko) <- gene_ids;\n rownames(g_M) <- gene_ids;\n colnames(g_M) <- gene_ids;\n \n #=====================================================================================\n #sf_seq <- seq(from = 0.0, to = 0.75, length.out = 20)\n sf_seq <- 0.0;\n aucroc_info <- c();\n aucpr_info <- c();\n for (l in 1:length(sf_seq))\n {\n sf <- sf_seq[l];\n aucpr_curve <- c();\n aucroc_curve <- c();\n for (iter in 1:10)\n {\n #RGBM step for different mink\n mink = ceiling(sf*N_ko);\n V <- RGBM(dataset,K_ko,g_M,gene_ids,gene_ids,M=5000,nu=0.001,s_f=0.3,lf=1,no_rep,mink=mink,experimentid = k,outputpath,\"DREAM3_\",real=0)\n \n file.goldstandard <- paste(\"../GRN_Inference/DREAM3_InSilico_Challenge/Size100/DREAM3_gold_standards/DREAM3_GoldStandard_InSilicoSize100_Network\",k,\".txt\",sep=\"\")\n df_goldstandard <- read.csv(file.goldstandard,header=FALSE,sep=\"\\t\");\n df_goldstandard[,1] <- as.character(as.vector(df_goldstandard[,1]))\n df_goldstandard[,2] <- as.character(as.vector(df_goldstandard[,2]))\n \n orderedlist <- c();\n for (i in 1:nrow(df_goldstandard))\n {\n val <- V[df_goldstandard[i,1],df_goldstandard[i,2]];\n orderedlist <- c(orderedlist,val);\n }\n \n #Calculate performance\n pred <- prediction(orderedlist,df_goldstandard[,3])\n perf=performance(pred,measure = \"tpr\",\"fpr\")\n roc_info <- performance(pred,measure = \"auc\")\n aucroc_curve <- c(aucroc_curve,roc_info@y.values[[1]]);\n \n pr_auc_info <- pr.curve(orderedlist,weights.class0 = df_goldstandard[,3],curve = T)\n aucpr_curve <- c(aucpr_curve,pr_auc_info$auc.integral);\n }\n mean_aucroc <- mean(aucroc_curve);\n std_aucroc <- sd(aucroc_curve);\n mean_aucpr <- mean(aucpr_curve);\n std_aucpr <- sd(aucpr_curve)\n aucroc_info <- rbind(aucroc_info,cbind(sf,mean_aucroc,std_aucroc));\n aucpr_info <- rbind(aucpr_info,cbind(sf,mean_aucpr,std_aucpr));\n }\n final_aucroc <- rbind(final_aucroc,cbind(rep(k,dim(aucroc_info)[1]),aucroc_info));\n final_aucpr <- rbind(final_aucpr,cbind(rep(k,dim(aucpr_info)[1]),aucpr_info));\n}\ndf_output <- cbind(final_aucroc,final_aucpr);\ndf_output <- as.data.frame(df_output);\n\nwrite.table(df_output,file=\"DREAM_Results/DREAM3_Results/Text_Results/Regularized_Feeback_L2_Revised_Results.csv\",col.names=T,row.names=F,quote=FALSE)\n\n# library(ggplot2)\n# \n# df_output$V1 <- as.factor(df_output$V1)\n# df_output$V4 <- as.factor(df_output$V5)\n# p <- ggplot(df_output, aes(x=sf, y=mean_aucroc)) + geom_line() + geom_point(shape=1) + facet_grid(V1 ~ .)\n# p <- p + theme(strip.background = element_rect(colour=\"red\", fill=\"#CCCCFF\",size=12))\n# p <- p + theme(axis.text.x = element_text(size=12), axis.text.y = element_text(size=12),\n# axis.title.x = element_text(size=14,face = \"bold\"), axis.title.y = element_text(size=14,face=\"bold\"))\n# p \n# ggsave(\"Results_ENNET/DREAM3_Results/Images/Regularized_Feeback_L2_ROC.pdf\",plot=p, device = \"pdf\",height = 10,width = 10)\n# \n# \n# p1 <- ggplot(df_output, aes(x=sf, y=mean_aucpr)) + geom_line() + geom_point(shape=1) + facet_grid(V1 ~ .)\n# p1 <- p1 + theme(strip.background = element_rect(colour=\"red\", fill=\"#CCCCFF\",size=12))\n# p1 <- p1 + theme(axis.text.x = element_text(size=12), axis.text.y = element_text(size=12),\n# axis.title.x = element_text(size=14,face = \"bold\"), axis.title.y = element_text(size=14,face=\"bold\"))\n# p1 \n# ggsave(\"Results_ENNET/DREAM3_Results/Images/Regularized_Feeback_L2_PR.pdf\",plot=p1, device = \"pdf\",height = 10,width = 10)\n",
"created" : 1494155680153.000,
"dirty" : false,
"encoding" : "UTF-8",
"folds" : "",
"hash" : "2047985686",
"id" : "88311BD5",
"lastKnownWriteTime" : 1494156035,
"last_content_update" : 1494156035339,
"path" : "~/QCRI_PostDoc/Michelle_Related/Michele_Glioma/gboostnet/RGBM-master/my_scripts/Simulated_Experiment_Scripts/meta_gbm_dream3.R",
"project_path" : null,
"properties" : {
},
"relative_order" : 2,
"source_on_save" : false,
"source_window" : "",
"type" : "r_source"
}
\ No newline at end of file
auto_roxygenize_for_build_and_reload="0"
auto_roxygenize_for_build_package="1"
auto_roxygenize_for_check="1"
makefile_args=""
{
"args" : [
"-I/usr/lib/rstudio-server/resources/libclang/builtin-headers/3.5",
"-I/usr/lib/rstudio-server/resources/libclang/builtin-headers/libc++/3.5",
"-I/usr/share/R/include",
"-DNDEBUG",
"-fpic",
"-fstack-protector",
"-D_FORTIFY_SOURCE=2"
],
"hash" : "1486881819",
"is_cpp" : true,
"pch" : ""
}
\ No newline at end of file
This diff is collapsed.
8b43e459-5f87-455e-8d79-28a6de131261
b9566f5a-37ef-438a-bec2-a16d3cce9de4:613,222
29537596-3d55-4310-811f-e70256838880:613,222
86a7ed76-cdf8-4990-b6a9-9a809573291c:613,222
6a305a9a-d093-4577-929f-2112855ed3e0:616,222
f12d93e1-e851-4e6c-9487-968c5989556f:616,222
956f0927-6a94-48f9-98b3-e7e55b552369:616,222
8b43e459-5f87-455e-8d79-28a6de131261:616,222
{
"debugBreakpointsState" : {
"breakpoints" : [
{
"editor_line_number" : 61,
"editor_state" : 1,
"function_name" : "toplevel",
"function_steps" : "",
"id" : 15,
"is_package_breakpoint" : false,
"is_pending_debug_completion" : false,
"line_number" : 61,
"needs_updated_steps" : false,
"package_name" : "",
"path" : "~/space/GRN_Inference/RGBM-master/my_scripts/Real_Experiment_Scripts/run_RGBM_SUVA.R",
"state" : 1,
"type" : 1
},
{
"editor_line_number" : 109,
"editor_state" : 1,
"function_name" : "RGBM",
"function_steps" : "21",
"id" : 16,
"is_package_breakpoint" : true,
"is_pending_debug_completion" : false,
"line_number" : 109,
"needs_updated_steps" : false,
"package_name" : "RGBM",
"path" : "/mnt3/raghvendra/GRN_Inference/RGBM-master/RGBM/R/RGBM.R",
"state" : 1,
"type" : 0
},
{
"editor_line_number" : 443,
"editor_state" : 1,
"function_name" : "regularized_GBM_step",
"function_steps" : "18",
"id" : 19,
"is_package_breakpoint" : true,
"is_pending_debug_completion" : false,
"line_number" : 443,
"needs_updated_steps" : false,
"package_name" : "RGBM",
"path" : "/mnt3/raghvendra/GRN_Inference/RGBM-master/RGBM/R/proposed_steps.R",
"state" : 1,
"type" : 0
},
{
"editor_line_number" : 77,
"editor_state" : 1,
"function_name" : "toplevel",
"function_steps" : "",
"id" : 21,
"is_package_breakpoint" : false,
"is_pending_debug_completion" : false,
"line_number" : 77,
"needs_updated_steps" : false,
"package_name" : "",
"path" : "~/space/GRN_Inference/RGBM-master/my_scripts/Simulated_Experiment_Scripts/meta_gbm_dream4.R",
"state" : 1,
"type" : 1
},
{
"editor_line_number" : 428,
"editor_state" : 1,
"function_name" : "regularized_GBM_step",
"function_steps" : "9",
"id" : 24,
"is_package_breakpoint" : true,
"is_pending_debug_completion" : false,
"line_number" : 428,
"needs_updated_steps" : false,
"package_name" : "RGBM",
"path" : "/mnt3/raghvendra/GRN_Inference/RGBM-master/RGBM/R/proposed_steps.R",
"state" : 1,
"type" : 0
}
]
}
}
\ No newline at end of file
{
"path" : "~/space/GRN_Inference/RGBM-master/RGBM/man",
"sortOrder" : [
{
"ascending" : true,
"columnIndex" : 2
}
]
}
\ No newline at end of file
{
"activeTab" : 0
}
\ No newline at end of file
{
"left" : {
"panelheight" : 606,
"splitterpos" : 276,
"topwindowstate" : "NORMAL",
"windowheight" : 677
},
"right" : {
"panelheight" : 606,
"splitterpos" : 275,
"topwindowstate" : "NORMAL",
"windowheight" : 677
}
}
\ No newline at end of file
{
"TabSet1" : 2,
"TabSet2" : 0
}
\ No newline at end of file
abend="1"
active-client-id="37c2ed68-04b7-4037-a1db-e641c6267738"
build-last-errors="[]"
build-last-errors-base-dir="~/space/GRN_Inference/RGBM-master/RGBM/"
build-last-outputs="[{\"output\":\"==> R CMD INSTALL --preclean --no-multiarch --with-keep.source RGBM\\n\\n\",\"type\":0},{\"output\":\"gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c R_init_RGBM.c -o R_init_RGBM.o\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"* installing to library ‘/home/raghvendra/R/x86_64-pc-linux-gnu-library/3.3’\\n\",\"type\":1},{\"output\":\"* installing *source* package ‘RGBM’ ...\\n\",\"type\":1},{\"output\":\"** libs\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c pcg_basic.c -o pcg_basic.o\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"g++ -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c solver_test.cpp -o solver_test.o\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"g++ -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c test_regression_stump.cpp -o test_regression_stump.o\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"g++ -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c test_regression_stump_R.cpp -o test_regression_stump_R.o\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"g++ -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c train_regression_stump.cpp -o train_regression_stump.o\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"g++ -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c train_regression_stump_R.cpp -o train_regression_stump_R.o\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"g++ -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o RGBM.so R_init_RGBM.o pcg_basic.o solver_test.o test_regression_stump.o test_regression_stump_R.o train_regression_stump.o train_regression_stump_R.o -L/usr/lib/R/lib -lR\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"installing to /home/raghvendra/R/x86_64-pc-linux-gnu-library/3.3/RGBM/libs\\n\",\"type\":1},{\"output\":\"** R\\n\",\"type\":1},{\"output\":\"** preparing package for lazy loading\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"** help\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"*** installing help indices\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"** building package indices\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"** testing if installed package can be loaded\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"* DONE (RGBM)\\n\",\"type\":1},{\"output\":\"\",\"type\":1}]"
compile_pdf_state="{\"errors\":[],\"output\":\"\",\"running\":false,\"tab_visible\":false,\"target_file\":\"\"}"
console_procs="[]"
files.monitored-path=""
find-in-files-state="{\"handle\":\"\",\"input\":\"\",\"path\":\"\",\"regex\":true,\"results\":{\"file\":[],\"line\":[],\"lineValue\":[],\"matchOff\":[],\"matchOn\":[]},\"running\":false}"
imageDirtyState="1"
saveActionState="-1"
{"active_set":"","sets":[]}
\ No newline at end of file
{
"contents" : "library(RGBM)\nlibrary(doMC)\nrequire(ROCR)\nlibrary(PRROC)\nlibrary(tseries)\nlibrary(data.table)\nlibrary(foreach)\nlibrary(doParallel)\nregisterDoParallel(20)\nsetwd('/home/raghvendra/space/GRN_Inference/')\n\nfinal_aucroc <- c();\nfinal_aucpr <- c();\nno_iterations <- 10;\nfor (k in 1:5)\n{\n \n #Initialize\n file.perturbations <- paste(\"Supplementary information/insilico_size100_\",k,\"/Perturbations/insilico_size100_\",k,\"_timeseries_perturbations.tsv\",sep=\"\");\n file.data <- paste(\"../GRN_Inference/DREAM4_InSilico_Size100/insilico_size100_\",k,\"/insilico_size100_\",k,\"_mod_timeseries.tsv\",sep=\"\")\n file.knockout <- paste(\"../GRN_Inference/DREAM4_InSilico_Size100/insilico_size100_\",k,\"/insilico_size100_\",k,\"_knockouts.tsv\",sep=\"\")\n file.knockdown <- paste(\"../GRN_Inference/DREAM4_InSilico_Size100/insilico_size100_\",k,\"/insilico_size100_\",k,\"_knockdowns.tsv\",sep=\"\")\n file.wildtype <- paste(\"../GRN_Inference/DREAM4_InSilico_Size100/insilico_size100_\",k,\"/insilico_size100_\",k,\"_wildtype.tsv\",sep=\"\")\n \n #Get the data-frames \n df_data <- read.table(file.data, header = TRUE);\n df_knockout <- read.table(file.knockout,header=TRUE);\n df_knockdown <- read.table(file.knockdown,header = TRUE);\n df_wildtype <- read.table(file.wildtype,header=TRUE);\n N <- ncol(df_wildtype)\n N_ko <- N;\n \n #Create the dataset E & K for knockout expression\n dataset <- rbind(df_data[,1:ncol(df_data)],df_knockout,df_knockdown,df_wildtype);\n dataset <- as.matrix(dataset);\n \n df_timeseries_perturbations <- read.table(file.perturbations, header=TRUE)\n matrix_timeseries_perturbations <- matrix(0,nrow(df_data),(ncol(df_data)))\n time_steps <- nrow(df_data)/nrow(df_timeseries_perturbations);\n for (i in 1:nrow(df_timeseries_perturbations))\n {\n indices <- c(((i-1)*time_steps+1):((i)*time_steps))\n temp <- as.numeric(as.vector(df_timeseries_perturbations[i,]));\n temp[abs(temp)!=0] <- 1\n matrix_timeseries_perturbations[indices,] <- matrix(rep(temp,time_steps),nrow=time_steps,ncol=ncol(df_timeseries_perturbations),byrow = TRUE);\n }\n \n matrix_knockout_perturbations <- matrix(0,N,ncol(dataset));\n diag(matrix_knockout_perturbations) <- 1;\n matrix_perturbations <- rbind(matrix_timeseries_perturbations,matrix_knockout_perturbations,matrix_knockout_perturbations,rep(0,ncol(dataset)));\n K_ko <- matrix_perturbations;\n \n #Perform the RGBM procedure \n gene_ids <- colnames(dataset);\n no_iterations <- 10;\n outputpath <- 'Results_ENNET/DREAM4_Results/';\n g_M <- matrix(1,N_ko,N_ko);\n colnames(K_ko) <- gene_ids;\n rownames(g_M) <- gene_ids;\n colnames(g_M) <- gene_ids;\n \n #================================================================================================\n sf_seq <- seq(from = 0.0, to = 0.75, length.out = 20)\n #sf_seq <- c(0.0);\n aucroc_info <- c();\n aucpr_info <- c();\n for (l in 1:length(sf_seq))\n {\n sf <- sf_seq[l];\n aucpr_curve <- c();\n aucroc_curve <- c();\n for (iter in 1:10)\n {\n \n #RGBM step for different mink\n mink = ceiling(sf*N_ko);\n V <- RGBM(dataset,K_ko,g_M,gene_ids,gene_ids,M=5000,nu=0.001,s_f=0.3,lf=1,2,mink,k,outputpath,\"DREAM4_\")\n \n file.goldstandard <- paste(\"DREAM4_InSilico_Size100/insilico_size100_\",k,\"/insilico_size100_\",k,\"_goldstandard.tsv\",sep=\"\")\n df_goldstandard <- read.csv(file.goldstandard,header=FALSE,sep=\"\\t\");\n df_goldstandard[,1] <- as.character(as.vector(df_goldstandard[,1]))\n df_goldstandard[,2] <- as.character(as.vector(df_goldstandard[,2]))\n \n orderedlist <- c();\n for (i in 1:nrow(df_goldstandard))\n {\n val <- V[df_goldstandard[i,1],df_goldstandard[i,2]];\n orderedlist <- c(orderedlist,val);\n }\n output_edgelist <- as.data.frame(cbind(df_goldstandard[,1],df_goldstandard[,2],orderedlist));\n colnames(output_edgelist) <- c(\"Source\",\"Target\",\"Weights\");\n output_edgelist$Source <- as.character(as.vector(output_edgelist$Source))\n output_edgelist$Target <- as.character(as.vector(output_edgelist$Target))\n output_edgelist$Weights <- as.numeric(as.vector(output_edgelist$Weights))\n \n write.table(output_edgelist,file=paste(\"Results_ENNET/DREAM4_Results/All_Results/Predicted_All_Network_sample_\",iter,\"_\",k,\".csv\",sep=\"\"),row.names=F)\n \n #Calculate performance\n pred <- prediction(orderedlist,df_goldstandard[,3])\n perf=performance(pred,measure = \"tpr\",\"fpr\")\n roc_info <- performance(pred,measure = \"auc\")\n aucroc_curve <- c(aucroc_curve,roc_info@y.values[[1]]);\n \n pr_auc_info <- pr.curve(orderedlist,weights.class0 = df_goldstandard[,3],curve = T)\n aucpr_curve <- c(aucpr_curve,pr_auc_info$auc.integral);\n }\n mean_aucroc <- mean(aucroc_curve);\n std_aucroc <- sd(aucroc_curve);\n mean_aucpr <- mean(aucpr_curve);\n std_aucpr <- sd(aucpr_curve)\n aucroc_info <- rbind(aucroc_info,cbind(sf,mean_aucroc,std_aucroc));\n aucpr_info <- rbind(aucpr_info,cbind(sf,mean_aucpr,std_aucpr));\n }\n final_aucroc <- rbind(final_aucroc,cbind(rep(k,dim(aucroc_info)[1]),aucroc_info));\n final_aucpr <- rbind(final_aucpr,cbind(rep(k,dim(aucpr_info)[1]),aucpr_info)); \n}\n\ndf_output <- cbind(final_aucroc,final_aucpr);\ndf_output <- as.data.frame(df_output);\n\nwrite.table(df_output,file=\"Results_ENNET/DREAM4_Results/Text_Results/Regularized_Feeback_Results.csv\",col.names=T,row.names=F,quote=FALSE)\n\nlibrary(ggplot2)\n\ndf_output$V1 <- as.factor(df_output$V1)\ndf_output$V5 <- as.factor(df_output$V5)\np <- ggplot(df_output, aes(x=sf, y=mean_aucroc)) + geom_line() + geom_point(shape=1) + facet_grid(V1 ~ .)\np <- p + theme(strip.background = element_rect(colour=\"red\", fill=\"#CCCCFF\",size=12))\np <- p + theme(axis.text.x = element_text(size=12), axis.text.y = element_text(size=12),\n axis.title.x = element_text(size=14,face = \"bold\"), axis.title.y = element_text(size=14,face=\"bold\"))\np \nggsave(\"Results_ENNET/DREAM4_Results/Images/Regularized_Feeback_ROC.pdf\",plot=p, device = \"pdf\",height = 10,width = 10)\n\n\np1 <- ggplot(df_output, aes(x=sf, y=mean_aucpr)) + geom_line() + geom_point(shape=1) + facet_grid(V1 ~ .)\np1 <- p1 + theme(strip.background = element_rect(colour=\"red\", fill=\"#CCCCFF\",size=12))\np1 <- p1 + theme(axis.text.x = element_text(size=12), axis.text.y = element_text(size=12),\n axis.title.x = element_text(size=14,face = \"bold\"), axis.title.y = element_text(size=14,face=\"bold\"))\np1 \nggsave(\"Results_ENNET/DREAM4_Results/Images/Regularized_Feeback_PR.pdf\",plot=p1, device = \"pdf\",height = 10,width = 10)\n",
"created" : 1483968657036.000,
"dirty" : false,
"encoding" : "UTF-8",
"folds" : "",
"hash" : "1219015701",
"id" : "20AB2C36",
"lastKnownWriteTime" : 1483969123,
"path" : "~/space/GRN_Inference/RGBM-master/my_scripts/Simulated_Experiment_Scripts/meta_gbm_dream4.R",
"project_path" : null,
"properties" : {
},
"relative_order" : 1,
"source_on_save" : false,
"type" : "r_source"
}
\ No newline at end of file
This diff is collapsed.
{
"contents" : "# This is an implementation of RGBM algorithm for Gene Regulatory Network\n# inference from gene/RNA/miRNA expression data, in form of an R package.\n# Copyright (C) 2016 Raghvendra Mall\n\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# any later version.\n\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n# GNU General Public License for more details.\n\n# You should have received a copy of the GNU General Public License\n# along with this program, see LICENSE.\n\n#All steps in the RGBM technique starting from mechanistic network to generation of final inferred GRN\nRGBM = function (E = matrix(rnorm(10000),100,100),K = matrix(0,nrow(E),ncol(E)),\n g_M = matrix(1,100,100), tfs = paste0(\"G\",c(1:100)), \n targets = paste0(\"G\",c(1:100)), lf = 1, \n M = 5000, nu = 0.001, s_f = 0.3, no_iterations = 2, mink = 0, \n experimentid = 1, outputpath = \"DEFAULT\", sample_type = \"Exp1_\") \n{\n Ntfs = length(tfs)\n Ntargets = length(targets)\n \n #Add colnames to E matrix and K matrix\n if (is.null(colnames(E)))\n {\n colnames(E) <- paste0(\"G\",c(1:100))\n }\n if (is.null(colnames(K)))\n {\n colnames(K) <- paste0(\"G\",c(1:100))\n }\n \n #Order the mechanistic network in the order of the names of the Tfs and the Targets\n if (is.null(colnames(g_M)))\n {\n colnames(g_M) <- targets;\n }\n else\n {\n g_M <- g_M[,targets];\n }\n if (is.null(rownames(g_M)))\n {\n rownames(g_M) <- tfs;\n }\n else{\n g_M <- g_M[tfs,];\n }\n \n #Get the colids of the tfs active for each target gene from the mechanisitic network\n tf_colids <- foreach(i = 1:Ntargets, .inorder = TRUE, .combine = \"cbind\") %dopar% {\n result <- rep(0,Ntfs)\n names(result) <- tfs;\n temp <- rownames(g_M)[which(as.numeric(as.vector(g_M[,targets[i]]))>0)];\n result[temp] <- 1\n result\n }\n rm(g_M)\n print(\"Identified colids for active tfs\");\n \n #Get the list of active transcription factors for each target gene\n active_tfs <- c()\n for (i in 1:Ntargets)\n {\n active_tfs <- c(active_tfs,length(which(as.numeric(as.vector(tf_colids[,i]))>0)));\n }\n df_colids <- get_colids(tf_colids,active_tfs,tfs,targets,Ntfs,Ntargets);\n rm(tf_colids)\n print(\"Identified list of active tfs for each gene\")\n \n # First run of GBM + Refinement for the mechanistic set of TFs and Targets\n if (sum(df_colids)==(Ntfs*Ntargets))\n {\n A_first <- first_GBM_step(E,K,tfs,targets,Ntfs,Ntargets,lf,M,nu,s_f,no_iterations)\n }\n else\n {\n A_temp <- matrix(0,nrow=Ntfs,ncol=Ntargets)\n for (iter in 1:no_iterations)\n {\n temp <- second_GBM_step(E,K,df_colids,tfs,targets,Ntfs,Ntargets,lf,M,nu,s_f)\n A_temp <- A_temp + temp\n rm(temp)\n }\n A_temp <- A_temp/no_iterations;\n rm(A_temp)\n A_first <- null_model_refinement_step(E,A_temp,K,tfs,targets,Ntfs,Ntargets);\n }\n gc()\n print(\"Performed first step of model building\")\n \n #Performed the proposed optimal Tf selection using variable importance and detect isolated nodes\n # followed by core GBM model and the refinement step\n if (!dir.exists(outputpath) && outputpath != \"DEFAULT\")\n {\n dir.create(outputpath)\n }\n if (outputpath == \"DEFAULT\")\n {\n outputpath = tempdir()\n print(paste(\"Intermediate GRN and Variable Importance Curve in:\", outputpath))\n }\n A <- regularized_GBM_step(E,A_first,K,tfs,targets,Ntfs,Ntargets,lf,M,nu,s_f,experimentid,outputpath,sample_type,mink)\n print(\"Built the final model\")\n return(A)\n}\n",
"created" : 1486394894538.000,
"dirty" : false,
"encoding" : "UTF-8",
"folds" : "",
"hash" : "3863026823",
"id" : "6521AACF",
"lastKnownWriteTime" : 1486394979,
"path" : "~/space/GRN_Inference/RGBM-master/RGBM/R/RGBM.R",
"project_path" : "R/RGBM.R",
"properties" : {
},
"relative_order" : 2,
"source_on_save" : false,
"type" : "r_source"
}
\ No newline at end of file
{
"contents" : "# This is an implementation of RGBM algorithm for Gene Regulatory Network\n# inference from gene/RNA/miRNA expression data, in form of an R package.\n# Copyright (C) 2016 Raghvendra Mall\n\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# any later version.\n\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n# GNU General Public License for more details.\n\n# You should have received a copy of the GNU General Public License\n# along with this program, see LICENSE.\n\nGBM = function (E = matrix(rnorm(10000),100,100),\n K = matrix(0,nrow(E),ncol(E)),\n tfs = paste0(\"G\",c(1:100)),\n targets = paste0(\"G\",c(1:100)),\n s_s = 1,\n s_f = 0.3,\n lf = 1,\n M = 5000,\n nu = 0.001,\n scale = TRUE,\n center = TRUE,\n optimization.stage = 2) {\n \n S = nrow(E)\n E = scale(E,scale=scale,center=center)\n #Add colnames to E matrix and K matrix\n if (is.null(colnames(E)))\n {\n colnames(E) <- paste0(\"G\",c(1:100))\n }\n if (is.null(colnames(K)))\n {\n colnames(K) <- paste0(\"G\",c(1:100))\n }\n \n Ntfs = length(tfs)\n Ntargets = length(targets)\n V = matrix(0, Ntfs, Ntargets)\n i = 0\n V = foreach(i = 1:Ntargets, .inorder = TRUE, .combine = \"cbind\") %dopar% {\n predictedI = targets[i];\n predictorsI = setdiff(tfs, predictedI)\n validE = K[,predictedI] == 0\n \n model = GBM.train(X.train = E[validE,predictorsI],\n Y.train = E[validE,predictedI],\n M.train = M,\n nu = nu,\n s_s = s_s,\n s_f = s_f,\n lf = lf)\n result = rep(0, Ntfs)\n names(result) = tfs;\n result[predictorsI] = model$importance\n result\n }\n \n if (optimization.stage > 0) {\n # first stage of re-evaluation\n s = apply(V,1,var)\n S1 = matrix(rep(s,Ntargets),Ntfs,Ntargets)\n V = V * S1\n }\n \n if (optimization.stage > 1) {\n # second stage of re-evaluation\n ko.experiments = which(rowSums(K)==1 & apply(K,1,max)==1)\n if (length(ko.experiments)>1) {\n S2 = matrix(1,Ntfs,Ntargets)\n rownames(S2) <- tfs;\n colnames(S2) <- targets;\n E.ko = E[ko.experiments,targets]\n for (tf in tfs) {\n for (target in targets) {\n avg.ko = mean(E.ko[K[ko.experiments,tf]==1,target])\n avg.n.ko = mean(E.ko[K[ko.experiments,tf]==0,target])\n std.dev = sd(E.ko[,target])\n if (std.dev>0) {\n S2[tf,target] = abs(avg.ko-avg.n.ko)/std.dev\n }\n }\n }\n V = V * S2\n }}\n \n # prepare the final adjacency matrix\n colnames(V) = targets;\n rownames(V) = tfs;\n return(V)\n}\n",
"created" : 1483969313474.000,
"dirty" : false,
"encoding" : "UTF-8",
"folds" : "",
"hash" : "2140762069",
"id" : "AB4498FB",
"lastKnownWriteTime" : 1483970947,
"path" : "/mnt3/raghvendra/GRN_Inference/RGBM-master/RGBM/R/GBM.R",
"project_path" : null,
"properties" : {
},
"relative_order" : 4,
"source_on_save" : false,
"type" : "r_source"
}
\ No newline at end of file
{
"contents" : "# This is an implementation of RGBM algorithm for Gene Regulatory Network\n# inference from gene/RNA/miRNA expression data, in form of an R package.\n# Copyright (C) 2016 Raghvendra Mall\n\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# any later version.\n\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n# GNU General Public License for more details.\n\n# You should have received a copy of the GNU General Public License\n# along with this program, see LICENSE.\n\n#All steps in the RGBM technique starting from mechanistic network to generation of final inferred GRN\nRGBM = function (E = matrix(rnorm(10000),100,100),K = matrix(0,nrow(E),ncol(E)),\n g_M = matrix(1,100,100), tfs = paste0(\"G\",c(1:100)), \n targets = paste0(\"G\",c(1:100)), lf = 1, \n M = 5000, nu = 0.001, s_f = 0.3, no_iterations = 2, mink = 0, \n experimentid = 1, outputpath = \"DEFAULT\", sample_type = \"Exp1_\") \n{\n Ntfs = length(tfs)\n Ntargets = length(targets)\n \n #Add colnames to E matrix and K matrix\n if (is.null(colnames(E)))\n {\n colnames(E) <- paste0(\"G\",c(1:100))\n }\n if (is.null(colnames(K)))\n {\n colnames(K) <- paste0(\"G\",c(1:100))\n }\n \n #Order the mechanistic network in the order of the names of the Tfs and the Targets\n if (is.null(colnames(g_M)))\n {\n colnames(g_M) <- targets;\n }\n else\n {\n g_M <- g_M[,targets];\n }\n if (is.null(rownames(g_M)))\n {\n rownames(g_M) <- tfs;\n }\n else{\n g_M <- g_M[tfs,];\n }\n \n #Get the colids of the tfs active for each target gene from the mechanisitic network\n tf_colids <- foreach(i = 1:Ntargets, .inorder = TRUE, .combine = \"cbind\") %dopar% {\n result <- rep(0,Ntfs)\n names(result) <- tfs;\n temp <- rownames(g_M)[which(as.numeric(as.vector(g_M[,targets[i]]))>0)];\n result[temp] <- 1\n result\n }\n rm(g_M)\n print(\"Identified colids for active tfs\");\n \n #Get the list of active transcription factors for each target gene\n active_tfs <- c()\n for (i in 1:Ntargets)\n {\n active_tfs <- c(active_tfs,length(which(as.numeric(as.vector(tf_colids[,i]))>0)));\n }\n df_colids <- get_colids(tf_colids,active_tfs,tfs,targets,Ntfs,Ntargets);\n rm(tf_colids)\n print(\"Identified list of active tfs for each gene\")\n \n # First run of GBM + Refinement for the mechanistic set of TFs and Targets\n if (sum(df_colids)==(Ntfs*Ntargets))\n {\n A_first <- first_GBM_step(E,K,tfs,targets,Ntfs,Ntargets,lf,M,nu,s_f,no_iterations)\n }\n else\n {\n A_temp <- matrix(0,nrow=Ntfs,ncol=Ntargets)\n for (iter in 1:no_iterations)\n {\n temp <- second_GBM_step(E,K,df_colids,tfs,targets,Ntfs,Ntargets,lf,M,nu,s_f)\n A_temp <- A_temp + temp\n rm(temp)\n }\n A_temp <- A_temp/no_iterations;\n rm(A_temp)\n A_first <- null_model_refinement_step(E,A_temp,K,Ntfs,Ntargets);\n }\n gc()\n print(\"Performed first step of model building\")\n \n #Performed the proposed optimal Tf selection using variable importance and detect isolated nodes\n # followed by core GBM model and the refinement step\n if (!dir.exists(outputpath) && outputpath != \"DEFAULT\")\n {\n dir.create(outputpath)\n }\n if (outputpath == \"DEFAULT\")\n {\n outputpath = tempdir()\n print(paste(\"Intermediate GRN and Variable Importance Curve in:\", outputpath))\n }\n A <- regularized_GBM_step(E,A_first,K,tfs,targets,Ntfs,Ntargets,lf,M,nu,s_f,experimentid,outputpath,sample_type,mink)\n print(\"Built the final model\")\n return(A)\n}\n",
"created" : 1483940665820.000,
"dirty" : false,
"encoding" : "UTF-8",
"folds" : "",
"hash" : "3104276946",
"id" : "B09CD5B4",
"lastKnownWriteTime" : 1483940684,
"path" : "~/space/GRN_Inference/RGBM-master/RGBM/R/RGBM.R",
"project_path" : "R/RGBM.R",
"properties" : {
},
"relative_order" : 2,
"source_on_save" : false,
"type" : "r_source"
}
\ No newline at end of file
{
"contents" : "library(ennet)\nlibrary(doMC)\nrequire(ROCR)\nlibrary(PRROC)\nlibrary(foreach)\nlibrary(plyr)\nlibrary(forecast)\nsetwd('~/space/GRN_Inference/')\ndebugSource('ennet-master/ennet/R/ennet.R')\nregisterDoMC(cores=20)\n\nlist <- c(1,3,4)\nfinal_table <- c();\n\nfor (networks in 1:length(list))\n{\n start.main <- proc.time();\n k <- list[networks];\n file.data <- paste(\"DREAM5_Challenge/net\",k,\"/net\",k,\"_expression_data_avg.tsv\",sep=\"\");\n file.metadata <- paste(\"DREAM5_Challenge/net\",k,\"/net\",k,\"_chip_features_avg.tsv\",sep=\"\");\n file.tfinfo <- paste(\"DREAM5_Challenge/net\",k,\"/net\",k,\"_transcription_factors.tsv\",sep=\"\")\n \n df_data <- read.table(file.data,header=TRUE);\n df_metadata <- read.table(file.metadata,header=TRUE)\n df_tf <- read.table(file.tfinfo,header=FALSE);\n \n #========================================================================\n #Extract knockout information first\n knockout_info <- as.character(as.vector(df_metadata[df_metadata$DeletedGenes!='NA',5]));\n \n N_exp <- nrow(df_data);\n N_genes <- ncol(df_data);\n K <- matrix(0,nrow=N_exp,ncol=N_genes);\n colnames(K) <- names(df_data);\n \n knockout_indices <- which(knockout_info!='NA');\n for (l in 1:length(knockout_indices))\n {\n index_id <- knockout_indices[l];\n knockout_genes <- unlist(strsplit(knockout_info[index_id],\"[,]\"));\n K[index_id,knockout_genes] <- 1;\n }\n \n #==============================================================================\n# #Smooth out the time series expression using forecasting\n# vector_experiments <- unique(df_metadata$Experiment)\n# table_experiments <- table(df_metadata$Experiment);\n# \n# new_dataset <- matrix(0,nrow=N_exp,ncol=N_genes);\n# count <- 0;\n# for (l in 1:length(vector_experiments))\n# {\n# no_experiments <- table_experiments[[l]];\n# #For the first experiment check for time stamps\n# if (l==1)\n# {\n# indices <- c(1:(count+no_experiments));\n# }\n# else\n# {\n# if (no_experiments>1)\n# {\n# indices <- c((count+1):(count+no_experiments))\n# }\n# else\n# {\n# indices <- count+no_experiments;\n# }\n# }\n# #If only 1 time-stamp\n# if (no_experiments==1)\n# {\n# new_dataset[indices,] <- as.numeric(as.vector(df_data[indices,]));\n# }\n# else{\n# #For many time-stamps\n# temp_dataset <- foreach(m = 1:N_genes, .inorder= TRUE, .combine=\"cbind\") %dopar%\n# {\n# ar_model <- forecast(df_data[indices,m]);\n# sample_coef <- ar_model$fitted;\n# sample_coef;\n# }\n# new_dataset[indices,] <- temp_dataset;\n# }\n# count <- count+no_experiments;\n# }\n# new_dataset <- as.data.frame(new_dataset);\n# colnames(new_dataset) <- names(df_data);\n# write.table(new_dataset,file=paste(\"DREAM5_Challenge/net\",k,\"/net\",k,\"_smooth_expression_data_avg.tsv\",sep=\"\"),\n# row.names=F,col.names=T);\n \n tfs <- dim(df_tf)[1]\n rm(df_metadata);\n gc()\n #=======================================================================\n #Estimate the quality metrics\n \n auroc_curve <- c();\n aupr_curve <- c();\n for (iter in 1:5)\n {\n V <- ennet(E = as.matrix(df_data), K = K, Tf = c(1:tfs), s_s = 0.75, s_f = 0.3, M = 5000, nu = 0.001, scale=FALSE,center=FALSE);\n \n V_req <- V[1:tfs,];\n gene_ids <- names(df_data);\n rownames(V_req)<- gene_ids[1:tfs];\n colnames(V)<- gene_ids;\n file.goldstandard <- paste(\"DREAM5_Challenge/net\",k,\"/goldstandard_network\",k,\".tsv\",sep=\"\")\n df_goldstandard <- read.csv(file.goldstandard,header=FALSE,sep=\"\\t\");\n df_goldstandard[,1] <- as.character(as.vector(df_goldstandard[,1]))\n df_goldstandard[,2] <- as.character(as.vector(df_goldstandard[,2]))\n Ngold <- 100000; \n V_req[is.nan(V_req)] <- 0;\n \n orderedlist = foreach (i = 1:Ngold, .inorder = TRUE, .combine = c) %dopar%\n {\n result <- V_req[df_goldstandard[i,1],df_goldstandard[i,2]];\n result\n }\n \n file.output <- paste(\"Results_ENNET/DREAM5_Results/All_Results/Predicted_All_Network_sample_\",iter,\"_\",k,\".csv\",sep=\"\")\n write.table(as.data.frame(cbind(df_goldstandard[c(1:Ngold),1:2],orderedlist)),file.output,col.names=F,row.names=F,quote = FALSE);\n \n #Calculate performance\n pred <- prediction(orderedlist,df_goldstandard[c(1:Ngold),3])\n perf=performance(pred,measure = \"tpr\",\"fpr\")\n roc_info <- performance(pred,measure = \"auc\")\n auroc_curve <- c(auroc_curve,roc_info@y.values[[1]]);\n \n pr_auc_info <- pr.curve(orderedlist,weights.class0 = df_goldstandard[c(1:Ngold),3],curve = T)\n aupr_curve <- c(aupr_curve,pr_auc_info$auc.integral);\n \n }\n end.main <- proc.time() - start.main \n #Time taken for 5 iterations\n duration.main <- end.main-start.main\n print( paste( 'Script duration:', round( duration.main[3] / 60, 2 ), 'min') )\n \n \n mean_auroc <- mean(auroc_curve);\n sd_auroc <- sd(auroc_curve);\n mean_aupr <- mean(aupr_curve);\n sd_aupr <- sd(aupr_curve);\n exp <- c(mean_auroc,sd_auroc,mean_aupr,sd_aupr)\n final_table <- rbind(final_table,exp);\n}\nfinal_table <- as.data.frame(final_table);\nwrite.table(final_table,\"Results_ENNET/DREAM5_Results/Text_Results/DREAM5_ENNET_InSilico_All_Results.csv\",col.names = T, row.names = F)",
"created" : 1484133068243.000,
"dirty" : false,
"encoding" : "UTF-8",
"folds" : "",
"hash" : "3803638667",
"id" : "C27B99E5",
"lastKnownWriteTime" : 1484145166,
"path" : "~/space/GRN_Inference/RGBM-master/my_scripts/Simulated_Experiment_Scripts/run_ennet_dream5.R",
"project_path" : null,
"properties" : {
},
"relative_order" : 1,
"source_on_save" : false,
"type" : "r_source"
}
\ No newline at end of file
{
"contents" : "library(RGBM)\nlibrary(doMC)\nrequire(ROCR)\nlibrary(PRROC)\nlibrary(tseries)\nlibrary(data.table)\nlibrary(foreach)\nlibrary(doParallel)\nregisterDoParallel(20)\nsetwd('/home/raghvendra/space/GRN_Inference/')\n\nfinal_aucroc <- c();\nfinal_aucpr <- c();\nno_iterations <- 10;\nfor (k in 1:5)\n{\n \n #Initialize\n file.perturbations <- paste(\"Supplementary information/insilico_size100_\",k,\"/Perturbations/insilico_size100_\",k,\"_timeseries_perturbations.tsv\",sep=\"\");\n file.data <- paste(\"../GRN_Inference/DREAM4_InSilico_Size100/insilico_size100_\",k,\"/insilico_size100_\",k,\"_mod_timeseries.tsv\",sep=\"\")\n file.knockout <- paste(\"../GRN_Inference/DREAM4_InSilico_Size100/insilico_size100_\",k,\"/insilico_size100_\",k,\"_knockouts.tsv\",sep=\"\")\n file.knockdown <- paste(\"../GRN_Inference/DREAM4_InSilico_Size100/insilico_size100_\",k,\"/insilico_size100_\",k,\"_knockdowns.tsv\",sep=\"\")\n file.wildtype <- paste(\"../GRN_Inference/DREAM4_InSilico_Size100/insilico_size100_\",k,\"/insilico_size100_\",k,\"_wildtype.tsv\",sep=\"\")\n \n #Get the data-frames \n df_data <- read.table(file.data, header = TRUE);\n df_knockout <- read.table(file.knockout,header=TRUE);\n df_knockdown <- read.table(file.knockdown,header = TRUE);\n df_wildtype <- read.table(file.wildtype,header=TRUE);\n N <- ncol(df_wildtype)\n N_ko <- N;\n \n #Create the dataset E & K for knockout expression\n dataset <- rbind(df_data[,1:ncol(df_data)],df_knockout,df_knockdown,df_wildtype);\n dataset <- as.matrix(dataset);\n \n df_timeseries_perturbations <- read.table(file.perturbations, header=TRUE)\n matrix_timeseries_perturbations <- matrix(0,nrow(df_data),(ncol(df_data)))\n time_steps <- nrow(df_data)/nrow(df_timeseries_perturbations);\n for (i in 1:nrow(df_timeseries_perturbations))\n {\n indices <- c(((i-1)*time_steps+1):((i)*time_steps))\n temp <- as.numeric(as.vector(df_timeseries_perturbations[i,]));\n temp[abs(temp)!=0] <- 1\n matrix_timeseries_perturbations[indices,] <- matrix(rep(temp,time_steps),nrow=time_steps,ncol=ncol(df_timeseries_perturbations),byrow = TRUE);\n }\n \n matrix_knockout_perturbations <- matrix(0,N,ncol(dataset));\n diag(matrix_knockout_perturbations) <- 1;\n matrix_perturbations <- rbind(matrix_timeseries_perturbations,matrix_knockout_perturbations,matrix_knockout_perturbations,rep(0,ncol(dataset)));\n K_ko <- matrix_perturbations;\n \n #Perform the RGBM procedure \n gene_ids <- colnames(dataset);\n no_iterations <- 10;\n outputpath <- 'Results_ENNET/DREAM4_Results/';\n g_M <- matrix(1,N_ko,N_ko);\n colnames(K_ko) <- gene_ids;\n rownames(g_M) <- gene_ids;\n colnames(g_M) <- gene_ids;\n \n #================================================================================================\n sf_seq <- seq(from = 0.0, to = 0.75, length.out = 20)\n #sf_seq <- c(0.0);\n aucroc_info <- c();\n aucpr_info <- c();\n for (l in 1:length(sf_seq))\n {\n sf <- sf_seq[l];\n aucpr_curve <- c();\n aucroc_curve <- c();\n for (iter in 1:10)\n {\n \n #RGBM step for different mink\n mink = ceiling(sf*N_ko);\n V <- RGBM(dataset,K_ko,g_M,gene_ids,gene_ids,M=5000,nu=0.001,s_f=0.3,lf=1,2,mink,k,outputpath,\"DREAM4_\")\n \n file.goldstandard <- paste(\"DREAM4_InSilico_Size100/insilico_size100_\",k,\"/insilico_size100_\",k,\"_goldstandard.tsv\",sep=\"\")\n df_goldstandard <- read.csv(file.goldstandard,header=FALSE,sep=\"\\t\");\n df_goldstandard[,1] <- as.character(as.vector(df_goldstandard[,1]))\n df_goldstandard[,2] <- as.character(as.vector(df_goldstandard[,2]))\n \n orderedlist <- c();\n for (i in 1:nrow(df_goldstandard))\n {\n val <- V[df_goldstandard[i,1],df_goldstandard[i,2]];\n orderedlist <- c(orderedlist,val);\n }\n output_edgelist <- as.data.frame(cbind(df_goldstandard[,1],df_goldstandard[,2],orderedlist));\n colnames(output_edgelist) <- c(\"Source\",\"Target\",\"Weights\");\n output_edgelist$Source <- as.character(as.vector(output_edgelist$Source))\n output_edgelist$Target <- as.character(as.vector(output_edgelist$Target))\n output_edgelist$Weights <- as.numeric(as.vector(output_edgelist$Weights))\n \n write.table(output_edgelist,file=paste(\"Results_ENNET/DREAM4_Results/All_Results/Predicted_All_Network_sample_\",iter,\"_\",k,\".csv\",sep=\"\"),row.names=F)\n \n #Calculate performance\n pred <- prediction(orderedlist,df_goldstandard[,3])\n perf=performance(pred,measure = \"tpr\",\"fpr\")\n roc_info <- performance(pred,measure = \"auc\")\n aucroc_curve <- c(aucroc_curve,roc_info@y.values[[1]]);\n \n pr_auc_info <- pr.curve(orderedlist,weights.class0 = df_goldstandard[,3],curve = T)\n aucpr_curve <- c(aucpr_curve,pr_auc_info$auc.integral);\n }\n mean_aucroc <- mean(aucroc_curve);\n std_aucroc <- sd(aucroc_curve);\n mean_aucpr <- mean(aucpr_curve);\n std_aucpr <- sd(aucpr_curve)\n aucroc_info <- rbind(aucroc_info,cbind(sf,mean_aucroc,std_aucroc));\n aucpr_info <- rbind(aucpr_info,cbind(sf,mean_aucpr,std_aucpr));\n }\n final_aucroc <- rbind(final_aucroc,cbind(rep(k,dim(aucroc_info)[1]),aucroc_info));\n final_aucpr <- rbind(final_aucpr,cbind(rep(k,dim(aucpr_info)[1]),aucpr_info)); \n}\n\ndf_output <- cbind(final_aucroc,final_aucpr);\ndf_output <- as.data.frame(df_output);\n\nwrite.table(df_output,file=\"Results_ENNET/DREAM4_Results/Text_Results/Regularized_Feeback_Results.csv\",col.names=T,row.names=F,quote=FALSE)\n\nlibrary(ggplot2)\n\ndf_output$V1 <- as.factor(df_output$V1)\ndf_output$V5 <- as.factor(df_output$V5)\np <- ggplot(df_output, aes(x=sf, y=mean_aucroc)) + geom_line() + geom_point(shape=1) + facet_grid(V1 ~ .)\np <- p + theme(strip.background = element_rect(colour=\"red\", fill=\"#CCCCFF\",size=12))\np <- p + theme(axis.text.x = element_text(size=12), axis.text.y = element_text(size=12),\n axis.title.x = element_text(size=14,face = \"bold\"), axis.title.y = element_text(size=14,face=\"bold\"))\np \nggsave(\"Results_ENNET/DREAM4_Results/Images/Regularized_Feeback_ROC.pdf\",plot=p, device = \"pdf\",height = 10,width = 10)\n\n\np1 <- ggplot(df_output, aes(x=sf, y=mean_aucpr)) + geom_line() + geom_point(shape=1) + facet_grid(V1 ~ .)\np1 <- p1 + theme(strip.background = element_rect(colour=\"red\", fill=\"#CCCCFF\",size=12))\np1 <- p1 + theme(axis.text.x = element_text(size=12), axis.text.y = element_text(size=12),\n axis.title.x = element_text(size=14,face = \"bold\"), axis.title.y = element_text(size=14,face=\"bold\"))\np1 \nggsave(\"Results_ENNET/DREAM4_Results/Images/Regularized_Feeback_PR.pdf\",plot=p1, device = \"pdf\",height = 10,width = 10)\n",
"created" : 1483972342064.000,
"dirty" : false,
"encoding" : "UTF-8",
"folds" : "",
"hash" : "1219015701",
"id" : "CF3CC0E5",
"lastKnownWriteTime" : 1483969123,
"path" : "~/space/GRN_Inference/RGBM-master/my_scripts/Simulated_Experiment_Scripts/meta_gbm_dream4.R",
"project_path" : null,
"properties" : {
},
"relative_order" : 1,
"source_on_save" : false,
"type" : "r_source"
}
\ No newline at end of file
This diff is collapsed.
{
"contents" : "# This is an implementation of RGBM algorithm for Gene Regulatory Network\n# inference from gene/RNA/miRNA expression data, in form of an R package.\n# Copyright (C) 2016 Raghvendra Mall\n\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# any later version.\n\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n# GNU General Public License for more details.\n\n# You should have received a copy of the GNU General Public License\n# along with this program, see LICENSE.\n\n#All steps in the RGBM technique starting from mechanistic network to generation of final inferred GRN\nRGBM = function (E = matrix(rnorm(10000),100,100),K = matrix(0,nrow(E),ncol(E)),\n g_M = matrix(1,100,100), tfs = paste0(\"G\",c(1:100)), \n targets = paste0(\"G\",c(1:100)), lf = 1, \n M = 5000, nu = 0.001, s_f = 0.3, no_iterations = 2, mink = 0, \n experimentid = 1, outputpath = \"DEFAULT\", sample_type = \"Exp1_\") \n{\n Ntfs = length(tfs)\n Ntargets = length(targets)\n \n #Add colnames to E matrix and K matrix\n if (is.null(colnames(E)))\n {\n colnames(E) <- paste0(\"G\",c(1:100))\n }\n if (is.null(colnames(K)))\n {\n colnames(K) <- paste0(\"G\",c(1:100))\n }\n \n #Order the mechanistic network in the order of the names of the Tfs and the Targets\n if (is.null(colnames(g_M)))\n {\n colnames(g_M) <- targets;\n }\n else\n {\n g_M <- g_M[,targets];\n }\n if (is.null(rownames(g_M)))\n {\n rownames(g_M) <- tfs;\n }\n else{\n g_M <- g_M[tfs,];\n }\n \n #Get the colids of the tfs active for each target gene from the mechanisitic network\n tf_colids <- foreach(i = 1:Ntargets, .inorder = TRUE, .combine = \"cbind\") %dopar% {\n result <- rep(0,Ntfs)\n names(result) <- tfs;\n temp <- rownames(g_M)[which(as.numeric(as.vector(g_M[,targets[i]]))>0)];\n result[temp] <- 1\n result\n }\n rm(g_M)\n print(\"Identified colids for active tfs\");\n \n #Get the list of active transcription factors for each target gene\n active_tfs <- c()\n for (i in 1:Ntargets)\n {\n active_tfs <- c(active_tfs,length(which(as.numeric(as.vector(tf_colids[,i]))>0)));\n }\n df_colids <- get_colids(tf_colids,active_tfs,tfs,targets,Ntfs,Ntargets);\n rm(tf_colids)\n print(\"Identified list of active tfs for each gene\")\n \n # First run of GBM + Refinement for the mechanistic set of TFs and Targets\n if (sum(df_colids)==(Ntfs*Ntargets))\n {\n A_first <- first_GBM_step(E,K,tfs,targets,Ntfs,Ntargets,lf,M,nu,s_f,no_iterations)\n }\n else\n {\n A_temp <- matrix(0,nrow=Ntfs,ncol=Ntargets)\n for (iter in 1:no_iterations)\n {\n temp <- second_GBM_step(E,K,df_colids,tfs,targets,Ntfs,Ntargets,lf,M,nu,s_f)\n A_temp <- A_temp + temp\n rm(temp)\n }\n A_temp <- A_temp/no_iterations;\n rm(A_temp)\n A_first <- null_model_refinement_step(E,A_temp,K,Ntfs,Ntargets);\n }\n gc()\n print(\"Performed first step of model building\")\n \n #Performed the proposed optimal Tf selection using variable importance and detect isolated nodes\n # followed by core GBM model and the refinement step\n if (!dir.exists(outputpath) && outputpath != \"DEFAULT\")\n {\n dir.create(outputpath)\n }\n if (outputpath == \"DEFAULT\")\n {\n outputpath = tempdir()\n print(paste(\"Intermediate GRN and Variable Importance Curve in:\", outputpath))\n }\n A <- regularized_GBM_step(E,A_first,K,tfs,targets,Ntfs,Ntargets,lf,M,nu,s_f,experimentid,outputpath,sample_type,mink)\n print(\"Built the final model\")\n return(A)\n}\n",
"created" : 1483969057550.000,
"dirty" : false,
"encoding" : "UTF-8",
"folds" : "",
"hash" : "3104276946",
"id" : "FC0E860B",
"lastKnownWriteTime" : 1483940684,
"path" : "/mnt3/raghvendra/GRN_Inference/RGBM-master/RGBM/R/RGBM.R",
"project_path" : null,
"properties" : {
},
"relative_order" : 3,
"source_on_save" : false,
"type" : "r_source"
}
\ No newline at end of file
{
}
\ No newline at end of file
{
}
\ No newline at end of file
{
}
\ No newline at end of file
{
}
\ No newline at end of file
{
"tempName" : "Untitled1"
}
\ No newline at end of file
{
}
\ No newline at end of file
{
}
\ No newline at end of file
{
"tempName" : "Untitled1"
}
\ No newline at end of file
{
}
\ No newline at end of file
{
}
\ No newline at end of file
{
}
\ No newline at end of file
{
}
\ No newline at end of file