Browse code

make use of libraries slot

moved some dependencies into suggests and have struct check for packages on first use of object instead by populating the libraries slot of objects

Gavin Rhys Lloyd authored on 25/09/2019 17:47:11
Showing 12 changed files

... ...
@@ -77,7 +77,6 @@ Depends: struct
77 77
 Imports: ggplot2,
78 78
  pmp,
79 79
  gridExtra,
80
- pls,
81 80
  sp,
82 81
  scales,
83 82
  stats,
... ...
@@ -90,7 +89,6 @@ Imports: ggplot2,
90 89
  nlme,
91 90
  ggthemes,
92 91
  ggdendro,
93
- Rtsne,
94 92
  datasets
95 93
 RoxygenNote: 6.1.1
96 94
 Suggests: 
... ...
@@ -99,7 +97,9 @@ Suggests:
99 97
  knitr,
100 98
  rmarkdown,
101 99
  BiocStyle,
102
- sbcms
100
+ pls,
101
+ sbcms,
102
+ Rtsne
103 103
 Remotes: computational-metabolomics/pmp,
104 104
   computational-metabolomics/struct,
105 105
   computational-metabolomics/sbcms
... ...
@@ -94,7 +94,6 @@ exportMethods(model.predict)
94 94
 exportMethods(model.reverse)
95 95
 exportMethods(model.train)
96 96
 exportMethods(run)
97
-import(Rtsne)
98 97
 import(agricolae)
99 98
 import(car)
100 99
 import(datasets)
... ...
@@ -111,7 +110,5 @@ import(reshape2)
111 110
 import(scales)
112 111
 import(stats)
113 112
 import(struct)
114
-importFrom(pls,plsr)
115
-importFrom(pls,scores)
116 113
 importFrom(scales,squish)
117 114
 importFrom(sp,point.in.polygon)
... ...
@@ -23,6 +23,7 @@ plsda_scores_plot<-setClass(
23 23
     prototype = list(name='PLSDA scores plot',
24 24
         description='scatter plot of PLSDA component scores',
25 25
         type="scatter",
26
+        libraries=c('pls','ggplot2'),
26 27
         params.components=entity(name='Components to plot',
27 28
             value=c(1,2),
28 29
             type='numeric',
... ...
@@ -2,7 +2,6 @@
2 2
 #'
3 3
 #' Partial least squares (PLS) discriminant analysis (DA) model class. This object can be used to train/apply PLS models.
4 4
 #' @export PLSDA
5
-#' @importFrom pls plsr scores
6 5
 #' @examples
7 6
 #' M = PLSDA()
8 7
 PLSDA<-setClass(
... ...
@@ -26,6 +25,7 @@ PLSDA<-setClass(
26 25
     prototype = list(name='Partial least squares discriminant analysis',
27 26
         type="classification",
28 27
         predicted='pred',
28
+        libraries='pls',
29 29
         params.number_components=entity(value = 2,
30 30
             name = 'Number of PLS components',
31 31
             description = 'The number of PLS components to use',
... ...
@@ -2,7 +2,6 @@
2 2
 #'
3 3
 #' Partial least squares (PLS) fold change estimates
4 4
 #' @export PLSFC
5
-#' @importFrom pls plsr scores
6 5
 #' @include fold_change_class.R
7 6
 #' @examples
8 7
 #' C = PLSFC()
... ...
@@ -15,6 +14,7 @@ PLSFC<-setClass(
15 14
     prototype = list(name='Partial least squares discriminant analysis',
16 15
         type="classification",
17 16
         predicted='pred',
17
+        libraries=c('pls'),
18 18
         params.number_components=entity(value = 2,name = 'Number of PLS components',description = 'The number of PLS components to use',type = 'numeric')
19 19
     )
20 20
 )
... ...
@@ -2,7 +2,6 @@
2 2
 #'
3 3
 #' Partial least squares (PLS) Regression model class. This object can be used to train/apply PLS models.
4 4
 #' @export PLSR
5
-#' @importFrom pls plsr scores
6 5
 #' @examples
7 6
 #' M = PLSR()
8 7
 PLSR<-setClass(
... ...
@@ -26,6 +25,7 @@ PLSR<-setClass(
26 25
     prototype = list(name='Partial least squares regression',
27 26
         type="regression",
28 27
         predicted='pred',
28
+        libraries='pls',
29 29
         params.number_components=entity(value = 2,name = 'Number of PLS components',description = 'The number of PLS components to use',type = 'numeric'),
30 30
         params.factor_name=entity(name='Factor name', description='A vector of sample_meta column names to use')
31 31
     )
... ...
@@ -23,6 +23,7 @@ sb_corr<-setClass(
23 23
         correct for signal drift and batch differences in mass spectrometry data.',
24 24
         type = 'correction',
25 25
         predicted = 'corrected',
26
+        libraries='sbcms',
26 27
 
27 28
         params.order_col=entity(
28 29
             name = 'Sample run order column',
... ...
@@ -2,7 +2,6 @@
2 2
 #'
3 3
 #' t-Distributed Stochastic Neighbor Embedding (tSNE) class. This object can be used to train/apply tSNE models to dataset objects.
4 4
 #'
5
-#' @import Rtsne
6 5
 #' @export tSNE
7 6
 #' @examples
8 7
 #' M = tSNE()
... ...
@@ -28,7 +27,7 @@ tSNE<-setClass(
28 27
         description='t-Distributed Stochastic Neighbor Embedding.',
29 28
         type="preprocessing",
30 29
         predicted='tsne',
31
-
30
+        libraries='Rtsne',
32 31
         params.dims=2,
33 32
         params.perplexity=30,
34 33
         params.max_iter=1000,
... ...
@@ -83,7 +82,8 @@ tSNE_scatter<-setClass(
83 82
         ),
84 83
     prototype = list(name='Feature boxplot',
85 84
         description='plots the new representation of data after applying tSNE.',
86
-        type="scatter"
85
+        type="scatter",
86
+        libraries='Rtsne'
87 87
 
88 88
     )
89 89
 )
... ...
@@ -1,8 +1,6 @@
1 1
 ## ----setup, include=FALSE--------------------------------------------------
2 2
 knitr::opts_chunk$set(
3
-    collapse = TRUE,
4
-    comment = "#>",
5
-    fig.align = 'center'
3
+    dpi=72
6 4
 )
7 5
 library(structToolbox)
8 6
 library(gridExtra)
... ...
@@ -1,8 +1,6 @@
1 1
 ## ----setup, include=FALSE--------------------------------------------------
2 2
 knitr::opts_chunk$set(
3
-    collapse = TRUE,
4
-    comment = "#>",
5
-    fig.align = 'center'
3
+    dpi=72
6 4
 )
7 5
 library(structToolbox)
8 6
 library(gridExtra)
... ...
@@ -16,9 +16,7 @@ vignette: >
16 16
 
17 17
 ```{r setup, include=FALSE}
18 18
 knitr::opts_chunk$set(
19
-    collapse = TRUE,
20
-    comment = "#>",
21
-    fig.align = 'center'
19
+    dpi=72
22 20
 )
23 21
 library(structToolbox)
24 22
 library(gridExtra)
... ...
@@ -17,9 +17,7 @@ vignette: >
17 17
 
18 18
 ```{r setup, include=FALSE}
19 19
 knitr::opts_chunk$set(
20
-    collapse = TRUE,
21
-    comment = "#>",
22
-    fig.align = 'center'
20
+    dpi=72
23 21
 )
24 22
 library(structToolbox)
25 23
 library(gridExtra)