Browse code

Last-minute fix of msaPrettyPrint(); version number bumped to 1.3.7

git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/msa@116969 bc3139a8-67e5-0310-9ffc-ced21a209358

Ulrich Bodenhofer authored on 02/05/2016 09:23:23
Showing6 changed files

... ...
@@ -1,8 +1,8 @@
1 1
 Package: msa
2 2
 Type: Package
3 3
 Title: Multiple Sequence Alignment
4
-Version: 1.3.6
5
-Date: 2016-04-18
4
+Version: 1.3.7
5
+Date: 2016-05-02
6 6
 Author: Enrico Bonatesta, Christoph Horejs-Kainrath, Ulrich Bodenhofer
7 7
 Maintainer: Ulrich Bodenhofer <bodenhofer@bioinf.jku.at>
8 8
 Description: The 'msa' package provides a unified R/Bioconductor interface to
... ...
@@ -5,7 +5,7 @@ msaCheckNames <- function(x, replacement=" ", verbose=TRUE)
5 5
 
6 6
     out <- x
7 7
 
8
-    pattern <- "[^a-zA-Z0-9,;:.?!\\-\\(\\)\\'\" ]"
8
+    pattern <- "[^a-zA-Z0-9,;:.?!/\\-\\(\\)\\'\" ]"
9 9
 
10 10
     if (length(grep(pattern, rownames(x), perl=TRUE)) > 0)
11 11
     {
... ...
@@ -119,10 +119,15 @@ msaPrettyPrint <- function(x, y, output=c("pdf", "tex", "dvi", "asis"),
119 119
     showNames <- match.arg(showNames)
120 120
     showNumbering <- match.arg(showNumbering)
121 121
 
122
-    if (!is.numeric(consensusThreshold) || length(consensusThreshold) != 1 ||
123
-        consensusThreshold < 0 || consensusThreshold > 100)
122
+    if (!is.numeric(consensusThreshold) || length(consensusThreshold) < 1 ||
123
+        length(consensusThreshold) > 2 ||
124
+        any(consensusThreshold < 0) || any(consensusThreshold > 100))
124 125
         stop("The parameter consensusThreshold must be \n",
125
-             "a single numeric between 0 and 100 !")
126
+             "one or two numbers between 0 and 100 !")
127
+    else if (length(consensusThreshold) == 2 &&
128
+             consensusThreshold[1] >= consensusThreshold[2])
129
+        stop("The second percentage in consensusThreshold must be \n",
130
+             "at least as large as the first one!")
126 131
 
127 132
     if (shadingMode %in% c("identical", "similar"))
128 133
     {
... ...
@@ -236,8 +241,6 @@ msaPrettyPrint <- function(x, y, output=c("pdf", "tex", "dvi", "asis"),
236 241
     if (verbose)
237 242
         message("Multiple alignment written to temporary file ", alFile)
238 243
 
239
-    seqNames <- rownames(x)[subset]
240
-
241 244
     texOutput <- paste0("\\begin{texshade}{", stratifyFilenames(alFile), "}")
242 245
 
243 246
     if (is(x, "AAMultipleAlignment"))
... ...
@@ -275,13 +278,28 @@ msaPrettyPrint <- function(x, y, output=c("pdf", "tex", "dvi", "asis"),
275 278
                                      shadingModeArg, "]{",
276 279
                                      shadingMode, "}", sep=""))
277 280
 
281
+        if (length(consensusThreshold) == 2)
282
+            texOutput <- c(texOutput, paste("\\threshold[",
283
+                                            consensusThreshold[2], "]{",
284
+                                            consensusThreshold[1], "}",
285
+                                            sep=""))
286
+        else
287
+            texOutput <- c(texOutput, paste("\\threshold{",
288
+                                            consensusThreshold[1], "}",
289
+                                            sep=""))
290
+
278 291
         if (showConsensus != "none")
292
+        {
279 293
             texOutput <- c(texOutput,
280 294
                            paste("\\showconsensus[", consensusColors,
281 295
                                  "]{", showConsensus, "}", sep=""))
296
+        }
282 297
         else
283 298
             texOutput <- c(texOutput, "\\hideconsensus")
284 299
 
300
+        texOutput <- c(texOutput, paste("\\shadingcolors{",
301
+                                        shadingColors, "}", sep=""))
302
+
285 303
         if (showLogo != "none")
286 304
             texOutput <- c(texOutput,
287 305
                            paste("\\showsequencelogo[", logoColors,
... ...
@@ -295,11 +313,16 @@ msaPrettyPrint <- function(x, y, output=c("pdf", "tex", "dvi", "asis"),
295 313
                                  sep=""))
296 314
 
297 315
         if (showNames != "none")
316
+        {
317
+            seqNames <- rownames(x)[subset]
318
+            pattern <- "[^a-zA-Z0-9,;:.?!/\\-\\(\\)\\'\" ]"
319
+            seqNames <- gsub(pattern, " ", seqNames, perl=TRUE)
320
+
298 321
             texOutput <- c(texOutput,
299 322
                            paste("\\shownames{", showNames, "}", sep=""),
300 323
                            paste("\\nameseq{", 1:length(subset), "}{",
301
-                                 gsub('[^A-Za-z0-9]', ' ',
302
-                                      rownames(x)[subset]), "}", sep=""))
324
+                                 seqNames, "}", sep=""))
325
+        }
303 326
         else
304 327
             texOutput <- c(texOutput, "\\hidenames")
305 328
 
... ...
@@ -1,6 +1,12 @@
1 1
 Change history of package msa:
2 2
 ==============================
3 3
 
4
+Version 1.4.0:
5
+- release as part of Bioconductor 3.3
6
+
7
+Version 1.3.7:
8
+- fixes in msaPrettyPrint() function
9
+
4 10
 Version 1.3.6:
5 11
 - msaPrettyPrint() now also accepts dashes in file names
6 12
 - added section about pretty-printing wide alignments to package
... ...
@@ -32,6 +38,9 @@ Version 1.3.1:
32 38
 Version 1.3.0:
33 39
 - new branch for Bioconductor 3.3 devel
34 40
 
41
+Version 1.2.0:
42
+- release as part of Bioconductor 3.2
43
+
35 44
 Version 1.1.3: 
36 45
 - bug fix related to custom substitution matrices in the MUSCLE interface
37 46
 - correction and updates of documentation
... ...
@@ -106,8 +106,9 @@
106 106
      \code{"HotCold"}, \code{"BlueRed"}, \code{"RedBlue"}, \code{"GreenRed"},
107 107
      \code{"RedGreen"}, and \code{"Gray"} (see documentation of
108 108
      \pkg{texshade.sty} for details).}
109
-   \item{consensusThreshold}{a single numeric between 0 and 100
110
-     (see documentation of \pkg{texshade.sty} for details)}
109
+   \item{consensusThreshold}{one or two numbers between 0 and 100, where
110
+     the second one is optional and must be larger than the
111
+     first one (see documentation of \pkg{texshade.sty} for details)}
111 112
    \item{showLogo}{where to show a sequence logo; 
112 113
      possible values are \code{"top"}, \code{"bottom"}, or 
113 114
      \code{"none"} (the latter option suppresses printing of the
... ...
@@ -175,6 +176,11 @@
175 176
   and spaces (!) are allowed. If a file name would be invalid,
176 177
   \code{msaPrettyPrint} makes a default choice.
177 178
 
179
+  Moreover, if sequence names are to be printed, there might be names
180
+  that are not LaTeX-compliant and lead to LaTeX errors. In order
181
+  to check that in advance, the function \code{\link{msaCheckNames}}
182
+  is available.
183
+
178 184
   Note that \code{\link{texi2dvi}} and \code{\link{texi2pdf}} always
179 185
   save the resulting DVI/PDF files to the current working directory,
180 186
   even if the LaTeX source file is in a different directory.
... ...
@@ -202,6 +208,8 @@
202 208
   \emph{Bioinformatics} \bold{16}(2):135-139. DOI:
203 209
   \href{http://dx.doi.org/10.1093/bioinformatics/16.2.135}{10.1093/bioinformatics/16.2.135}.
204 210
 }
211
+\seealso{\code{\link{msaCheckNames}}
212
+}
205 213
 \examples{
206 214
 ## read sequences
207 215
 filepath <- system.file("examples", "exampleAA.fasta", package="msa")
... ...
@@ -817,6 +817,10 @@ bibliography below).
817 817
 \section{Change Log}
818 818
 
819 819
 \begin{description}
820
+\item[Version 1.4.0:] release as part of Bioconductor 3.3
821
+\item[Version 1.3.7:] \mbox{ }  \begin{itemize}
822
+   \item fixes in \verb+msaPrettyPrint()+ function
823
+  \end{itemize}
820 824
 \item[Version 1.3.6:] \mbox{ }  \begin{itemize}
821 825
    \item \verb+msaPrettyPrint()+ now also accepts dashes in file names
822 826
    \item added section about pretty-printing wide alignments to package vignette
... ...
@@ -843,9 +847,8 @@ bibliography below).
843 847
 \item[Version 1.3.1:] \mbox{ }  \begin{itemize}
844 848
    \item fixes in Makefiles and Makevars files to account for changes in build system
845 849
   \end{itemize}
846
-\item[Version 1.3.0:] \mbox{ }  \begin{itemize}
847
-    \item new branch for Bioconductor 3.3 devel
848
-  \end{itemize}
850
+\item[Version 1.3.0:] devel branch created from version 1.2.0
851
+\item[Version 1.2.0:] release as part of Bioconductor 3.2
849 852
 \item[Version 1.1.3:] \mbox{ }  \begin{itemize}
850 853
     \item bug fix related to custom substitution matrices
851 854
       in the MUSCLE interface
... ...
@@ -866,8 +869,10 @@ bibliography below).
866 869
       \verb+msaPrettyPrint()+
867 870
     \item updated citation information
868 871
   \end{itemize}
869
-\item[Version 1.1.1:] fix of \verb+msa()+ function
870
-\item[Version 1.1.0:] new branch for Bioconductor 3.2 devel
872
+\item[Version 1.1.1:]  \mbox{ }  \begin{itemize}
873
+    \item fix of \verb+msa()+ function
874
+  \end{itemize}
875
+\item[Version 1.1.0:] devel branch created from version 1.0.0
871 876
 \item[Version 1.0.0:] first official release as part of Bioconductor 3.1
872 877
 \end{description}
873 878