# #——包括= FALSE --------------------------------------------------------- knitr: opts_chunk美元集(崩溃= TRUE,发表评论 = "#>" ) ## ---- eval = FALSE --------------------------------------------------------------- # galgo(…,# start_galgo_callback = callback_default,# ' galgo() '即将启动。# end_galgo_callback = callback_default, # ' galgo() '即将结束。# start_gen_callback = callback_default, #在每一代的开始# end_gen_callback = callback_default, #在每一代的结束# report_callback = callback_default, #在每一代的中间,在新交配池# #创建之后。# ...) ## ----------------------------------------------------------------------------- 库(GSgalgoR ) ## ----------------------------------------------------------------------------- my_callback < -函数(userdir = " ",生成、pop_pool帕累托,prob_matrix,当前时间){#代码从这里开始如果(代% % 2 = = 0)消息(paste0(“一代:“一代”,当前时间:”,当前时间 )) } ## ---- 消息= FALSE ------------------------------------------------------------ 库(breastCancerTRANSBIG ) ## ----------------------------------------------------------------------------- 数据(transbig)火车< - transbig rm (transbig)表达式< - Biobase:: exprs(火车)临床< - Biobase:: pData(火车)操作系统<——生存:Surv(时间=临床$ t。rfs事件=临床e.rfs) #使用美元降低了示例数据集表达式< -表达式(样本(1:nrow(表达式),100),]#规模表达式矩阵表达式< - t(规模(t(表达式 ))) ## ---- 消息= FALSE ------------------------------------------------------------ 库(GSgalgoR ) ## ----------------------------------------------------------------------------- # 运行galgo GSgalgoR:: galgo(代= 6,人口= 15,prob_matrix =表达式,OS =操作系统,start_galgo_callback = GSgalgoR::callback_default, end_galgo_callback = GSgalgoR::callback_default, report_callback = my_callback,在每个生成/迭代的mile #中调用' my_callback() '。start_gen_callback = GSgalgoR: callback_default end_gen_callback = GSgalgoR:: callback_default ) ## ----------------------------------------------------------------------------- my_save_pop_callback < -函数(userdir = " ",生成、pop_pool帕累托,prob_matrix,当前时间){目录< - paste0 (tempdir(),“/”)如果(! dir.exists(目录)){dir。创建(目录,递归= TRUE)}文件名< - paste0(目录、一代“.rda”)如果(代% % 2 = = 0){保存(文件=文件名,pop_pool)}消息(粘贴(“解决方案文件保存在文件名 )) } ## ----------------------------------------------------------------------------- # 运行galgo GSgalgoR:: galgo(代= 6,人口= 15,prob_matrix =表达式,OS = OS, start_galgo_callback = GSgalgoR:: callback_default, end_galgo_callback = GSgalgoR:: callback_default,Report_callback = my_callback,#在每次生成/迭代的中间调用' my_callback() ' #。 start_gen_callback = GSgalgoR::callback_default, end_gen_callback = my_save_pop_callback # call `my_save_pop_callback()` # at the end of each # generation/iteration ) ## ----------------------------------------------------------------------------- # Running galgo GSgalgoR::galgo( generations = 6, population = 15, prob_matrix = expression, OS = OS, start_galgo_callback = GSgalgoR::callback_default, end_galgo_callback = my_save_pop_callback, report_callback = my_callback, # call `my_callback()` # in the middle of each generation/iteration start_gen_callback = GSgalgoR::callback_default, end_gen_callback = GSgalgoR::callback_default ) ## ----eval=FALSE--------------------------------------------------------------- # # another_callback <- # function(userdir = "", # generation, # pop_pool, # pareto, # prob_matrix, # current_time) { # # code starts here # # # code ends here # callback_base_return_pop(userdir, # generation, # pop_pool, # prob_matrix, # current_time) # } ## ----sess_info, eval=TRUE----------------------------------------------------- sessionInfo()