Mercurial > repos > lgueguen > sartools
comparison template_script_edgeR_CL.r @ 3:de6d0b7c17af draft
release 1.6.3
author | lgueguen |
---|---|
date | Mon, 01 Oct 2018 05:07:56 -0400 |
parents | 581d217c7337 |
children |
comparison
equal
deleted
inserted
replaced
2:d86ccac2a660 | 3:de6d0b7c17af |
---|---|
1 #!/local/gensoft2/exe/R/3.1.2/bin/Rscript | |
2 | |
3 # to run this script, use one of these commands: | |
4 # Rscript --no-save --no-restore --verbose template_script_edgeR_CL.r -r raw -v group -c T0 > log.txt 2>&1 | |
5 # Rscript template_script_edgeR_CL.r -r raw -v group -c T0 | |
6 | |
7 # to get help: | |
8 # Rscript template_script_edgeR_CL.r --help | |
9 | |
10 ################################################################################ | 1 ################################################################################ |
11 ### R script to compare several conditions with the SARTools and edgeR packages | 2 ### R script to compare several conditions with the SARTools and edgeR packages |
12 ### Hugo Varet | 3 ### Hugo Varet |
13 ### April 20th, 2015 | 4 ### May 16th, 2018 |
14 ### designed to be executed with SARTools 1.1.0 | 5 ### designed to be executed with SARTools 1.6.3 |
6 ### run "Rscript template_script_edgeR_CL.r --help" to get some help | |
15 ################################################################################ | 7 ################################################################################ |
16 | 8 |
17 rm(list=ls()) # remove all the objects from the R session | 9 rm(list=ls()) # remove all the objects from the R session |
18 library(optparse) # to run the script in command lines | 10 library(optparse) # to run the script in command lines |
19 | 11 |
85 help="normalization method in calcNormFactors: \"TMM\", \"RLE\" or \"upperquartile\" [default: %default]"), | 77 help="normalization method in calcNormFactors: \"TMM\", \"RLE\" or \"upperquartile\" [default: %default]"), |
86 | 78 |
87 make_option(c("-C", "--colors"), | 79 make_option(c("-C", "--colors"), |
88 default="dodgerblue,firebrick1,MediumVioletRed,SpringGreen,chartreuse,cyan,darkorchid,darkorange", | 80 default="dodgerblue,firebrick1,MediumVioletRed,SpringGreen,chartreuse,cyan,darkorchid,darkorange", |
89 dest="cols", | 81 dest="cols", |
90 help="colors of each biological condition on the plots\n\t\t\"col1,col2,col3,col4\"\n\t\t[default: %default]") | 82 help="colors of each biological condition on the plots\n\t\t\"col1,col2,col3,col4\"\n\t\t[default: %default]"), |
83 | |
84 make_option(c("-f", "--forceCairoGraph"), | |
85 action="store_true", | |
86 default=FALSE, | |
87 dest="forceCairoGraph", | |
88 help="activate cairo type") | |
91 ) | 89 ) |
92 | 90 |
93 # now parse the command line to check which option is given and get associated values | 91 # now parse the command line to check which option is given and get associated values |
94 parser <- OptionParser(usage="usage: %prog [options]", | 92 parser <- OptionParser(usage="usage: %prog [options]", |
95 option_list=option_list, | 93 option_list=option_list, |
111 pAdjustMethod <- opt$pAdjustMethod # p-value adjustment method: "BH" (default) or "BY" | 109 pAdjustMethod <- opt$pAdjustMethod # p-value adjustment method: "BH" (default) or "BY" |
112 gene.selection <- opt$gene.selection # selection of the features in MDSPlot | 110 gene.selection <- opt$gene.selection # selection of the features in MDSPlot |
113 normalizationMethod <- opt$normalizationMethod # normalization method in calcNormFactors | 111 normalizationMethod <- opt$normalizationMethod # normalization method in calcNormFactors |
114 cpmCutoff <- opt$cpmCutoff # counts-per-million cut-off to filter low counts | 112 cpmCutoff <- opt$cpmCutoff # counts-per-million cut-off to filter low counts |
115 colors <- unlist(strsplit(opt$cols, ",")) # vector of colors of each biologicial condition on the plots | 113 colors <- unlist(strsplit(opt$cols, ",")) # vector of colors of each biologicial condition on the plots |
116 | 114 forceCairoGraph <- opt$forceCairoGraph # force cairo as plotting device if enabled |
117 # print(paste("workDir", workDir)) | 115 # print(paste("workDir", workDir)) |
118 # print(paste("projectName", projectName)) | 116 # print(paste("projectName", projectName)) |
119 # print(paste("author", author)) | 117 # print(paste("author", author)) |
120 # print(paste("targetFile", targetFile)) | 118 # print(paste("targetFile", targetFile)) |
121 # print(paste("rawDir", rawDir)) | 119 # print(paste("rawDir", rawDir)) |
133 ################################################################################ | 131 ################################################################################ |
134 ### running script ### | 132 ### running script ### |
135 ################################################################################ | 133 ################################################################################ |
136 # setwd(workDir) | 134 # setwd(workDir) |
137 library(SARTools) | 135 library(SARTools) |
136 if (forceCairoGraph) options(bitmapType="cairo") | |
138 | 137 |
139 # checking parameters | 138 # checking parameters |
140 problem <- checkParameters.edgeR(projectName=projectName,author=author,targetFile=targetFile, | 139 problem <- checkParameters.edgeR(projectName=projectName,author=author,targetFile=targetFile, |
141 rawDir=rawDir,featuresToRemove=featuresToRemove,varInt=varInt, | 140 rawDir=rawDir,featuresToRemove=featuresToRemove,varInt=varInt, |
142 condRef=condRef,batch=batch,alpha=alpha,pAdjustMethod=pAdjustMethod, | 141 condRef=condRef,batch=batch,alpha=alpha,pAdjustMethod=pAdjustMethod, |
169 | 168 |
170 # generating HTML report | 169 # generating HTML report |
171 writeReport.edgeR(target=target, counts=counts, out.edgeR=out.edgeR, summaryResults=summaryResults, | 170 writeReport.edgeR(target=target, counts=counts, out.edgeR=out.edgeR, summaryResults=summaryResults, |
172 majSequences=majSequences, workDir=workDir, projectName=projectName, author=author, | 171 majSequences=majSequences, workDir=workDir, projectName=projectName, author=author, |
173 targetFile=targetFile, rawDir=rawDir, featuresToRemove=featuresToRemove, varInt=varInt, | 172 targetFile=targetFile, rawDir=rawDir, featuresToRemove=featuresToRemove, varInt=varInt, |
174 condRef=condRef, batch=batch, alpha=alpha, pAdjustMethod=pAdjustMethod, colors=colors, | 173 condRef=condRef, batch=batch, alpha=alpha, pAdjustMethod=pAdjustMethod, cpmCutoff=cpmCutoff, |
175 gene.selection=gene.selection, normalizationMethod=normalizationMethod) | 174 colors=colors, gene.selection=gene.selection, normalizationMethod=normalizationMethod) |