From a8c1f9daad3bd2a6a3931594d5564ebe2d5b3f06 Mon Sep 17 00:00:00 2001 From: Hugo Varet Date: Fri, 9 Mar 2018 14:16:08 +0100 Subject: [PATCH 01/12] Create LICENSE --- LICENSE | 339 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 339 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d159169 --- /dev/null +++ b/LICENSE @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. From 40abf2b63469e75d7135afda538809d845b4c195 Mon Sep 17 00:00:00 2001 From: patelv Date: Thu, 15 Mar 2018 14:45:56 +0100 Subject: [PATCH 02/12] correct_size_parameters if cario plot is actived --- DESCRIPTION | 1 + R/MAPlot.R | 2 +- R/PCAPlot.R | 2 +- R/cairoSizeWrapper.R | 16 ++++++++++++++++ R/diagSizeFactorsPlots.R | 2 +- R/pairwiseScatterPlots.R | 2 +- R/rawpHist.R | 2 +- R/volcanoPlot.r | 2 +- template_script_DESeq2_CL.r | 14 +++++++++++--- 9 files changed, 34 insertions(+), 9 deletions(-) create mode 100644 R/cairoSizeWrapper.R diff --git a/DESCRIPTION b/DESCRIPTION index 1c6d067..754ebb7 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -12,3 +12,4 @@ VignetteBuilder: knitr Encoding: latin1 Description: Provide R tools and an environment for the statistical analysis of RNA-Seq projects: load and clean data, produce figures, perform statistical analysis/testing with DESeq2 or edgeR, export results and create final report. License: GPL-2 +RoxygenNote: 6.0.1 diff --git a/R/MAPlot.R b/R/MAPlot.R index 7c798c8..b91b163 100755 --- a/R/MAPlot.R +++ b/R/MAPlot.R @@ -11,7 +11,7 @@ MAPlot <- function(complete, alpha=0.05, outfile=TRUE){ ncol <- ifelse(length(complete)<=4, ceiling(sqrt(length(complete))), 3) nrow <- ceiling(length(complete)/ncol) - if (outfile) png(filename="figures/MAPlot.png", width=1800*ncol, height=1800*nrow, res=300) + if (outfile) png(filename="figures/MAPlot.png", width=carioSizeWrapper(1800*ncol), height=carioSizeWrapper(1800*nrow), res=300) par(mfrow=c(nrow,ncol)) for (name in names(complete)){ complete.name <- complete[[name]] diff --git a/R/PCAPlot.R b/R/PCAPlot.R index 71ac76f..02bb58a 100755 --- a/R/PCAPlot.R +++ b/R/PCAPlot.R @@ -20,7 +20,7 @@ PCAPlot <- function(counts.trans, group, n=min(500,nrow(counts.trans)), prp <- round(prp[1:3],2) # create figure - if (outfile) png(filename="figures/PCA.png",width=1800*2,height=1800,res=300) + if (outfile) png(filename="figures/PCA.png",width=carioSizeWrapper(1800*2),height=carioSizeWrapper(1800),res=300) par(mfrow=c(1,2)) # axes 1 et 2 abs=range(pca$x[,1]); abs=abs(abs[2]-abs[1])/25; diff --git a/R/cairoSizeWrapper.R b/R/cairoSizeWrapper.R new file mode 100644 index 0000000..4534c2a --- /dev/null +++ b/R/cairoSizeWrapper.R @@ -0,0 +1,16 @@ +#' Cario Size Wrapper +#' +#' Limits the pixel size to either to the minimum of the given and the max allowed pixel size 32767x32767 pixels if +#' cario graphical has been choosen +#' +#' @param requested pixel size +#' @return the minimum between the requested and maximal allowed pixel size if cario is selected otherwise the requested pixel size +#' @author vipul patel + + + + +carioSizeWrapper <- function(pixel_re){ + if(options("bitmapType") == "cairo") return(min(pixel_re,32767)) else return(pixel_re) + +} \ No newline at end of file diff --git a/R/diagSizeFactorsPlots.R b/R/diagSizeFactorsPlots.R index cf3255d..a2d9433 100755 --- a/R/diagSizeFactorsPlots.R +++ b/R/diagSizeFactorsPlots.R @@ -16,7 +16,7 @@ diagSizeFactorsPlots <- function(dds, group, col=c("lightblue","orange","MediumV if ("diag" %in% plots){ ncol <- ifelse(ncol(counts(dds))<=4, ceiling(sqrt(ncol(counts(dds)))), 3) nrow <- ceiling(ncol(counts(dds))/ncol) - if (outfile) png(filename="figures/diagSizeFactorsHist.png", width=1400*ncol, height=1400*nrow, res=300) + if (outfile) png(filename="figures/diagSizeFactorsHist.png", width=carioSizeWrapper(1400*ncol), height=carioSizeWrapper(1400*nrow), res=300) par(mfrow=c(nrow,ncol)) geomeans <- exp(rowMeans(log(counts(dds)))) samples <- colnames(counts(dds)) diff --git a/R/pairwiseScatterPlots.R b/R/pairwiseScatterPlots.R index bab5c93..a8eb879 100755 --- a/R/pairwiseScatterPlots.R +++ b/R/pairwiseScatterPlots.R @@ -11,7 +11,7 @@ pairwiseScatterPlots <- function(counts, group, outfile=TRUE){ ncol <- ncol(counts) if (ncol <= 30){ - if (outfile) png(filename="figures/pairwiseScatter.png", width=700*ncol, height=700*ncol, res=300) + if (outfile) png(filename="figures/pairwiseScatter.png", width=carioSizeWrapper(700*ncol), height=carioSizeWrapper(700*ncol), res=300) # defining panel and lower.panel functions panel <- function(x,y,...){points(x, y, pch=".");abline(a=0,b=1,lty=2);} lower.panel <- function(x,y,...){ diff --git a/R/rawpHist.R b/R/rawpHist.R index f014553..17ee346 100755 --- a/R/rawpHist.R +++ b/R/rawpHist.R @@ -10,7 +10,7 @@ rawpHist <- function(complete, outfile=TRUE){ ncol <- ifelse(length(complete)<=4, ceiling(sqrt(length(complete))), 3) nrow <- ceiling(length(complete)/ncol) - if (outfile) png(filename="figures/rawpHist.png", width=1800*ncol, height=1800*nrow, res=300) + if (outfile) png(filename="figures/rawpHist.png", width=carioSizeWrapper(1800*ncol), height=carioSizeWrapper(1800*nrow), res=300) par(mfrow=c(nrow,ncol)) for (name in names(complete)){ hist(complete[[name]][,"pvalue"], nclass=50, xlab="Raw p-value", diff --git a/R/volcanoPlot.r b/R/volcanoPlot.r index f9c6997..cfcf8ad 100755 --- a/R/volcanoPlot.r +++ b/R/volcanoPlot.r @@ -11,7 +11,7 @@ volcanoPlot <- function(complete, alpha=0.05, outfile=TRUE){ ncol <- ifelse(length(complete)<=4, ceiling(sqrt(length(complete))), 3) nrow <- ceiling(length(complete)/ncol) - if (outfile) png(filename="figures/volcanoPlot.png", width=1800*ncol, height=1800*nrow, res=300) + if (outfile) png(filename="figures/volcanoPlot.png", width=carioSizeWrapper(1800*ncol), height=carioSizeWrapper(1800*nrow), res=300) par(mfrow=c(nrow,ncol)) for (name in names(complete)){ complete.name <- complete[[name]] diff --git a/template_script_DESeq2_CL.r b/template_script_DESeq2_CL.r index 88e583a..da15e2a 100755 --- a/template_script_DESeq2_CL.r +++ b/template_script_DESeq2_CL.r @@ -89,7 +89,13 @@ make_option(c("-l", "--locfunc"), make_option(c("-C", "--colors"), default="dodgerblue,firebrick1,MediumVioletRed,SpringGreen,chartreuse,cyan,darkorchid,darkorange", dest="cols", - help="colors of each biological condition on the plots\n\t\t\"col1,col2,col3,col4\"\n\t\t[default: %default]") + help="colors of each biological condition on the plots\n\t\t\"col1,col2,col3,col4\"\n\t\t[default: %default]"), + +make_option(c("-g", "--graph"), + default=NULL, + dest="graph", + help="activate cairo type"), + ) # now parse the command line to check which option is given and get associated values @@ -117,7 +123,8 @@ pAdjustMethod <- opt$pAdjustMethod # p-value adjustment method typeTrans <- opt$typeTrans # transformation for PCA/clustering: "VST" ou "rlog" locfunc <- opt$locfunc # "median" (default) or "shorth" to estimate the size factors colors <- unlist(strsplit(opt$cols, ",")) # vector of colors of each biologicial condition on the plots - +graph <- opt$graph # cario activted or not default NULL + # print(paste("workDir", workDir)) # print(paste("projectName", projectName)) # print(paste("author", author)) @@ -141,7 +148,8 @@ colors <- unlist(strsplit(opt$cols, ",")) # vector of colors of each ################################################################################ # setwd(workDir) library(SARTools) - +#activate cairo plotting if not null +if (! is.null(graph)) options(bitmapType='cairo') # checking parameters problem <- checkParameters.DESeq2(projectName=projectName,author=author,targetFile=targetFile, rawDir=rawDir,featuresToRemove=featuresToRemove,varInt=varInt, From 7f946132ff47f7c9df609882c455526818bafd61 Mon Sep 17 00:00:00 2001 From: patelv Date: Thu, 15 Mar 2018 15:41:21 +0100 Subject: [PATCH 03/12] remove , add the end of make_option --- template_script_DESeq2_CL.r | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template_script_DESeq2_CL.r b/template_script_DESeq2_CL.r index da15e2a..b1c56b3 100755 --- a/template_script_DESeq2_CL.r +++ b/template_script_DESeq2_CL.r @@ -94,7 +94,7 @@ make_option(c("-C", "--colors"), make_option(c("-g", "--graph"), default=NULL, dest="graph", - help="activate cairo type"), + help="activate cairo type") ) From 3ce48087cbc3a2f6bcd3bc94e740e2bb2d81f2f2 Mon Sep 17 00:00:00 2001 From: patelv Date: Thu, 15 Mar 2018 15:50:14 +0100 Subject: [PATCH 04/12] change graph as a boolean flag --- template_script_DESeq2_CL.r | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/template_script_DESeq2_CL.r b/template_script_DESeq2_CL.r index b1c56b3..3f33260 100755 --- a/template_script_DESeq2_CL.r +++ b/template_script_DESeq2_CL.r @@ -91,7 +91,7 @@ make_option(c("-C", "--colors"), dest="cols", help="colors of each biological condition on the plots\n\t\t\"col1,col2,col3,col4\"\n\t\t[default: %default]"), -make_option(c("-g", "--graph"), +make_option(c("-g", "--graph"), action="store_true", default=NULL, dest="graph", help="activate cairo type") @@ -124,7 +124,6 @@ typeTrans <- opt$typeTrans # transformation for PCA/cl locfunc <- opt$locfunc # "median" (default) or "shorth" to estimate the size factors colors <- unlist(strsplit(opt$cols, ",")) # vector of colors of each biologicial condition on the plots graph <- opt$graph # cario activted or not default NULL - # print(paste("workDir", workDir)) # print(paste("projectName", projectName)) # print(paste("author", author)) From 54b7548db4bb672fe8f9251277aafa3518a18ba0 Mon Sep 17 00:00:00 2001 From: patelv Date: Thu, 15 Mar 2018 15:55:35 +0100 Subject: [PATCH 05/12] add changes to edgeR as well --- template_script_DESeq2.r | 4 +++- template_script_edgeR.r | 4 +++- template_script_edgeR_CL.r | 11 ++++++++--- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/template_script_DESeq2.r b/template_script_DESeq2.r index b548791..6b38528 100755 --- a/template_script_DESeq2.r +++ b/template_script_DESeq2.r @@ -37,12 +37,14 @@ locfunc <- "median" # "median" (default) or "sh colors <- c("dodgerblue","firebrick1", # vector of colors of each biological condition on the plots "MediumVioletRed","SpringGreen") +graph <- NULL + ################################################################################ ### running script ### ################################################################################ setwd(workDir) library(SARTools) - +if (! is.null(graph)) options(bitmapType='cairo') # checking parameters checkParameters.DESeq2(projectName=projectName,author=author,targetFile=targetFile, rawDir=rawDir,featuresToRemove=featuresToRemove,varInt=varInt, diff --git a/template_script_edgeR.r b/template_script_edgeR.r index 8b12503..092d648 100755 --- a/template_script_edgeR.r +++ b/template_script_edgeR.r @@ -35,12 +35,14 @@ normalizationMethod <- "TMM" # normalization method: "TM colors <- c("dodgerblue","firebrick1", # vector of colors of each biological condition on the plots "MediumVioletRed","SpringGreen") +graph <- NULL + ################################################################################ ### running script ### ################################################################################ setwd(workDir) library(SARTools) - +if (! is.null(graph)) options(bitmapType='cairo') # checking parameters checkParameters.edgeR(projectName=projectName,author=author,targetFile=targetFile, rawDir=rawDir,featuresToRemove=featuresToRemove,varInt=varInt, diff --git a/template_script_edgeR_CL.r b/template_script_edgeR_CL.r index 5e331df..835ecc5 100755 --- a/template_script_edgeR_CL.r +++ b/template_script_edgeR_CL.r @@ -79,7 +79,12 @@ make_option(c("-n", "--normalizationMethod"), make_option(c("-C", "--colors"), default="dodgerblue,firebrick1,MediumVioletRed,SpringGreen,chartreuse,cyan,darkorchid,darkorange", dest="cols", - help="colors of each biological condition on the plots\n\t\t\"col1,col2,col3,col4\"\n\t\t[default: %default]") + help="colors of each biological condition on the plots\n\t\t\"col1,col2,col3,col4\"\n\t\t[default: %default]"), + +make_option(c("-g", "--graph"), action="store_true", + default=NULL, + dest="graph", + help="activate cairo type") ) # now parse the command line to check which option is given and get associated values @@ -105,7 +110,7 @@ gene.selection <- opt$gene.selection # selection of the features normalizationMethod <- opt$normalizationMethod # normalization method in calcNormFactors cpmCutoff <- opt$cpmCutoff # counts-per-million cut-off to filter low counts colors <- unlist(strsplit(opt$cols, ",")) # vector of colors of each biologicial condition on the plots - +graph <- opt$graph # print(paste("workDir", workDir)) # print(paste("projectName", projectName)) # print(paste("author", author)) @@ -127,7 +132,7 @@ colors <- unlist(strsplit(opt$cols, ",")) # vector of colors of each ################################################################################ # setwd(workDir) library(SARTools) - +if (! is.null(graph)) options(bitmapType='cairo') # checking parameters problem <- checkParameters.edgeR(projectName=projectName,author=author,targetFile=targetFile, rawDir=rawDir,featuresToRemove=featuresToRemove,varInt=varInt, From 882edfa84a1d6776b24aa1be8015b67608e84a52 Mon Sep 17 00:00:00 2001 From: patelv Date: Mon, 19 Mar 2018 09:39:36 +0100 Subject: [PATCH 06/12] remove type --- R/cairoSizeWrapper.R | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 R/cairoSizeWrapper.R diff --git a/R/cairoSizeWrapper.R b/R/cairoSizeWrapper.R deleted file mode 100644 index 4534c2a..0000000 --- a/R/cairoSizeWrapper.R +++ /dev/null @@ -1,16 +0,0 @@ -#' Cario Size Wrapper -#' -#' Limits the pixel size to either to the minimum of the given and the max allowed pixel size 32767x32767 pixels if -#' cario graphical has been choosen -#' -#' @param requested pixel size -#' @return the minimum between the requested and maximal allowed pixel size if cario is selected otherwise the requested pixel size -#' @author vipul patel - - - - -carioSizeWrapper <- function(pixel_re){ - if(options("bitmapType") == "cairo") return(min(pixel_re,32767)) else return(pixel_re) - -} \ No newline at end of file From ed3ad832dc92843a7390cefabfbae51d0788d292 Mon Sep 17 00:00:00 2001 From: patelv Date: Mon, 19 Mar 2018 09:44:46 +0100 Subject: [PATCH 07/12] correct graph paramenter for store_action handling --- template_script_DESeq2.r | 4 ++-- template_script_DESeq2_CL.r | 4 ++-- template_script_edgeR.r | 4 ++-- template_script_edgeR_CL.r | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/template_script_DESeq2.r b/template_script_DESeq2.r index 6b38528..6c9c711 100755 --- a/template_script_DESeq2.r +++ b/template_script_DESeq2.r @@ -37,14 +37,14 @@ locfunc <- "median" # "median" (default) or "sh colors <- c("dodgerblue","firebrick1", # vector of colors of each biological condition on the plots "MediumVioletRed","SpringGreen") -graph <- NULL +graph <- FALSE ################################################################################ ### running script ### ################################################################################ setwd(workDir) library(SARTools) -if (! is.null(graph)) options(bitmapType='cairo') +if (graph) options(bitmapType='cairo') # checking parameters checkParameters.DESeq2(projectName=projectName,author=author,targetFile=targetFile, rawDir=rawDir,featuresToRemove=featuresToRemove,varInt=varInt, diff --git a/template_script_DESeq2_CL.r b/template_script_DESeq2_CL.r index 3f33260..ce126e7 100755 --- a/template_script_DESeq2_CL.r +++ b/template_script_DESeq2_CL.r @@ -92,7 +92,7 @@ make_option(c("-C", "--colors"), help="colors of each biological condition on the plots\n\t\t\"col1,col2,col3,col4\"\n\t\t[default: %default]"), make_option(c("-g", "--graph"), action="store_true", - default=NULL, + default=FALSE, dest="graph", help="activate cairo type") @@ -148,7 +148,7 @@ graph <- opt$graph # cario activted or not default NULL # setwd(workDir) library(SARTools) #activate cairo plotting if not null -if (! is.null(graph)) options(bitmapType='cairo') +if (graph) options(bitmapType='cairo') # checking parameters problem <- checkParameters.DESeq2(projectName=projectName,author=author,targetFile=targetFile, rawDir=rawDir,featuresToRemove=featuresToRemove,varInt=varInt, diff --git a/template_script_edgeR.r b/template_script_edgeR.r index 092d648..f88acb8 100755 --- a/template_script_edgeR.r +++ b/template_script_edgeR.r @@ -35,14 +35,14 @@ normalizationMethod <- "TMM" # normalization method: "TM colors <- c("dodgerblue","firebrick1", # vector of colors of each biological condition on the plots "MediumVioletRed","SpringGreen") -graph <- NULL +graph <- FALSE ################################################################################ ### running script ### ################################################################################ setwd(workDir) library(SARTools) -if (! is.null(graph)) options(bitmapType='cairo') +if (graph) options(bitmapType='cairo') # checking parameters checkParameters.edgeR(projectName=projectName,author=author,targetFile=targetFile, rawDir=rawDir,featuresToRemove=featuresToRemove,varInt=varInt, diff --git a/template_script_edgeR_CL.r b/template_script_edgeR_CL.r index 835ecc5..1958112 100755 --- a/template_script_edgeR_CL.r +++ b/template_script_edgeR_CL.r @@ -82,7 +82,7 @@ make_option(c("-C", "--colors"), help="colors of each biological condition on the plots\n\t\t\"col1,col2,col3,col4\"\n\t\t[default: %default]"), make_option(c("-g", "--graph"), action="store_true", - default=NULL, + default=FALSE, dest="graph", help="activate cairo type") ) @@ -132,7 +132,7 @@ graph <- opt$graph ################################################################################ # setwd(workDir) library(SARTools) -if (! is.null(graph)) options(bitmapType='cairo') +if (graph) options(bitmapType='cairo') # checking parameters problem <- checkParameters.edgeR(projectName=projectName,author=author,targetFile=targetFile, rawDir=rawDir,featuresToRemove=featuresToRemove,varInt=varInt, From 8d6816a0b673b8dc2ca661cff0482f25373075c0 Mon Sep 17 00:00:00 2001 From: patelv Date: Mon, 19 Mar 2018 10:26:19 +0100 Subject: [PATCH 08/12] change typo --- .RData | Bin 0 -> 2124 bytes 1 | 193 ++++++++++++++++++++++++++++++++++++++++ R/carioSizeWrapper.R | 16 ++++ man/carioSizeWrapper.Rd | 21 +++++ 4 files changed, 230 insertions(+) create mode 100644 .RData create mode 100644 1 create mode 100644 R/carioSizeWrapper.R create mode 100644 man/carioSizeWrapper.Rd diff --git a/.RData b/.RData new file mode 100644 index 0000000000000000000000000000000000000000..68a978a0ca2644a0d856cc28a723ff6bf15e29b5 GIT binary patch literal 2124 zcmV-S2($MeiwFP!000001MORFliM^9&b?pmDD;K*FL*Ko12b`s7Cyki0M~1eGSike zmzFY2$tboQi*qbjmhW2r3H$^8BxNPri7i<-O*#9MJ5B29Wi36=?rK*%8QywwW9P|E zr_)*OtgWwfR@dNheHFe|I_sS-{JZJUfU+2#F2iR#Yu$0FJH>1gBsg#J2*VRboRjNW z%Uk!bOOn}RLIcc)*v*=Ek0VCH>5mNKFrVxAh;fFKIG48Wyg>6_7qJt{9G|%578Fjg zx>}TQpEB6a(n;yC7o9d#5cuT<$?*%#@CnDqmfw@BW6mnJlv;TU8k6uJ`V=DTk^SnsOKV?=I9k_oaF~5glow+G?IS3yC6tQX|xn~wy zKGzcz`FV$rgQ!#CIl*cO4aWhIK&IBSvi5=MsA9m1kG%j*RVA?>C}X<;4X0H@FWGj< z2PkKQBNn3Sddw+Phpr0{l!0BLJ|IF^YctEAs&G< ztb$wvw-t#>qb#4A?JNu7YO%ATY>nPLcCRGp6Aua75)6?L-T;Bi5^$GZ+!)A?0pzZ2 z&lAHMP~IvD*I=G!pBlzD81?{Jq1qEjL+F$^C=kxfB?6Nr@GdW*F~BDVz_)BWySS(U z?u~+I3HDs+R_;H#dw0bE_WlI2lM``7WSU)pt_96KDZVG;WBeS=qWnzOKrb$&F~~i$ zj_2uKEjnHju18D7{Js+YuVxs9!q-85?g$qjAc0BjlW5;W1rU}WAiBnv7StI0)Byh_ z;bIEce#=v^mD#_6fL%?zBtf~%(_sHR!VENdCXZQ~@PJ?zL$u1V%y6wwGrTPlTchEl z+n*WW)?eQk>bb$G=qZ3O%+Fx3ZNCd=r7Q4-#x4DMcg^)=Y}pw|Y14^yE={^Vi-I98|5S zF)l_1E_Q8uaSd7r4_!sPo-WIK@JbSnxR@tgk34K;O!MIIV9yBvM(I9)444jVBvy}s z7hHx9b!Cll5tw73d6A}$7^oy%uY(70ZA1BYOp+=WAZ1?V$;fN z3sWFeT2*5l9GVl_ybN3e1!+m48vpvrJe7q0o^Df|FBmy~bp{82<;8nIdA!r@_F&HS zK78E}Utfr?FMH6wL}Fb8w=uG(=2Jhd>(r9x6+{cNKYVFm;+m+|oC-5?5Mk8f^Rz%e z#tSkp6g@evA~`ufOIpw>rLl@)*G3ZSMUVa?(YSAM4CyIsd>lKBM0|Yf_A!2TV|;jb z0O@U7OpBkYYs=a@X@TwPxx_y(r#o7K=Yr|iD@dBfD}^vkG3qLQ>DiIC*2YY;t!Nn> zWn0mz9?@2`YB7kmqBUort!T9st+t|dAt1LEt%d=gm@}Q`Dq6-&r>$YNHLU*+KQ$+H zZ4IlfVO5jR*096vUoe^-s zY0XdlS=Kg=2nb5l%Hi+`-sI4kh-KowHA$vfi6yo$cLsw2*f~ZqPA{MxZrw?y)Orld zWL%fCL{ARoyhRpBjHES!Y zW%^Uk(!gRQVTf%OS}*9+U*FsF=?w3s)w8`A{JJP^jy>{xZ&B&&{QDodtJFD)KL7xQ CTM4=V literal 0 HcmV?d00001 diff --git a/1 b/1 new file mode 100644 index 0000000..4f2bf2c --- /dev/null +++ b/1 @@ -0,0 +1,193 @@ +################################################################################ +### R script to compare several conditions with the SARTools and DESeq2 packages +### Hugo Varet +### Dec 11th, 2017 +### designed to be executed with SARTools 1.6.0 +### run "Rscript template_script_DESeq2_CL.r --help" to get some help +################################################################################ + +rm(list=ls()) # remove all the objects from the R session +library(optparse) # to run the script in command lines + +# options list with associated default value. +option_list <- list( +make_option(c("-P", "--projectName"), + default=basename(getwd()), + dest="projectName", + help="name of the project used for the report [default: name of the current directory]."), + +make_option(c("-A", "--author"), + default=Sys.info()[7], + dest="author", + help="name of the report author [default: %default]."), + +make_option(c("-t", "--targetFile"), + default="target.txt", + dest="targetFile", + help="path to the design/target file [default: %default]."), + +make_option(c("-r", "--rawDir"), + default="raw", + dest="rawDir", + help="path to the directory containing the HTSeq files [default: %default]."), + +make_option(c("-F", "--featuresToRemove"), + default="alignment_not_unique,ambiguous,no_feature,not_aligned,too_low_aQual", + dest="FTR", + help="names of the features to be removed, more than once can be specified [default: %default]"), + +make_option(c("-v", "--varInt"), + default="group", + dest="varInt", + help="factor of interest [default: %default]"), + +make_option(c("-c", "--condRef"), + default="WT", + dest="condRef", + help="reference biological condition [default: %default]"), + +make_option(c("-b", "--batch"), + default=NULL, + dest="batch", + help="blocking factor [default: %default] or \"batch\" for example"), + +make_option(c("-f", "--fitType"), + default="parametric", + dest="fitType", + help="mean-variance relationship: [default: %default] or local"), + +make_option(c("-o", "--cooksCutoff"), + default=TRUE, + dest="cooksCutoff", + help="perform the outliers detection (default is TRUE)"), + +make_option(c("-i", "--independentFiltering"), + default=TRUE, + dest="independentFiltering", + help="perform independent filtering (default is TRUE)"), + +make_option(c("-a", "--alpha"), + default=0.05, + dest="alpha", + help="threshold of statistical significance [default: %default]"), + +make_option(c("-p", "--pAdjustMethod"), + default="BH", + dest="pAdjustMethod", + help="p-value adjustment method: \"BH\" or \"BY\" [default: %default]"), + +make_option(c("-T", "--typeTrans"), + default="VST", + dest="typeTrans", + help="transformation for PCA/clustering: \"VST\" ou \"rlog\" [default: %default]"), + +make_option(c("-l", "--locfunc"), + default="median", + dest="locfunc", + help="median or shorth to estimate the size factors [default: %default]"), + +make_option(c("-C", "--colors"), + default="dodgerblue,firebrick1,MediumVioletRed,SpringGreen,chartreuse,cyan,darkorchid,darkorange", + dest="cols", + help="colors of each biological condition on the plots\n\t\t\"col1,col2,col3,col4\"\n\t\t[default: %default]"), + +make_option(c("-g", "--graph"), action="store_true", + default=NULL, + dest="graph", + help="activate cairo type") + +) + +# now parse the command line to check which option is given and get associated values +parser <- OptionParser(usage="usage: %prog [options]", + option_list=option_list, + description="Compare two or more biological conditions in a RNA-Seq framework with DESeq2.", + epilogue="For comments, bug reports etc... please contact Hugo Varet ") +opt <- parse_args(parser, args=commandArgs(trailingOnly=TRUE), positional_arguments=0)$options + +# get options and arguments +workDir <- getwd() +projectName <- opt$projectName # name of the project +author <- opt$author # author of the statistical analysis/report +targetFile <- opt$targetFile # path to the design/target file +rawDir <- opt$rawDir # path to the directory containing raw counts files +featuresToRemove <- unlist(strsplit(opt$FTR, ",")) # names of the features to be removed (specific HTSeq-count information and rRNA for example) +varInt <- opt$varInt # factor of interest +condRef <- opt$condRef # reference biological condition +batch <- opt$batch # blocking factor: NULL (default) or "batch" for example +fitType <- opt$fitType # mean-variance relationship: "parametric" (default) or "local" +cooksCutoff <- opt$cooksCutoff # outliers detection threshold (NULL to let DESeq2 choosing it) +independentFiltering <- opt$independentFiltering # TRUE/FALSE to perform independent filtering (default is TRUE) +alpha <- as.numeric(opt$alpha) # threshold of statistical significance +pAdjustMethod <- opt$pAdjustMethod # p-value adjustment method: "BH" (default) or "BY" +typeTrans <- opt$typeTrans # transformation for PCA/clustering: "VST" ou "rlog" +locfunc <- opt$locfunc # "median" (default) or "shorth" to estimate the size factors +colors <- unlist(strsplit(opt$cols, ",")) # vector of colors of each biologicial condition on the plots +graph <- opt$graph # cario activted or not default NULL +print(graph) +stop("now") +# print(paste("workDir", workDir)) +# print(paste("projectName", projectName)) +# print(paste("author", author)) +# print(paste("targetFile", targetFile)) +# print(paste("rawDir", rawDir)) +# print(paste("varInt", varInt)) +# print(paste("condRef", condRef)) +# print(paste("batch", batch)) +# print(paste("fitType", fitType)) +# print(paste("cooksCutoff", cooksCutoff)) +# print(paste("independentFiltering", independentFiltering)) +# print(paste("alpha", alpha)) +# print(paste("pAdjustMethod", pAdjustMethod)) +# print(paste("typeTrans", typeTrans)) +# print(paste("locfunc", locfunc)) +# print(paste("featuresToRemove", featuresToRemove)) +# print(paste("colors", colors)) + +################################################################################ +### running script ### +################################################################################ +# setwd(workDir) +library(SARTools) +#activate cairo plotting if not null +if (! is.null(graph)) options(bitmapType='cairo') +# checking parameters +problem <- checkParameters.DESeq2(projectName=projectName,author=author,targetFile=targetFile, + rawDir=rawDir,featuresToRemove=featuresToRemove,varInt=varInt, + condRef=condRef,batch=batch,fitType=fitType,cooksCutoff=cooksCutoff, + independentFiltering=independentFiltering,alpha=alpha,pAdjustMethod=pAdjustMethod, + typeTrans=typeTrans,locfunc=locfunc,colors=colors) +if (problem) quit(save="yes") + +# loading target file +target <- loadTargetFile(targetFile=targetFile, varInt=varInt, condRef=condRef, batch=batch) + +# loading counts +counts <- loadCountData(target=target, rawDir=rawDir, featuresToRemove=featuresToRemove) + +# description plots +majSequences <- descriptionPlots(counts=counts, group=target[,varInt], col=colors) + +# analysis with DESeq2 +out.DESeq2 <- run.DESeq2(counts=counts, target=target, varInt=varInt, batch=batch, + locfunc=locfunc, fitType=fitType, pAdjustMethod=pAdjustMethod, + cooksCutoff=cooksCutoff, independentFiltering=independentFiltering, alpha=alpha) + +# PCA + clustering +exploreCounts(object=out.DESeq2$dds, group=target[,varInt], typeTrans=typeTrans, col=colors) + +# summary of the analysis (boxplots, dispersions, diag size factors, export table, nDiffTotal, histograms, MA plot) +summaryResults <- summarizeResults.DESeq2(out.DESeq2, group=target[,varInt], col=colors, + independentFiltering=independentFiltering, + cooksCutoff=cooksCutoff, alpha=alpha) + +# save image of the R session +save.image(file=paste0(projectName, ".RData")) + +# generating HTML report +writeReport.DESeq2(target=target, counts=counts, out.DESeq2=out.DESeq2, summaryResults=summaryResults, + majSequences=majSequences, workDir=workDir, projectName=projectName, author=author, + targetFile=targetFile, rawDir=rawDir, featuresToRemove=featuresToRemove, varInt=varInt, + condRef=condRef, batch=batch, fitType=fitType, cooksCutoff=cooksCutoff, + independentFiltering=independentFiltering, alpha=alpha, pAdjustMethod=pAdjustMethod, + typeTrans=typeTrans, locfunc=locfunc, colors=colors) diff --git a/R/carioSizeWrapper.R b/R/carioSizeWrapper.R new file mode 100644 index 0000000..4534c2a --- /dev/null +++ b/R/carioSizeWrapper.R @@ -0,0 +1,16 @@ +#' Cario Size Wrapper +#' +#' Limits the pixel size to either to the minimum of the given and the max allowed pixel size 32767x32767 pixels if +#' cario graphical has been choosen +#' +#' @param requested pixel size +#' @return the minimum between the requested and maximal allowed pixel size if cario is selected otherwise the requested pixel size +#' @author vipul patel + + + + +carioSizeWrapper <- function(pixel_re){ + if(options("bitmapType") == "cairo") return(min(pixel_re,32767)) else return(pixel_re) + +} \ No newline at end of file diff --git a/man/carioSizeWrapper.Rd b/man/carioSizeWrapper.Rd new file mode 100644 index 0000000..ccf768b --- /dev/null +++ b/man/carioSizeWrapper.Rd @@ -0,0 +1,21 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/cairoSizeWrapper.R +\name{carioSizeWrapper} +\alias{carioSizeWrapper} +\title{Cario Size Wrapper} +\usage{ +carioSizeWrapper(pixel_re) +} +\arguments{ +\item{requested}{pixel size} +} +\value{ +the minimum between the requested and maximal allowed pixel size if cario is selected otherwise the requested pixel size +} +\description{ +Limits the pixel size to either to the minimum of the given and the max allowed pixel size 32767x32767 pixels if +cario graphical has been choosen +} +\author{ +vipul patel +} From 38a85528801896fcbdd192cd0b75fff815a4d15b Mon Sep 17 00:00:00 2001 From: patelv Date: Mon, 19 Mar 2018 10:26:50 +0100 Subject: [PATCH 09/12] rm 1 --- 1 | 193 -------------------------------------------------------------- 1 file changed, 193 deletions(-) delete mode 100644 1 diff --git a/1 b/1 deleted file mode 100644 index 4f2bf2c..0000000 --- a/1 +++ /dev/null @@ -1,193 +0,0 @@ -################################################################################ -### R script to compare several conditions with the SARTools and DESeq2 packages -### Hugo Varet -### Dec 11th, 2017 -### designed to be executed with SARTools 1.6.0 -### run "Rscript template_script_DESeq2_CL.r --help" to get some help -################################################################################ - -rm(list=ls()) # remove all the objects from the R session -library(optparse) # to run the script in command lines - -# options list with associated default value. -option_list <- list( -make_option(c("-P", "--projectName"), - default=basename(getwd()), - dest="projectName", - help="name of the project used for the report [default: name of the current directory]."), - -make_option(c("-A", "--author"), - default=Sys.info()[7], - dest="author", - help="name of the report author [default: %default]."), - -make_option(c("-t", "--targetFile"), - default="target.txt", - dest="targetFile", - help="path to the design/target file [default: %default]."), - -make_option(c("-r", "--rawDir"), - default="raw", - dest="rawDir", - help="path to the directory containing the HTSeq files [default: %default]."), - -make_option(c("-F", "--featuresToRemove"), - default="alignment_not_unique,ambiguous,no_feature,not_aligned,too_low_aQual", - dest="FTR", - help="names of the features to be removed, more than once can be specified [default: %default]"), - -make_option(c("-v", "--varInt"), - default="group", - dest="varInt", - help="factor of interest [default: %default]"), - -make_option(c("-c", "--condRef"), - default="WT", - dest="condRef", - help="reference biological condition [default: %default]"), - -make_option(c("-b", "--batch"), - default=NULL, - dest="batch", - help="blocking factor [default: %default] or \"batch\" for example"), - -make_option(c("-f", "--fitType"), - default="parametric", - dest="fitType", - help="mean-variance relationship: [default: %default] or local"), - -make_option(c("-o", "--cooksCutoff"), - default=TRUE, - dest="cooksCutoff", - help="perform the outliers detection (default is TRUE)"), - -make_option(c("-i", "--independentFiltering"), - default=TRUE, - dest="independentFiltering", - help="perform independent filtering (default is TRUE)"), - -make_option(c("-a", "--alpha"), - default=0.05, - dest="alpha", - help="threshold of statistical significance [default: %default]"), - -make_option(c("-p", "--pAdjustMethod"), - default="BH", - dest="pAdjustMethod", - help="p-value adjustment method: \"BH\" or \"BY\" [default: %default]"), - -make_option(c("-T", "--typeTrans"), - default="VST", - dest="typeTrans", - help="transformation for PCA/clustering: \"VST\" ou \"rlog\" [default: %default]"), - -make_option(c("-l", "--locfunc"), - default="median", - dest="locfunc", - help="median or shorth to estimate the size factors [default: %default]"), - -make_option(c("-C", "--colors"), - default="dodgerblue,firebrick1,MediumVioletRed,SpringGreen,chartreuse,cyan,darkorchid,darkorange", - dest="cols", - help="colors of each biological condition on the plots\n\t\t\"col1,col2,col3,col4\"\n\t\t[default: %default]"), - -make_option(c("-g", "--graph"), action="store_true", - default=NULL, - dest="graph", - help="activate cairo type") - -) - -# now parse the command line to check which option is given and get associated values -parser <- OptionParser(usage="usage: %prog [options]", - option_list=option_list, - description="Compare two or more biological conditions in a RNA-Seq framework with DESeq2.", - epilogue="For comments, bug reports etc... please contact Hugo Varet ") -opt <- parse_args(parser, args=commandArgs(trailingOnly=TRUE), positional_arguments=0)$options - -# get options and arguments -workDir <- getwd() -projectName <- opt$projectName # name of the project -author <- opt$author # author of the statistical analysis/report -targetFile <- opt$targetFile # path to the design/target file -rawDir <- opt$rawDir # path to the directory containing raw counts files -featuresToRemove <- unlist(strsplit(opt$FTR, ",")) # names of the features to be removed (specific HTSeq-count information and rRNA for example) -varInt <- opt$varInt # factor of interest -condRef <- opt$condRef # reference biological condition -batch <- opt$batch # blocking factor: NULL (default) or "batch" for example -fitType <- opt$fitType # mean-variance relationship: "parametric" (default) or "local" -cooksCutoff <- opt$cooksCutoff # outliers detection threshold (NULL to let DESeq2 choosing it) -independentFiltering <- opt$independentFiltering # TRUE/FALSE to perform independent filtering (default is TRUE) -alpha <- as.numeric(opt$alpha) # threshold of statistical significance -pAdjustMethod <- opt$pAdjustMethod # p-value adjustment method: "BH" (default) or "BY" -typeTrans <- opt$typeTrans # transformation for PCA/clustering: "VST" ou "rlog" -locfunc <- opt$locfunc # "median" (default) or "shorth" to estimate the size factors -colors <- unlist(strsplit(opt$cols, ",")) # vector of colors of each biologicial condition on the plots -graph <- opt$graph # cario activted or not default NULL -print(graph) -stop("now") -# print(paste("workDir", workDir)) -# print(paste("projectName", projectName)) -# print(paste("author", author)) -# print(paste("targetFile", targetFile)) -# print(paste("rawDir", rawDir)) -# print(paste("varInt", varInt)) -# print(paste("condRef", condRef)) -# print(paste("batch", batch)) -# print(paste("fitType", fitType)) -# print(paste("cooksCutoff", cooksCutoff)) -# print(paste("independentFiltering", independentFiltering)) -# print(paste("alpha", alpha)) -# print(paste("pAdjustMethod", pAdjustMethod)) -# print(paste("typeTrans", typeTrans)) -# print(paste("locfunc", locfunc)) -# print(paste("featuresToRemove", featuresToRemove)) -# print(paste("colors", colors)) - -################################################################################ -### running script ### -################################################################################ -# setwd(workDir) -library(SARTools) -#activate cairo plotting if not null -if (! is.null(graph)) options(bitmapType='cairo') -# checking parameters -problem <- checkParameters.DESeq2(projectName=projectName,author=author,targetFile=targetFile, - rawDir=rawDir,featuresToRemove=featuresToRemove,varInt=varInt, - condRef=condRef,batch=batch,fitType=fitType,cooksCutoff=cooksCutoff, - independentFiltering=independentFiltering,alpha=alpha,pAdjustMethod=pAdjustMethod, - typeTrans=typeTrans,locfunc=locfunc,colors=colors) -if (problem) quit(save="yes") - -# loading target file -target <- loadTargetFile(targetFile=targetFile, varInt=varInt, condRef=condRef, batch=batch) - -# loading counts -counts <- loadCountData(target=target, rawDir=rawDir, featuresToRemove=featuresToRemove) - -# description plots -majSequences <- descriptionPlots(counts=counts, group=target[,varInt], col=colors) - -# analysis with DESeq2 -out.DESeq2 <- run.DESeq2(counts=counts, target=target, varInt=varInt, batch=batch, - locfunc=locfunc, fitType=fitType, pAdjustMethod=pAdjustMethod, - cooksCutoff=cooksCutoff, independentFiltering=independentFiltering, alpha=alpha) - -# PCA + clustering -exploreCounts(object=out.DESeq2$dds, group=target[,varInt], typeTrans=typeTrans, col=colors) - -# summary of the analysis (boxplots, dispersions, diag size factors, export table, nDiffTotal, histograms, MA plot) -summaryResults <- summarizeResults.DESeq2(out.DESeq2, group=target[,varInt], col=colors, - independentFiltering=independentFiltering, - cooksCutoff=cooksCutoff, alpha=alpha) - -# save image of the R session -save.image(file=paste0(projectName, ".RData")) - -# generating HTML report -writeReport.DESeq2(target=target, counts=counts, out.DESeq2=out.DESeq2, summaryResults=summaryResults, - majSequences=majSequences, workDir=workDir, projectName=projectName, author=author, - targetFile=targetFile, rawDir=rawDir, featuresToRemove=featuresToRemove, varInt=varInt, - condRef=condRef, batch=batch, fitType=fitType, cooksCutoff=cooksCutoff, - independentFiltering=independentFiltering, alpha=alpha, pAdjustMethod=pAdjustMethod, - typeTrans=typeTrans, locfunc=locfunc, colors=colors) From 939191412a34bfafa21870b4357ac73cf1556d08 Mon Sep 17 00:00:00 2001 From: patelv Date: Mon, 19 Mar 2018 15:47:35 +0100 Subject: [PATCH 10/12] fix typo --- R/MAPlot.R | 2 +- R/PCAPlot.R | 2 +- R/cairoSizeWrapper.R | 16 ++++++++++++++++ R/diagSizeFactorsPlots.R | 2 +- R/pairwiseScatterPlots.R | 2 +- R/rawpHist.R | 2 +- R/volcanoPlot.r | 2 +- 7 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 R/cairoSizeWrapper.R diff --git a/R/MAPlot.R b/R/MAPlot.R index b91b163..b8bfc38 100755 --- a/R/MAPlot.R +++ b/R/MAPlot.R @@ -11,7 +11,7 @@ MAPlot <- function(complete, alpha=0.05, outfile=TRUE){ ncol <- ifelse(length(complete)<=4, ceiling(sqrt(length(complete))), 3) nrow <- ceiling(length(complete)/ncol) - if (outfile) png(filename="figures/MAPlot.png", width=carioSizeWrapper(1800*ncol), height=carioSizeWrapper(1800*nrow), res=300) + if (outfile) png(filename="figures/MAPlot.png", width=cairoSizeWrapper(1800*ncol), height=cairoSizeWrapper(1800*nrow), res=300) par(mfrow=c(nrow,ncol)) for (name in names(complete)){ complete.name <- complete[[name]] diff --git a/R/PCAPlot.R b/R/PCAPlot.R index 02bb58a..c0e8f0c 100755 --- a/R/PCAPlot.R +++ b/R/PCAPlot.R @@ -20,7 +20,7 @@ PCAPlot <- function(counts.trans, group, n=min(500,nrow(counts.trans)), prp <- round(prp[1:3],2) # create figure - if (outfile) png(filename="figures/PCA.png",width=carioSizeWrapper(1800*2),height=carioSizeWrapper(1800),res=300) + if (outfile) png(filename="figures/PCA.png",width=cairoSizeWrapper(1800*2),height=cairoSizeWrapper(1800),res=300) par(mfrow=c(1,2)) # axes 1 et 2 abs=range(pca$x[,1]); abs=abs(abs[2]-abs[1])/25; diff --git a/R/cairoSizeWrapper.R b/R/cairoSizeWrapper.R new file mode 100644 index 0000000..153e76a --- /dev/null +++ b/R/cairoSizeWrapper.R @@ -0,0 +1,16 @@ +#' Cairo Size Wrapper +#' +#' Limits the pixel size to either to the minimum of the given and the max allowed pixel size 32767x32767 pixels if +#' Cairo graphical has been choosen +#' +#' @param requested pixel size +#' @return the minimum between the requested and maximal allowed pixel size if Cairo is selected otherwise the requested pixel size +#' @author vipul patel + + + + +cairoSizeWrapper <- function(pixel_re){ + if(options("bitmapType") == "cairo") return(min(pixel_re,32767)) else return(pixel_re) + +} \ No newline at end of file diff --git a/R/diagSizeFactorsPlots.R b/R/diagSizeFactorsPlots.R index a2d9433..24771b3 100755 --- a/R/diagSizeFactorsPlots.R +++ b/R/diagSizeFactorsPlots.R @@ -16,7 +16,7 @@ diagSizeFactorsPlots <- function(dds, group, col=c("lightblue","orange","MediumV if ("diag" %in% plots){ ncol <- ifelse(ncol(counts(dds))<=4, ceiling(sqrt(ncol(counts(dds)))), 3) nrow <- ceiling(ncol(counts(dds))/ncol) - if (outfile) png(filename="figures/diagSizeFactorsHist.png", width=carioSizeWrapper(1400*ncol), height=carioSizeWrapper(1400*nrow), res=300) + if (outfile) png(filename="figures/diagSizeFactorsHist.png", width=cairoSizeWrapper(1400*ncol), height=cairoSizeWrapper(1400*nrow), res=300) par(mfrow=c(nrow,ncol)) geomeans <- exp(rowMeans(log(counts(dds)))) samples <- colnames(counts(dds)) diff --git a/R/pairwiseScatterPlots.R b/R/pairwiseScatterPlots.R index a8eb879..c855418 100755 --- a/R/pairwiseScatterPlots.R +++ b/R/pairwiseScatterPlots.R @@ -11,7 +11,7 @@ pairwiseScatterPlots <- function(counts, group, outfile=TRUE){ ncol <- ncol(counts) if (ncol <= 30){ - if (outfile) png(filename="figures/pairwiseScatter.png", width=carioSizeWrapper(700*ncol), height=carioSizeWrapper(700*ncol), res=300) + if (outfile) png(filename="figures/pairwiseScatter.png", width=cairoSizeWrapper(700*ncol), height=cairoSizeWrapper(700*ncol), res=300) # defining panel and lower.panel functions panel <- function(x,y,...){points(x, y, pch=".");abline(a=0,b=1,lty=2);} lower.panel <- function(x,y,...){ diff --git a/R/rawpHist.R b/R/rawpHist.R index 17ee346..8506d7b 100755 --- a/R/rawpHist.R +++ b/R/rawpHist.R @@ -10,7 +10,7 @@ rawpHist <- function(complete, outfile=TRUE){ ncol <- ifelse(length(complete)<=4, ceiling(sqrt(length(complete))), 3) nrow <- ceiling(length(complete)/ncol) - if (outfile) png(filename="figures/rawpHist.png", width=carioSizeWrapper(1800*ncol), height=carioSizeWrapper(1800*nrow), res=300) + if (outfile) png(filename="figures/rawpHist.png", width=cairoSizeWrapper(1800*ncol), height=cairoSizeWrapper(1800*nrow), res=300) par(mfrow=c(nrow,ncol)) for (name in names(complete)){ hist(complete[[name]][,"pvalue"], nclass=50, xlab="Raw p-value", diff --git a/R/volcanoPlot.r b/R/volcanoPlot.r index cfcf8ad..8f81e65 100755 --- a/R/volcanoPlot.r +++ b/R/volcanoPlot.r @@ -11,7 +11,7 @@ volcanoPlot <- function(complete, alpha=0.05, outfile=TRUE){ ncol <- ifelse(length(complete)<=4, ceiling(sqrt(length(complete))), 3) nrow <- ceiling(length(complete)/ncol) - if (outfile) png(filename="figures/volcanoPlot.png", width=carioSizeWrapper(1800*ncol), height=carioSizeWrapper(1800*nrow), res=300) + if (outfile) png(filename="figures/volcanoPlot.png", width=cairoSizeWrapper(1800*ncol), height=cairoSizeWrapper(1800*nrow), res=300) par(mfrow=c(nrow,ncol)) for (name in names(complete)){ complete.name <- complete[[name]] From be7783543cd999c4c1df6a5c85d500068c93ce39 Mon Sep 17 00:00:00 2001 From: patelv Date: Mon, 19 Mar 2018 15:49:12 +0100 Subject: [PATCH 11/12] change graph to forceCairoGraph --- R/carioSizeWrapper.R | 16 ---------------- template_script_DESeq2.r | 4 ++-- template_script_DESeq2_CL.r | 8 ++++---- template_script_edgeR.r | 4 ++-- template_script_edgeR_CL.r | 8 ++++---- 5 files changed, 12 insertions(+), 28 deletions(-) delete mode 100644 R/carioSizeWrapper.R diff --git a/R/carioSizeWrapper.R b/R/carioSizeWrapper.R deleted file mode 100644 index 4534c2a..0000000 --- a/R/carioSizeWrapper.R +++ /dev/null @@ -1,16 +0,0 @@ -#' Cario Size Wrapper -#' -#' Limits the pixel size to either to the minimum of the given and the max allowed pixel size 32767x32767 pixels if -#' cario graphical has been choosen -#' -#' @param requested pixel size -#' @return the minimum between the requested and maximal allowed pixel size if cario is selected otherwise the requested pixel size -#' @author vipul patel - - - - -carioSizeWrapper <- function(pixel_re){ - if(options("bitmapType") == "cairo") return(min(pixel_re,32767)) else return(pixel_re) - -} \ No newline at end of file diff --git a/template_script_DESeq2.r b/template_script_DESeq2.r index 6c9c711..d2a52a5 100755 --- a/template_script_DESeq2.r +++ b/template_script_DESeq2.r @@ -37,14 +37,14 @@ locfunc <- "median" # "median" (default) or "sh colors <- c("dodgerblue","firebrick1", # vector of colors of each biological condition on the plots "MediumVioletRed","SpringGreen") -graph <- FALSE +forceCairoGraph <- FALSE ################################################################################ ### running script ### ################################################################################ setwd(workDir) library(SARTools) -if (graph) options(bitmapType='cairo') +if (forceCairoGraph) options(bitmapType='cairo') # checking parameters checkParameters.DESeq2(projectName=projectName,author=author,targetFile=targetFile, rawDir=rawDir,featuresToRemove=featuresToRemove,varInt=varInt, diff --git a/template_script_DESeq2_CL.r b/template_script_DESeq2_CL.r index ce126e7..67346cc 100755 --- a/template_script_DESeq2_CL.r +++ b/template_script_DESeq2_CL.r @@ -91,9 +91,9 @@ make_option(c("-C", "--colors"), dest="cols", help="colors of each biological condition on the plots\n\t\t\"col1,col2,col3,col4\"\n\t\t[default: %default]"), -make_option(c("-g", "--graph"), action="store_true", +make_option(c("-g", "--forceCairoGraph"), action="store_true", default=FALSE, - dest="graph", + dest="forceCairoGraph", help="activate cairo type") ) @@ -123,7 +123,7 @@ pAdjustMethod <- opt$pAdjustMethod # p-value adjustment method typeTrans <- opt$typeTrans # transformation for PCA/clustering: "VST" ou "rlog" locfunc <- opt$locfunc # "median" (default) or "shorth" to estimate the size factors colors <- unlist(strsplit(opt$cols, ",")) # vector of colors of each biologicial condition on the plots -graph <- opt$graph # cario activted or not default NULL +forceCairoGraph <- opt$forceCairoGraph # force cairo as plotting device if enabled # print(paste("workDir", workDir)) # print(paste("projectName", projectName)) # print(paste("author", author)) @@ -148,7 +148,7 @@ graph <- opt$graph # cario activted or not default NULL # setwd(workDir) library(SARTools) #activate cairo plotting if not null -if (graph) options(bitmapType='cairo') +if (forceCairoGraph) options(bitmapType='cairo') # checking parameters problem <- checkParameters.DESeq2(projectName=projectName,author=author,targetFile=targetFile, rawDir=rawDir,featuresToRemove=featuresToRemove,varInt=varInt, diff --git a/template_script_edgeR.r b/template_script_edgeR.r index f88acb8..10d0c89 100755 --- a/template_script_edgeR.r +++ b/template_script_edgeR.r @@ -35,14 +35,14 @@ normalizationMethod <- "TMM" # normalization method: "TM colors <- c("dodgerblue","firebrick1", # vector of colors of each biological condition on the plots "MediumVioletRed","SpringGreen") -graph <- FALSE +forceCairoGraph <- FALSE ################################################################################ ### running script ### ################################################################################ setwd(workDir) library(SARTools) -if (graph) options(bitmapType='cairo') +if (forceCairoGraph) options(bitmapType='cairo') # checking parameters checkParameters.edgeR(projectName=projectName,author=author,targetFile=targetFile, rawDir=rawDir,featuresToRemove=featuresToRemove,varInt=varInt, diff --git a/template_script_edgeR_CL.r b/template_script_edgeR_CL.r index 1958112..baa28a6 100755 --- a/template_script_edgeR_CL.r +++ b/template_script_edgeR_CL.r @@ -81,9 +81,9 @@ make_option(c("-C", "--colors"), dest="cols", help="colors of each biological condition on the plots\n\t\t\"col1,col2,col3,col4\"\n\t\t[default: %default]"), -make_option(c("-g", "--graph"), action="store_true", +make_option(c("-g", "--forceCairoGraph"), action="store_true", default=FALSE, - dest="graph", + dest="forceCairoGraph", help="activate cairo type") ) @@ -110,7 +110,7 @@ gene.selection <- opt$gene.selection # selection of the features normalizationMethod <- opt$normalizationMethod # normalization method in calcNormFactors cpmCutoff <- opt$cpmCutoff # counts-per-million cut-off to filter low counts colors <- unlist(strsplit(opt$cols, ",")) # vector of colors of each biologicial condition on the plots -graph <- opt$graph +forceCairoGraph <- opt$forceCairoGraph # force cairo as plotting device if enabled # print(paste("workDir", workDir)) # print(paste("projectName", projectName)) # print(paste("author", author)) @@ -132,7 +132,7 @@ graph <- opt$graph ################################################################################ # setwd(workDir) library(SARTools) -if (graph) options(bitmapType='cairo') +if (forceCairoGraph) options(bitmapType='cairo') # checking parameters problem <- checkParameters.edgeR(projectName=projectName,author=author,targetFile=targetFile, rawDir=rawDir,featuresToRemove=featuresToRemove,varInt=varInt, From 20b29803f38fc66acf22a2d05a14fd6a63b6efd3 Mon Sep 17 00:00:00 2001 From: hvaret Date: Tue, 20 Mar 2018 08:36:10 +0100 Subject: [PATCH 12/12] 1.6.1 --- .RData | Bin 2124 -> 0 bytes DESCRIPTION | 4 +- LICENSE | 339 ------------------ NEWS | 5 + R/cairoSizeWrapper.R | 14 +- inst/medecine-sciences.csl | 0 ...arioSizeWrapper.Rd => cairoSizeWrapper.Rd} | 14 +- template_script_DESeq2.r | 7 +- template_script_DESeq2_CL.r | 17 +- template_script_edgeR.r | 7 +- template_script_edgeR_CL.r | 16 +- vignettes/SARTools.rmd | 4 +- 12 files changed, 49 insertions(+), 378 deletions(-) delete mode 100644 .RData delete mode 100644 LICENSE mode change 100644 => 100755 inst/medecine-sciences.csl rename man/{carioSizeWrapper.Rd => cairoSizeWrapper.Rd} (60%) diff --git a/.RData b/.RData deleted file mode 100644 index 68a978a0ca2644a0d856cc28a723ff6bf15e29b5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2124 zcmV-S2($MeiwFP!000001MORFliM^9&b?pmDD;K*FL*Ko12b`s7Cyki0M~1eGSike zmzFY2$tboQi*qbjmhW2r3H$^8BxNPri7i<-O*#9MJ5B29Wi36=?rK*%8QywwW9P|E zr_)*OtgWwfR@dNheHFe|I_sS-{JZJUfU+2#F2iR#Yu$0FJH>1gBsg#J2*VRboRjNW z%Uk!bOOn}RLIcc)*v*=Ek0VCH>5mNKFrVxAh;fFKIG48Wyg>6_7qJt{9G|%578Fjg zx>}TQpEB6a(n;yC7o9d#5cuT<$?*%#@CnDqmfw@BW6mnJlv;TU8k6uJ`V=DTk^SnsOKV?=I9k_oaF~5glow+G?IS3yC6tQX|xn~wy zKGzcz`FV$rgQ!#CIl*cO4aWhIK&IBSvi5=MsA9m1kG%j*RVA?>C}X<;4X0H@FWGj< z2PkKQBNn3Sddw+Phpr0{l!0BLJ|IF^YctEAs&G< ztb$wvw-t#>qb#4A?JNu7YO%ATY>nPLcCRGp6Aua75)6?L-T;Bi5^$GZ+!)A?0pzZ2 z&lAHMP~IvD*I=G!pBlzD81?{Jq1qEjL+F$^C=kxfB?6Nr@GdW*F~BDVz_)BWySS(U z?u~+I3HDs+R_;H#dw0bE_WlI2lM``7WSU)pt_96KDZVG;WBeS=qWnzOKrb$&F~~i$ zj_2uKEjnHju18D7{Js+YuVxs9!q-85?g$qjAc0BjlW5;W1rU}WAiBnv7StI0)Byh_ z;bIEce#=v^mD#_6fL%?zBtf~%(_sHR!VENdCXZQ~@PJ?zL$u1V%y6wwGrTPlTchEl z+n*WW)?eQk>bb$G=qZ3O%+Fx3ZNCd=r7Q4-#x4DMcg^)=Y}pw|Y14^yE={^Vi-I98|5S zF)l_1E_Q8uaSd7r4_!sPo-WIK@JbSnxR@tgk34K;O!MIIV9yBvM(I9)444jVBvy}s z7hHx9b!Cll5tw73d6A}$7^oy%uY(70ZA1BYOp+=WAZ1?V$;fN z3sWFeT2*5l9GVl_ybN3e1!+m48vpvrJe7q0o^Df|FBmy~bp{82<;8nIdA!r@_F&HS zK78E}Utfr?FMH6wL}Fb8w=uG(=2Jhd>(r9x6+{cNKYVFm;+m+|oC-5?5Mk8f^Rz%e z#tSkp6g@evA~`ufOIpw>rLl@)*G3ZSMUVa?(YSAM4CyIsd>lKBM0|Yf_A!2TV|;jb z0O@U7OpBkYYs=a@X@TwPxx_y(r#o7K=Yr|iD@dBfD}^vkG3qLQ>DiIC*2YY;t!Nn> zWn0mz9?@2`YB7kmqBUort!T9st+t|dAt1LEt%d=gm@}Q`Dq6-&r>$YNHLU*+KQ$+H zZ4IlfVO5jR*096vUoe^-s zY0XdlS=Kg=2nb5l%Hi+`-sI4kh-KowHA$vfi6yo$cLsw2*f~ZqPA{MxZrw?y)Orld zWL%fCL{ARoyhRpBjHES!Y zW%^Uk(!gRQVTf%OS}*9+U*FsF=?w3s)w8`A{JJP^jy>{xZ&B&&{QDodtJFD)KL7xQ CTM4=V diff --git a/DESCRIPTION b/DESCRIPTION index 754ebb7..1d6d255 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: SARTools Type: Package Title: Statistical Analysis of RNA-Seq Tools -Version: 1.6.0 -Date: 2017-12-11 +Version: 1.6.1 +Date: 2018-03-20 Author: Marie-Agnes Dillies and Hugo Varet Maintainer: Hugo Varet Depends: R (>= 3.3.0), DESeq2 (>= 1.12.0), edgeR (>= 3.12.0), xtable diff --git a/LICENSE b/LICENSE deleted file mode 100644 index d159169..0000000 --- a/LICENSE +++ /dev/null @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. diff --git a/NEWS b/NEWS index 86486df..01ddf61 100755 --- a/NEWS +++ b/NEWS @@ -1,3 +1,8 @@ +CHANGES IN VERSION 1.6.1 +------------------------ + o new boolean parameter forceCairoGraph + o adapt size of PNG plots if width/height are too large + CHANGES IN VERSION 1.6.0 ------------------------ o use "percentage" instead of "proportion" in some plots diff --git a/R/cairoSizeWrapper.R b/R/cairoSizeWrapper.R index 153e76a..7dee149 100644 --- a/R/cairoSizeWrapper.R +++ b/R/cairoSizeWrapper.R @@ -3,14 +3,14 @@ #' Limits the pixel size to either to the minimum of the given and the max allowed pixel size 32767x32767 pixels if #' Cairo graphical has been choosen #' -#' @param requested pixel size +#' @param pixel_re requested pixel size #' @return the minimum between the requested and maximal allowed pixel size if Cairo is selected otherwise the requested pixel size #' @author vipul patel - - - cairoSizeWrapper <- function(pixel_re){ - if(options("bitmapType") == "cairo") return(min(pixel_re,32767)) else return(pixel_re) - -} \ No newline at end of file + if (options("bitmapType") == "cairo"){ + return(min(pixel_re,32767)) + } else{ + return(pixel_re) + } +} diff --git a/inst/medecine-sciences.csl b/inst/medecine-sciences.csl old mode 100644 new mode 100755 diff --git a/man/carioSizeWrapper.Rd b/man/cairoSizeWrapper.Rd similarity index 60% rename from man/carioSizeWrapper.Rd rename to man/cairoSizeWrapper.Rd index ccf768b..672d57b 100644 --- a/man/carioSizeWrapper.Rd +++ b/man/cairoSizeWrapper.Rd @@ -1,20 +1,20 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/cairoSizeWrapper.R -\name{carioSizeWrapper} -\alias{carioSizeWrapper} -\title{Cario Size Wrapper} +\name{cairoSizeWrapper} +\alias{cairoSizeWrapper} +\title{Cairo Size Wrapper} \usage{ -carioSizeWrapper(pixel_re) +cairoSizeWrapper(pixel_re) } \arguments{ -\item{requested}{pixel size} +\item{pixel_re}{requested pixel size} } \value{ -the minimum between the requested and maximal allowed pixel size if cario is selected otherwise the requested pixel size +the minimum between the requested and maximal allowed pixel size if Cairo is selected otherwise the requested pixel size } \description{ Limits the pixel size to either to the minimum of the given and the max allowed pixel size 32767x32767 pixels if -cario graphical has been choosen +Cairo graphical has been choosen } \author{ vipul patel diff --git a/template_script_DESeq2.r b/template_script_DESeq2.r index d2a52a5..b724635 100755 --- a/template_script_DESeq2.r +++ b/template_script_DESeq2.r @@ -1,8 +1,8 @@ ################################################################################ ### R script to compare several conditions with the SARTools and DESeq2 packages ### Hugo Varet -### Dec 11th, 2017 -### designed to be executed with SARTools 1.6.0 +### March 20th, 2018 +### designed to be executed with SARTools 1.6.1 ################################################################################ ################################################################################ @@ -44,7 +44,8 @@ forceCairoGraph <- FALSE ################################################################################ setwd(workDir) library(SARTools) -if (forceCairoGraph) options(bitmapType='cairo') +if (forceCairoGraph) options(bitmapType="cairo") + # checking parameters checkParameters.DESeq2(projectName=projectName,author=author,targetFile=targetFile, rawDir=rawDir,featuresToRemove=featuresToRemove,varInt=varInt, diff --git a/template_script_DESeq2_CL.r b/template_script_DESeq2_CL.r index 67346cc..868a91a 100755 --- a/template_script_DESeq2_CL.r +++ b/template_script_DESeq2_CL.r @@ -1,8 +1,8 @@ ################################################################################ ### R script to compare several conditions with the SARTools and DESeq2 packages ### Hugo Varet -### Dec 11th, 2017 -### designed to be executed with SARTools 1.6.0 +### March 20th, 2018 +### designed to be executed with SARTools 1.6.1 ### run "Rscript template_script_DESeq2_CL.r --help" to get some help ################################################################################ @@ -91,10 +91,11 @@ make_option(c("-C", "--colors"), dest="cols", help="colors of each biological condition on the plots\n\t\t\"col1,col2,col3,col4\"\n\t\t[default: %default]"), -make_option(c("-g", "--forceCairoGraph"), action="store_true", - default=FALSE, - dest="forceCairoGraph", - help="activate cairo type") +make_option(c("-g", "--forceCairoGraph"), + action="store_true", + default=FALSE, + dest="forceCairoGraph", + help="activate cairo type") ) @@ -147,8 +148,8 @@ forceCairoGraph <- opt$forceCairoGraph # force cairo as plotting device if e ################################################################################ # setwd(workDir) library(SARTools) -#activate cairo plotting if not null -if (forceCairoGraph) options(bitmapType='cairo') +if (forceCairoGraph) options(bitmapType="cairo") + # checking parameters problem <- checkParameters.DESeq2(projectName=projectName,author=author,targetFile=targetFile, rawDir=rawDir,featuresToRemove=featuresToRemove,varInt=varInt, diff --git a/template_script_edgeR.r b/template_script_edgeR.r index 10d0c89..54cfde8 100755 --- a/template_script_edgeR.r +++ b/template_script_edgeR.r @@ -1,8 +1,8 @@ ################################################################################ ### R script to compare several conditions with the SARTools and edgeR packages ### Hugo Varet -### Dec 11th, 2017 -### designed to be executed with SARTools 1.6.0 +### March 20th, 2018 +### designed to be executed with SARTools 1.6.1 ################################################################################ ################################################################################ @@ -42,7 +42,8 @@ forceCairoGraph <- FALSE ################################################################################ setwd(workDir) library(SARTools) -if (forceCairoGraph) options(bitmapType='cairo') +if (forceCairoGraph) options(bitmapType="cairo") + # checking parameters checkParameters.edgeR(projectName=projectName,author=author,targetFile=targetFile, rawDir=rawDir,featuresToRemove=featuresToRemove,varInt=varInt, diff --git a/template_script_edgeR_CL.r b/template_script_edgeR_CL.r index baa28a6..b4c3984 100755 --- a/template_script_edgeR_CL.r +++ b/template_script_edgeR_CL.r @@ -1,8 +1,8 @@ ################################################################################ ### R script to compare several conditions with the SARTools and edgeR packages ### Hugo Varet -### Dec 11th, 2017 -### designed to be executed with SARTools 1.6.0 +### March 20th, 2018 +### designed to be executed with SARTools 1.6.1 ### run "Rscript template_script_edgeR_CL.r --help" to get some help ################################################################################ @@ -81,10 +81,11 @@ make_option(c("-C", "--colors"), dest="cols", help="colors of each biological condition on the plots\n\t\t\"col1,col2,col3,col4\"\n\t\t[default: %default]"), -make_option(c("-g", "--forceCairoGraph"), action="store_true", - default=FALSE, - dest="forceCairoGraph", - help="activate cairo type") +make_option(c("-g", "--forceCairoGraph"), + action="store_true", + default=FALSE, + dest="forceCairoGraph", + help="activate cairo type") ) # now parse the command line to check which option is given and get associated values @@ -132,7 +133,8 @@ forceCairoGraph <- opt$forceCairoGraph # force cairo as plotting device if e ################################################################################ # setwd(workDir) library(SARTools) -if (forceCairoGraph) options(bitmapType='cairo') +if (forceCairoGraph) options(bitmapType="cairo") + # checking parameters problem <- checkParameters.edgeR(projectName=projectName,author=author,targetFile=targetFile, rawDir=rawDir,featuresToRemove=featuresToRemove,varInt=varInt, diff --git a/vignettes/SARTools.rmd b/vignettes/SARTools.rmd index 86d9bdc..5c33e21 100755 --- a/vignettes/SARTools.rmd +++ b/vignettes/SARTools.rmd @@ -82,8 +82,8 @@ All the parameters that can be modified by the user are at the beginning of the - `cpmCutoff`: (if use of edgeR) counts-per-million cut-off to filter low counts (default is 1, set to 0 to disable filtering); - `gene.selection`: (if use of edgeR) method of selection of the features for the MultiDimensional Scaling plot (`"pairwise"` by default or `common`); - `normalizationMethod`: (if use of edgeR) normalization method in `calcNormFactors()`: `"TMM"` (default), `"RLE"` (DESeq method) or `"upperquartile"`; - - `colors`: colors used for the figures (one per biological condition), 4 are given by default. - + - `colors`: colors used for the figures (one per biological condition), 4 are given by default; + - `forceCairoGraph`: `TRUE` to force the use of cairo with `options(bitmapType="cairo")` (`FALSE` by default). All these parameters will be saved and written at the end of the HTML report in order to keep track of what has been done.