miga-base 1.2.17.1 → 1.2.17.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/lib/miga/version.rb +2 -2
  3. data/utils/enveomics/Manifest/Tasks/mapping.json +39 -11
  4. data/utils/enveomics/Manifest/Tasks/remote.json +2 -1
  5. data/utils/enveomics/Scripts/BedGraph.tad.rb +98 -53
  6. data/utils/enveomics/Scripts/SRA.download.bash +14 -2
  7. data/utils/enveomics/Tests/low-cov.bg.gz +0 -0
  8. data/utils/enveomics/enveomics.R/DESCRIPTION +5 -5
  9. data/utils/enveomics/enveomics.R/R/autoprune.R +99 -87
  10. data/utils/enveomics/enveomics.R/R/barplot.R +116 -97
  11. data/utils/enveomics/enveomics.R/R/cliopts.R +65 -59
  12. data/utils/enveomics/enveomics.R/R/df2dist.R +96 -58
  13. data/utils/enveomics/enveomics.R/R/growthcurve.R +166 -148
  14. data/utils/enveomics/enveomics.R/R/recplot.R +201 -136
  15. data/utils/enveomics/enveomics.R/R/recplot2.R +371 -304
  16. data/utils/enveomics/enveomics.R/R/tribs.R +318 -263
  17. data/utils/enveomics/enveomics.R/R/utils.R +30 -20
  18. data/utils/enveomics/enveomics.R/man/enve.TRIBS-class.Rd +4 -3
  19. data/utils/enveomics/enveomics.R/man/enve.TRIBS.merge.Rd +2 -2
  20. data/utils/enveomics/enveomics.R/man/enve.TRIBStest-class.Rd +3 -3
  21. data/utils/enveomics/enveomics.R/man/enve.__prune.iter.Rd +7 -4
  22. data/utils/enveomics/enveomics.R/man/enve.__prune.reduce.Rd +7 -4
  23. data/utils/enveomics/enveomics.R/man/enve.__tribs.Rd +4 -0
  24. data/utils/enveomics/enveomics.R/man/enve.barplot.Rd +25 -17
  25. data/utils/enveomics/enveomics.R/man/enve.col.alpha.Rd +10 -0
  26. data/utils/enveomics/enveomics.R/man/enve.col2alpha.Rd +8 -2
  27. data/utils/enveomics/enveomics.R/man/enve.df2dist.Rd +14 -0
  28. data/utils/enveomics/enveomics.R/man/enve.df2dist.group.Rd +20 -1
  29. data/utils/enveomics/enveomics.R/man/enve.df2dist.list.Rd +2 -3
  30. data/utils/enveomics/enveomics.R/man/enve.growthcurve.Rd +5 -2
  31. data/utils/enveomics/enveomics.R/man/enve.recplot.Rd +50 -42
  32. data/utils/enveomics/enveomics.R/man/enve.recplot2.ANIr.Rd +5 -2
  33. data/utils/enveomics/enveomics.R/man/enve.recplot2.__counts.Rd +3 -0
  34. data/utils/enveomics/enveomics.R/man/enve.recplot2.__peakHist.Rd +3 -0
  35. data/utils/enveomics/enveomics.R/man/enve.recplot2.__whichClosestPeak.Rd +3 -0
  36. data/utils/enveomics/enveomics.R/man/enve.recplot2.changeCutoff.Rd +3 -0
  37. data/utils/enveomics/enveomics.R/man/enve.recplot2.compareIdentities.Rd +9 -4
  38. data/utils/enveomics/enveomics.R/man/enve.recplot2.corePeak.Rd +3 -0
  39. data/utils/enveomics/enveomics.R/man/enve.recplot2.extractWindows.Rd +3 -3
  40. data/utils/enveomics/enveomics.R/man/enve.recplot2.findPeaks.Rd +0 -2
  41. data/utils/enveomics/enveomics.R/man/enve.recplot2.findPeaks.__em_e.Rd +4 -0
  42. data/utils/enveomics/enveomics.R/man/enve.recplot2.findPeaks.__em_m.Rd +5 -0
  43. data/utils/enveomics/enveomics.R/man/enve.recplot2.findPeaks.__emauto_one.Rd +11 -7
  44. data/utils/enveomics/enveomics.R/man/enve.recplot2.findPeaks.__mow_one.Rd +5 -1
  45. data/utils/enveomics/enveomics.R/man/enve.recplot2.findPeaks.__mower.Rd +3 -0
  46. data/utils/enveomics/enveomics.R/man/enve.recplot2.findPeaks.mower.Rd +2 -2
  47. data/utils/enveomics/enveomics.R/man/enve.recplot2.windowDepthThreshold.Rd +3 -3
  48. data/utils/enveomics/enveomics.R/man/enve.tribs.Rd +2 -2
  49. data/utils/enveomics/enveomics.R/man/plot.enve.GrowthCurve.Rd +3 -0
  50. data/utils/enveomics/enveomics.R/man/plot.enve.TRIBS.Rd +3 -0
  51. data/utils/enveomics/enveomics.R/man/plot.enve.TRIBStest.Rd +6 -3
  52. data/utils/enveomics/enveomics.R/man/plot.enve.recplot2.Rd +2 -2
  53. data/utils/enveomics/enveomics.R/man/summary.enve.GrowthCurve.Rd +3 -0
  54. data/utils/enveomics/enveomics.R/man/summary.enve.TRIBS.Rd +3 -0
  55. data/utils/enveomics/enveomics.R/man/summary.enve.TRIBStest.Rd +3 -0
  56. metadata +3 -37
  57. data/utils/enveomics/Pipelines/assembly.pbs/CONFIG.mock.bash +0 -69
  58. data/utils/enveomics/Pipelines/assembly.pbs/FastA.N50.pl +0 -1
  59. data/utils/enveomics/Pipelines/assembly.pbs/FastA.filterN.pl +0 -1
  60. data/utils/enveomics/Pipelines/assembly.pbs/FastA.length.pl +0 -1
  61. data/utils/enveomics/Pipelines/assembly.pbs/README.md +0 -189
  62. data/utils/enveomics/Pipelines/assembly.pbs/RUNME-2.bash +0 -112
  63. data/utils/enveomics/Pipelines/assembly.pbs/RUNME-3.bash +0 -23
  64. data/utils/enveomics/Pipelines/assembly.pbs/RUNME-4.bash +0 -44
  65. data/utils/enveomics/Pipelines/assembly.pbs/RUNME.bash +0 -50
  66. data/utils/enveomics/Pipelines/assembly.pbs/kSelector.R +0 -37
  67. data/utils/enveomics/Pipelines/assembly.pbs/newbler.pbs +0 -68
  68. data/utils/enveomics/Pipelines/assembly.pbs/newbler_preparator.pl +0 -49
  69. data/utils/enveomics/Pipelines/assembly.pbs/soap.pbs +0 -80
  70. data/utils/enveomics/Pipelines/assembly.pbs/stats.pbs +0 -57
  71. data/utils/enveomics/Pipelines/assembly.pbs/velvet.pbs +0 -63
  72. data/utils/enveomics/Pipelines/blast.pbs/01.pbs.bash +0 -38
  73. data/utils/enveomics/Pipelines/blast.pbs/02.pbs.bash +0 -73
  74. data/utils/enveomics/Pipelines/blast.pbs/03.pbs.bash +0 -21
  75. data/utils/enveomics/Pipelines/blast.pbs/BlastTab.recover_job.pl +0 -72
  76. data/utils/enveomics/Pipelines/blast.pbs/CONFIG.mock.bash +0 -98
  77. data/utils/enveomics/Pipelines/blast.pbs/FastA.split.pl +0 -1
  78. data/utils/enveomics/Pipelines/blast.pbs/README.md +0 -127
  79. data/utils/enveomics/Pipelines/blast.pbs/RUNME.bash +0 -109
  80. data/utils/enveomics/Pipelines/blast.pbs/TASK.check.bash +0 -128
  81. data/utils/enveomics/Pipelines/blast.pbs/TASK.dry.bash +0 -16
  82. data/utils/enveomics/Pipelines/blast.pbs/TASK.eo.bash +0 -22
  83. data/utils/enveomics/Pipelines/blast.pbs/TASK.pause.bash +0 -26
  84. data/utils/enveomics/Pipelines/blast.pbs/TASK.run.bash +0 -89
  85. data/utils/enveomics/Pipelines/blast.pbs/sentinel.pbs.bash +0 -29
  86. data/utils/enveomics/Pipelines/idba.pbs/README.md +0 -49
  87. data/utils/enveomics/Pipelines/idba.pbs/RUNME.bash +0 -95
  88. data/utils/enveomics/Pipelines/idba.pbs/run.pbs +0 -56
  89. data/utils/enveomics/Pipelines/trim.pbs/README.md +0 -54
  90. data/utils/enveomics/Pipelines/trim.pbs/RUNME.bash +0 -70
  91. data/utils/enveomics/Pipelines/trim.pbs/run.pbs +0 -130
@@ -1,4 +1,4 @@
1
- #==============> Define S4 classes
1
+ #==============> S4 classes
2
2
 
3
3
  #' Enveomics: Growth Curve S4 Class
4
4
  #'
@@ -13,13 +13,15 @@
13
13
  #'
14
14
  #' @exportClass
15
15
 
16
- enve.GrowthCurve <- setClass("enve.GrowthCurve",
17
- representation(
18
- design = "array",
19
- models = "list",
20
- predict = "list",
21
- call='call')
22
- ,package='enveomics.R');
16
+ enve.GrowthCurve <- setClass(
17
+ "enve.GrowthCurve",
18
+ representation(
19
+ design = "array",
20
+ models = "list",
21
+ predict = "list",
22
+ call = "call"
23
+ ), package = "enveomics.R"
24
+ )
23
25
 
24
26
  #' Attribute accessor
25
27
  #'
@@ -27,6 +29,8 @@ enve.GrowthCurve <- setClass("enve.GrowthCurve",
27
29
  #' @param name Attribute name
28
30
  setMethod("$", "enve.GrowthCurve", function(x, name) attr(x, name))
29
31
 
32
+ #==============> S4 methods
33
+
30
34
  #' Enveomics: Plot of Growth Curve
31
35
  #'
32
36
  #' Plots an \code{\link{enve.GrowthCurve}} object.
@@ -60,94 +64,99 @@ setMethod("$", "enve.GrowthCurve", function(x, name) attr(x, name))
60
64
  #' model?
61
65
  #' @param ... Any other graphic parameters.
62
66
  #'
67
+ #' @return No return value.
68
+ #'
63
69
  #' @author Luis M. Rodriguez-R [aut, cre]
64
70
  #'
65
71
  #' @method plot enve.GrowthCurve
66
72
  #' @export
67
-
68
- #==============> Define S4 methods
69
- plot.enve.GrowthCurve <- function
70
- (x,
71
- col,
72
- pt.alpha=0.9,
73
- ln.alpha=1.0,
74
- ln.lwd=1,
75
- ln.lty=1,
76
- band.alpha=0.4,
77
- band.density=NULL,
78
- band.angle=45,
79
- xp.alpha=0.5,
80
- xp.lwd=1,
81
- xp.lty=1,
82
- pch=19,
83
- new=TRUE,
84
- legend=new,
85
- add.params=FALSE,
86
- ...
87
- ){
88
-
73
+ plot.enve.GrowthCurve <- function(
74
+ x,
75
+ col,
76
+ pt.alpha = 0.9,
77
+ ln.alpha = 1.0,
78
+ ln.lwd = 1,
79
+ ln.lty = 1,
80
+ band.alpha = 0.4,
81
+ band.density = NULL,
82
+ band.angle = 45,
83
+ xp.alpha = 0.5,
84
+ xp.lwd = 1,
85
+ xp.lty = 1,
86
+ pch = 19,
87
+ new = TRUE,
88
+ legend = new,
89
+ add.params = FALSE,
90
+ ...
91
+ ) {
89
92
  # Arguments
90
- if(missing(col)){
93
+ if (missing(col)) {
91
94
  col <-
92
- if(length(x$design)==0) grey(0.2)
93
- else rainbow(length(x$design), v=3/5, s=3/5)
95
+ if (length(x$design) == 0) grey(0.2)
96
+ else rainbow(length(x$design), v = 3/5, s = 3/5)
94
97
  }
95
-
96
- if(new){
98
+
99
+ if (new) {
97
100
  # Initiate canvas
98
- od.fit.max <- max(sapply(x$predict, function(x) max(x[,"upr"])))
99
- od.obs.max <- max(sapply(x$models, function(x) max(x$data[,"od"])))
101
+ od.fit.max <- max(sapply(x$predict, function(x) max(x[, "upr"])))
102
+ od.obs.max <- max(sapply(x$models, function(x) max(x$data[, "od"])))
100
103
  opts <- list(...)
101
- plot.defaults <- list(xlab="Time", ylab="Density",
102
- xlim=range(x$predict[[1]][,"t"]), ylim=c(0, max(od.fit.max, od.obs.max)))
103
- for(i in names(plot.defaults)){
104
+ plot.defaults <- list(
105
+ xlab = "Time", ylab = "Density", xlim = range(x$predict[[1]][, "t"]),
106
+ ylim = c(0, max(od.fit.max, od.obs.max))
107
+ )
108
+ for (i in names(plot.defaults)) {
104
109
  if(is.null(opts[[i]])) opts[[i]] <- plot.defaults[[i]]
105
110
  }
106
111
  opts[["x"]] <- 1
107
112
  opts[["type"]] <- "n"
108
113
  do.call(plot, opts)
109
114
  }
110
-
115
+
111
116
  # Graphic default
112
- pch <- rep(pch, length.out=length(x$design))
113
- col <- rep(col, length.out=length(x$design))
114
- pt.col <- enve.col2alpha(col, pt.alpha)
115
- ln.col <- enve.col2alpha(col, ln.alpha)
116
- band.col <- enve.col2alpha(col, band.alpha)
117
- xp.col <- enve.col2alpha(col, xp.alpha)
118
- band.angle <- rep(band.angle, length.out=length(x$design))
119
- if(!all(is.null(band.density))){
120
- band.density <- rep(band.density, length.out=length(x$design))
117
+ pch <- rep(pch, length.out = length(x$design))
118
+ col <- rep(col, length.out = length(x$design))
119
+ pt.col <- enve.col2alpha(col, pt.alpha)
120
+ ln.col <- enve.col2alpha(col, ln.alpha)
121
+ band.col <- enve.col2alpha(col, band.alpha)
122
+ xp.col <- enve.col2alpha(col, xp.alpha)
123
+ band.angle <- rep(band.angle, length.out = length(x$design))
124
+ if (!all(is.null(band.density))) {
125
+ band.density <- rep(band.density, length.out = length(x$design))
121
126
  }
122
127
 
123
- for(i in 1:length(x$design)){
128
+ for (i in 1:length(x$design)) {
124
129
  # Observed data
125
130
  d <- x$models[[i]]$data
126
- points(d[,"t"], d[,"od"], pch=pch[i], col=pt.col[i])
127
- for(j in unique(d[,"replicate"])){
128
- sel <- d[,"replicate"]==j
129
- lines(d[sel,"t"], d[sel,"od"], col=xp.col[i], lwd=xp.lwd, lty=xp.lty)
131
+ points(d[, "t"], d[, "od"], pch = pch[i], col = pt.col[i])
132
+ for (j in unique(d[, "replicate"])) {
133
+ sel <- d[, "replicate"] == j
134
+ lines(d[sel, "t"], d[sel, "od"],
135
+ col = xp.col[i], lwd = xp.lwd, lty = xp.lty)
130
136
  }
137
+
131
138
  # Fitted growth curves
132
- if(x$models[[i]]$convInfo$isConv){
139
+ if (x$models[[i]]$convInfo$isConv) {
133
140
  d <- x$predict[[i]]
134
- lines(d[,"t"], d[,"fit"], col=ln.col[i], lwd=ln.lwd, lty=ln.lty)
135
- polygon(c(d[,"t"], rev(d[,"t"])), c(d[,"lwr"], rev(d[,"upr"])),
136
- border=NA, col=band.col[i], density=band.density[i],
137
- angle=band.angle[i])
141
+ lines(d[, "t"], d[, "fit"], col = ln.col[i], lwd = ln.lwd, lty = ln.lty)
142
+ polygon(c(d[, "t"], rev(d[, "t"])), c(d[, "lwr"], rev(d[, "upr"])),
143
+ border = NA, col = band.col[i], density = band.density[i],
144
+ angle = band.angle[i])
138
145
  }
139
146
  }
140
-
141
- if(!all(is.logical(legend)) || legend){
142
- if(all(is.logical(legend))) legend <- "bottomright"
147
+
148
+ if (!all(is.logical(legend)) || legend) {
149
+ if (all(is.logical(legend))) legend <- "bottomright"
143
150
  legend.txt <- names(x$design)
144
- if(add.params){
145
- for(p in names(coef(x$models[[1]]))){
146
- legend.txt <- paste(legend.txt, ", ", p, "=",
147
- sapply(x$models, function(x) signif(coef(x)[p],2)) , sep="")
151
+ if (add.params) {
152
+ for (p in names(coef(x$models[[1]]))) {
153
+ legend.txt <- paste(
154
+ legend.txt, ", ", p, "=",
155
+ sapply(x$models, function(x) signif(coef(x)[p], 2)) , sep = ""
156
+ )
148
157
  }
149
158
  }
150
- legend(legend, legend=legend.txt, pch=pch, col=ln.col)
159
+ legend(legend, legend = legend.txt, pch = pch, col = ln.col)
151
160
  }
152
161
  }
153
162
 
@@ -158,37 +167,39 @@ plot.enve.GrowthCurve <- function
158
167
  #' @param object An \code{\link{enve.GrowthCurve}} object.
159
168
  #' @param ... No additional parameters are currently supported.
160
169
  #'
170
+ #' @return No return value.
171
+ #'
161
172
  #' @author Luis M. Rodriguez-R [aut, cre]
162
173
  #'
163
174
  #' @method summary enve.GrowthCurve
164
175
  #' @export
165
176
 
166
- summary.enve.GrowthCurve <- function(
167
- object,
168
- ...
169
- ){
170
-
177
+ summary.enve.GrowthCurve <- function(object, ...) {
171
178
  x <- object
172
- cat('===[ enve.GrowthCurves ]------------------\n')
173
- for(i in names(x$design)){
174
- cat(i, ':\n', sep='')
175
- if(x$models[[i]]$convInfo$isConv){
176
- for(j in names(coef(x$models[[i]]))){
177
- cat(' - ', j, ' = ', coef(x$models[[i]])[j], '\n', sep='')
179
+ cat("===[ enve.GrowthCurves ]------------------\n")
180
+ for (i in names(x$design)) {
181
+ cat(i, ":\n", sep = "")
182
+ if (x$models[[i]]$convInfo$isConv) {
183
+ for (j in names(coef(x$models[[i]]))) {
184
+ cat(" - ", j, " = ", coef(x$models[[i]])[j], "\n", sep = "")
178
185
  }
179
- }else{
180
- cat(' Model didn\'t converge:\n ',
181
- x$models[[i]]$convInfo$stopMessage, '\n', sep='')
186
+ } else {
187
+ cat(" Model didn't converge:\n ",
188
+ x$models[[i]]$convInfo$stopMessage, "\n", sep = "")
182
189
  }
183
- cat(' ', nrow(x$models[[i]]$data), ' observations, ',
184
- length(unique(x$models[[i]]$data[,"replicate"])), ' replicates.\n',
185
- sep='')
190
+ cat(
191
+ " ", nrow(x$models[[i]]$data), " observations, ",
192
+ length(unique(x$models[[i]]$data[, "replicate"])), " replicates.\n",
193
+ sep = ""
194
+ )
186
195
  }
187
- cat('------------------------------------------\n')
188
- cat('call:',as.character(attr(x,'call')),'\n')
189
- cat('------------------------------------------\n')
196
+ cat("------------------------------------------\n")
197
+ cat("call:", as.character(attr(x, "call")), "\n")
198
+ cat("------------------------------------------\n")
190
199
  }
191
200
 
201
+ #==============> Core functions
202
+
192
203
  #' Enveomics: Growth Curve
193
204
  #'
194
205
  #' Calculates growth curves using the logistic growth function.
@@ -225,107 +236,114 @@ summary.enve.GrowthCurve <- function(
225
236
  #'
226
237
  #' @examples
227
238
  #' # Load data
228
- #' data("growth.curves", package="enveomics.R", envir=environment())
239
+ #' data("growth.curves", package = "enveomics.R", envir = environment())
240
+ #'
229
241
  #' # Generate growth curves with different colors
230
- #' g <- enve.growthcurve(growth.curves[,-1], growth.curves[,1], triplicates=TRUE)
242
+ #' g <- enve.growthcurve(growth.curves[, -1], growth.curves[, 1],
243
+ #' triplicates = TRUE)
244
+ #'
231
245
  #' # Generate black-and-white growth curves with different symbols
232
246
  #' plot(g, pch=15:17, col="black", band.density=45, band.angle=c(-45,45,0))
233
247
  #'
234
248
  #' @export
235
-
236
- #==============> Core functions
237
- enve.growthcurve <- structure(function(
249
+ enve.growthcurve <- function(
238
250
  x,
239
- times=1:nrow(x),
240
- triplicates=FALSE,
251
+ times = 1:nrow(x),
252
+ triplicates = FALSE,
241
253
  design,
242
- new.times=seq(min(times), max(times), length.out=length(times)*10),
243
- level=0.95,
244
- interval=c("confidence","prediction"),
245
- plot=TRUE,
246
- FUN=function(t,K,r,P0) K*P0*exp(r*t)/(K+P0*(exp(r*t)-1)),
247
- nls.opt=list(),
254
+ new.times = seq(min(times), max(times), length.out = length(times) * 10),
255
+ level = 0.95,
256
+ interval = c("confidence", "prediction"),
257
+ plot = TRUE,
258
+ FUN = function(t, K, r, P0) K * P0 * exp(r * t) / (K + P0 * (exp(r * t) - 1)),
259
+ nls.opt = list(),
248
260
  ...
249
- ){
250
-
261
+ ) {
251
262
  # Arguments
252
- if(missing(design)){
263
+ if (missing(design)) {
253
264
  design <-
254
265
  if(triplicates)
255
- tapply(colnames(x), colnames(x)[rep(1:(ncol(x)/3)*3-2, each=3)], c,
256
- simplify=FALSE)
257
- else tapply(colnames(x), colnames(x), c, simplify=FALSE)
266
+ tapply(
267
+ colnames(x),
268
+ colnames(x)[rep(1:(ncol(x) / 3) * 3 - 2, each = 3)],
269
+ c, simplify = FALSE
270
+ )
271
+ else tapply(colnames(x), colnames(x), c, simplify = FALSE)
258
272
  }
259
273
  mod <- list()
260
274
  fit <- list()
261
275
  interval <- match.arg(interval)
262
276
  enve._growth.fx <- NULL
263
277
  enve._growth.fx <<- FUN
264
-
265
- for(sample in names(design)){
278
+
279
+ for (sample in names(design)) {
266
280
  od <- c()
267
- for(col in design[[sample]]){
268
- od <- c(od, x[,col])
281
+ for (col in design[[sample]]) {
282
+ od <- c(od, x[, col])
269
283
  }
270
- data <- data.frame(t=rep(times, length(design[[sample]])), od=od,
271
- replicate=rep(1:length(design[[sample]]), each=length(times)))
272
- data <- data[!is.na(data$od),]
284
+ data <- data.frame(
285
+ t = rep(times, length(design[[sample]])), od = od,
286
+ replicate = rep(1:length(design[[sample]]), each = length(times))
287
+ )
288
+ data <- data[!is.na(data$od), ]
273
289
  opts <- nls.opt
274
290
  opts[["data"]] <- data
275
- opt.defaults <- list(formula = od ~ enve._growth.fx(t, K, r, P0),
276
- algorithm="port", lower=list(P0=1e-16),
277
- control=nls.control(warnOnly=TRUE),
278
- start=list(
279
- K = 2*max(data$od),
280
- r = length(times)/max(data$t),
281
- P0 = min(data$od[data$od>0])
282
- ))
283
- for(i in names(opt.defaults)){
284
- if(is.null(opts[[i]])){
291
+ opt.defaults <- list(
292
+ formula = od ~ enve._growth.fx(t, K, r, P0),
293
+ algorithm = "port", lower = list(P0 = 1e-16),
294
+ control = nls.control(warnOnly = TRUE),
295
+ start = list(
296
+ K = 2 * max(data$od),
297
+ r = length(times) / max(data$t),
298
+ P0 = min(data$od[data$od > 0])
299
+ )
300
+ )
301
+ for (i in names(opt.defaults)) {
302
+ if (is.null(opts[[i]])) {
285
303
  opts[[i]] <- opt.defaults[[i]]
286
304
  }
287
305
  }
288
306
  mod[[sample]] <- do.call(nls, opts)
289
- fit[[sample]] <- cbind(t=new.times,
290
- predFit(mod[[sample]], level=level, interval=interval,
291
- newdata=data.frame(t=new.times)))
307
+ fit[[sample]] <- cbind(
308
+ t = new.times,
309
+ predFit(
310
+ mod[[sample]], level = level, interval = interval,
311
+ newdata = data.frame(t = new.times)
312
+ )
313
+ )
292
314
  }
293
315
  enve._growth.fx <<- NULL
294
- gc <- new("enve.GrowthCurve",
295
- design=design, models=mod, predict=fit,
296
- call=match.call());
297
- if(plot) plot(gc, ...);
316
+ gc <- new(
317
+ "enve.GrowthCurve",
318
+ design = design, models = mod, predict = fit, call = match.call()
319
+ )
320
+ if (plot) plot(gc, ...)
298
321
  return(gc)
299
- }, ex=function(){
300
- # Load data
301
- data("growth.curves", package="enveomics.R", envir=environment())
302
- # Generate growth curves with different colors
303
- g <- enve.growthcurve(growth.curves[,-1], growth.curves[,1], triplicates=TRUE)
304
- # Generate black-and-white growth curves with different symbols
305
- plot(g, pch=15:17, col="black", band.density=45, band.angle=c(-45,45,0))
306
- });
322
+ }
307
323
 
308
- #' Enveomics: Color to Alpha
324
+ #' Enveomics: Color to Alpha (deprecated)
309
325
  #'
310
326
  #' Takes a vector of colors and sets the alpha.
327
+ #'
328
+ #' DEPRECATED: Use instead \code{\link{enve.col.alpha}}.
311
329
  #'
312
330
  #' @param x A vector of any value base colors.
313
- #' @param alpha Alpha level to set (in the 0-1 range).
331
+ #' @param alpha Alpha level to set, in the [0, 1] range.
332
+ #'
333
+ #' @return A vector of colors with alpha set.
314
334
  #'
315
335
  #' @author Luis M. Rodriguez-R [aut, cre]
316
336
  #'
317
337
  #' @export
318
-
319
- enve.col2alpha <- function(
320
- x,
321
- alpha
322
- ){
338
+ enve.col2alpha <- function(x, alpha) {
323
339
  out <- c()
324
340
  for(i in x){
325
- opt <- as.list(col2rgb(i)[,1]/256)
326
- opt[["alpha"]] = alpha
341
+ opt <- as.list(col2rgb(i)[, 1])
342
+ opt[["alpha"]] <- alpha * 255
343
+ opt[["maxColorValue"]] <- 255
327
344
  out <- c(out, do.call(rgb, opt))
328
345
  }
329
346
  names(out) <- names(x)
330
347
  return(out)
331
348
  }
349
+