Some functions are often written to analyze the microarray. The parameters used for each function are different. Therefore, some methods are required to store these different results and parameters.
First, use a built-in r time function SYS. Time ():
SYS. time () [1] "14:15:37 PDT" # change the settings here and output it to your favorite format: Format (sys. time (), '_ % Y _ % B _ % DTH _ % H _ % m ')
[1] "_2013_Apr_26th_14_18"
# Therefore, each program can create a folder named by time (to avoid repeated issues)
Dir = '/Media/research/RDATA/gene_data_mining /'
Gene_dir = paste (Dir, genename, format (sys. time (), '_ % Y _ % B _ % DTH _ % H _ % m'),'/', SEP = '')
Dir. Create (gene_dir)
Setwd (gene_dir)
Next, use a sink function to record the parameters of the function:
Gene_Integrate_Analysis = function(GeneName, NSF_Cut = 0.3,
Standardize = c('mean','none', 'median'), GO_hgCutoff = 0.001,KEGG_hgCutoff = 0.01, PFAM_hgCutoff = 0.01, QQ_Pos_Cut = 3.29, QQ_Neg_Cut = -3.29, Perm_Num = 10000, Perm_Pval_Cut = 0.001){ ...... setwd(Gene_DIR) #write the log file sink('log.txt') print(paste('Gene Name:', GeneName)) print(paste('Non-specific filtering cutoff:', NSF_Cut)) print(paste('Standardize method:', Standardize)) print(paste('GO Hypergeometric Test cutoff:', GO_hgCutoff )) print(paste('KEGG Hypergeometric Test cutoff:', KEGG_hgCutoff )) print(paste('PFAM Hypergeometric Test cutoff:', PFAM_hgCutoff )) print(paste('GSEA analysis QQ plot Positive Cutoff: ', QQ_Pos_Cut)) print(paste('GSEA analysis QQ plot Negative Cutoff: ', QQ_Neg_Cut)) print(paste('GSEA analysis Permutation Number:', Perm_Num)) print(paste('GSEA analysis Permutation Pvalue Cut:',Perm_Pval_Cut)) sink() }
In this way, we can save the parameters and corresponding results of each function!