Mercurial > repos > lgueguen > sartools
comparison template_script_DESeq2_CL.r @ 3:de6d0b7c17af draft
release 1.6.3
author | lgueguen |
---|---|
date | Mon, 01 Oct 2018 05:07:56 -0400 |
parents | 581d217c7337 |
children | 05c9b1a7f44e |
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_DESeq2_CL.r -r raw -v group -c T0 > log.txt 2>&1 | |
5 # Rscript template_script_DESeq2_CL.r -r raw -v group -c T0 | |
6 | |
7 # to get help: | |
8 # Rscript template_script_DESeq2_CL.r --help | |
9 | |
10 ################################################################################ | 1 ################################################################################ |
11 ### R script to compare several conditions with the SARTools and DESeq2 packages | 2 ### R script to compare several conditions with the SARTools and DESeq2 packages |
12 ### Hugo Varet | 3 ### Hugo Varet |
13 ### April 20th, 2015 | 4 ### March 20th, 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_DESeq2_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 |
60 help="blocking factor [default: %default] or \"batch\" for example"), | 52 help="blocking factor [default: %default] or \"batch\" for example"), |
61 | 53 |
62 make_option(c("-f", "--fitType"), | 54 make_option(c("-f", "--fitType"), |
63 default="parametric", | 55 default="parametric", |
64 dest="fitType", | 56 dest="fitType", |
65 help="mean-variance relationship: [default: %default] or local"), | 57 help="mean-variance relationship: [default: %default], local or mean"), |
66 | 58 |
67 make_option(c("-o", "--cooksCutoff"), | 59 make_option(c("-o", "--cooksCutoff"), |
68 default=TRUE, | 60 default=TRUE, |
69 dest="cooksCutoff", | 61 dest="cooksCutoff", |
70 help="perform the outliers detection (default is TRUE)"), | 62 help="perform the outliers detection (default is TRUE)"), |
95 help="median or shorth to estimate the size factors [default: %default]"), | 87 help="median or shorth to estimate the size factors [default: %default]"), |
96 | 88 |
97 make_option(c("-C", "--colors"), | 89 make_option(c("-C", "--colors"), |
98 default="dodgerblue,firebrick1,MediumVioletRed,SpringGreen,chartreuse,cyan,darkorchid,darkorange", | 90 default="dodgerblue,firebrick1,MediumVioletRed,SpringGreen,chartreuse,cyan,darkorchid,darkorange", |
99 dest="cols", | 91 dest="cols", |
100 help="colors of each biological condition on the plots\n\t\t\"col1,col2,col3,col4\"\n\t\t[default: %default]") | 92 help="colors of each biological condition on the plots\n\t\t\"col1,col2,col3,col4\"\n\t\t[default: %default]"), |
93 | |
94 make_option(c("-g", "--forceCairoGraph"), | |
95 action="store_true", | |
96 default=FALSE, | |
97 dest="forceCairoGraph", | |
98 help="activate cairo type") | |
99 | |
101 ) | 100 ) |
102 | 101 |
103 # now parse the command line to check which option is given and get associated values | 102 # now parse the command line to check which option is given and get associated values |
104 parser <- OptionParser(usage="usage: %prog [options]", | 103 parser <- OptionParser(usage="usage: %prog [options]", |
105 option_list=option_list, | 104 option_list=option_list, |
115 rawDir <- opt$rawDir # path to the directory containing raw counts files | 114 rawDir <- opt$rawDir # path to the directory containing raw counts files |
116 featuresToRemove <- unlist(strsplit(opt$FTR, ",")) # names of the features to be removed (specific HTSeq-count information and rRNA for example) | 115 featuresToRemove <- unlist(strsplit(opt$FTR, ",")) # names of the features to be removed (specific HTSeq-count information and rRNA for example) |
117 varInt <- opt$varInt # factor of interest | 116 varInt <- opt$varInt # factor of interest |
118 condRef <- opt$condRef # reference biological condition | 117 condRef <- opt$condRef # reference biological condition |
119 batch <- opt$batch # blocking factor: NULL (default) or "batch" for example | 118 batch <- opt$batch # blocking factor: NULL (default) or "batch" for example |
120 fitType <- opt$fitType # mean-variance relationship: "parametric" (default) or "local" | 119 fitType <- opt$fitType # mean-variance relationship: "parametric" (default), "local" or "mean" |
121 cooksCutoff <- opt$cooksCutoff # outliers detection threshold (NULL to let DESeq2 choosing it) | 120 cooksCutoff <- opt$cooksCutoff # outliers detection threshold (NULL to let DESeq2 choosing it) |
122 independentFiltering <- opt$independentFiltering # TRUE/FALSE to perform independent filtering (default is TRUE) | 121 independentFiltering <- opt$independentFiltering # TRUE/FALSE to perform independent filtering (default is TRUE) |
123 alpha <- as.numeric(opt$alpha) # threshold of statistical significance | 122 alpha <- as.numeric(opt$alpha) # threshold of statistical significance |
124 pAdjustMethod <- opt$pAdjustMethod # p-value adjustment method: "BH" (default) or "BY" | 123 pAdjustMethod <- opt$pAdjustMethod # p-value adjustment method: "BH" (default) or "BY" |
125 typeTrans <- opt$typeTrans # transformation for PCA/clustering: "VST" ou "rlog" | 124 typeTrans <- opt$typeTrans # transformation for PCA/clustering: "VST" ou "rlog" |
126 locfunc <- opt$locfunc # "median" (default) or "shorth" to estimate the size factors | 125 locfunc <- opt$locfunc # "median" (default) or "shorth" to estimate the size factors |
127 colors <- unlist(strsplit(opt$cols, ",")) # vector of colors of each biologicial condition on the plots | 126 colors <- unlist(strsplit(opt$cols, ",")) # vector of colors of each biologicial condition on the plots |
128 | 127 forceCairoGraph <- opt$forceCairoGraph # force cairo as plotting device if enabled |
129 # print(paste("workDir", workDir)) | 128 # print(paste("workDir", workDir)) |
130 # print(paste("projectName", projectName)) | 129 # print(paste("projectName", projectName)) |
131 # print(paste("author", author)) | 130 # print(paste("author", author)) |
132 # print(paste("targetFile", targetFile)) | 131 # print(paste("targetFile", targetFile)) |
133 # print(paste("rawDir", rawDir)) | 132 # print(paste("rawDir", rawDir)) |
147 ################################################################################ | 146 ################################################################################ |
148 ### running script ### | 147 ### running script ### |
149 ################################################################################ | 148 ################################################################################ |
150 # setwd(workDir) | 149 # setwd(workDir) |
151 library(SARTools) | 150 library(SARTools) |
151 if (forceCairoGraph) options(bitmapType="cairo") | |
152 | 152 |
153 # checking parameters | 153 # checking parameters |
154 problem <- checkParameters.DESeq2(projectName=projectName,author=author,targetFile=targetFile, | 154 problem <- checkParameters.DESeq2(projectName=projectName,author=author,targetFile=targetFile, |
155 rawDir=rawDir,featuresToRemove=featuresToRemove,varInt=varInt, | 155 rawDir=rawDir,featuresToRemove=featuresToRemove,varInt=varInt, |
156 condRef=condRef,batch=batch,fitType=fitType,cooksCutoff=cooksCutoff, | 156 condRef=condRef,batch=batch,fitType=fitType,cooksCutoff=cooksCutoff, |