Browse code

replaced deprecated 'values' with 'mcols'

git-svn-id: https://hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/MotifDb@86011 bc3139a8-67e5-0310-9ffc-ced21a209358

p.shannon authored on 03/02/2014 18:57:29
Showing 3 changed files

... ...
@@ -1,8 +1,8 @@
1 1
 Package: MotifDb
2 2
 Type: Package
3 3
 Title: An Annotated Collection of Protein-DNA Binding Sequence Motifs
4
-Version: 1.5.0
5
-Date: 2013-08-30
4
+Version: 1.5.1
5
+Date: 2014-02-03
6 6
 Author: Paul Shannon
7 7
 Maintainer: Paul Shannon <pshannon@fhcrc.org>
8 8
 Depends: R (>= 2.15.0), methods, IRanges, Biostrings
... ...
@@ -204,11 +204,11 @@ setMethod('show', 'MotifList',
204 204
       
205 205
       cat ('| Created from downloaded public sources: 2013-Aug-30', '\n', sep='')
206 206
 
207
-      tbl.dataSource = as.data.frame (table (values (object)$dataSource))
208
-      tbl.org = as.data.frame (table (values (object)$organism))
207
+      tbl.dataSource = as.data.frame (table (mcols (object)$dataSource))
208
+      tbl.org = as.data.frame (table (mcols (object)$organism))
209 209
       tbl.org = head (tbl.org [order (tbl.org$Freq, decreasing=TRUE),])
210 210
       totalMatrixCount = length (object)
211
-      totalOrganismCount = length (unique (values (object)$organism))
211
+      totalOrganismCount = length (unique (mcols (object)$organism))
212 212
       dataSourceCount = nrow (tbl.dataSource)
213 213
 
214 214
       source.singular.or.plural = 'sources'
... ...
@@ -255,9 +255,9 @@ setMethod('show', 'MotifList',
255 255
 setMethod ('query', 'MotifList',
256 256
 
257 257
    function (object, queryString, ignore.case=TRUE) {
258
-       indices = unique (as.integer (unlist (sapply (colnames (values (object)), 
258
+       indices = unique (as.integer (unlist (sapply (colnames (mcols (object)), 
259 259
                     function (colname) 
260
-                       grep (queryString, values (object)[, colname], 
260
+                       grep (queryString, mcols (object)[, colname], 
261 261
                              ignore.case=ignore.case)))))
262 262
         object [indices]
263 263
       })
... ...
@@ -112,7 +112,7 @@ test.noNAorganisms = function ()
112 112
 
113 113
 {
114 114
   print ('--- test.noNAorganisms')
115
-  checkEquals (which (is.na (values (MotifDb)$organism)), integer (0))
115
+  checkEquals (which (is.na (mcols(MotifDb)$organism)), integer (0))
116 116
 
117 117
 } # test.noNAorganisms
118 118
 #------------------------------------------------------------------------------------------------------------------------
... ...
@@ -131,7 +131,7 @@ test.providerNames = function ()
131 131
 {
132 132
   print ('--- test.getProviderNames')
133 133
   mdb = MotifDb # ()
134
-  pn = values (mdb)$providerName
134
+  pn = mcols(mdb)$providerName
135 135
   checkEquals (length (which (is.na (pn))), 0)
136 136
   checkEquals (length (which (pn == '')), 0)
137 137
 
... ...
@@ -141,7 +141,7 @@ test.geneSymbols = function ()
141 141
 {
142 142
   print ('--- test.getGeneSymbols')
143 143
   mdb = MotifDb # ()
144
-  syms = values (mdb)$geneSymbol
144
+  syms = mcols(mdb)$geneSymbol
145 145
   checkEquals (length (which (is.na (syms))), 683)  # no symols yet for the dgf stamlab motifs
146 146
   checkEquals (length (which (syms == '')), 0)
147 147
 
... ...
@@ -151,8 +151,8 @@ test.geneIdsAndTypes = function ()
151 151
 {
152 152
   print ('--- test.getGeneIdsAndTypes')
153 153
   mdb = MotifDb
154
-  geneIds = values (mdb)$geneId
155
-  geneIdTypes = values (mdb)$geneIdType
154
+  geneIds = mcols(mdb)$geneId
155
+  geneIdTypes = mcols(mdb)$geneIdType
156 156
   typeCounts = as.list (table (geneIdTypes))
157 157
   checkEquals(typeCounts, list(ENTREZ=2197, FLYBASE=30, SGD=453, comment=683))
158 158
 
... ...
@@ -170,10 +170,10 @@ test.proteinIds = function ()
170 170
 {
171 171
   print ('--- test.proteinIds')
172 172
   mdb = MotifDb # (quiet=TRUE)
173
-  NA.string.count = length (grep ('NA', values (mdb)$proteinId))
173
+  NA.string.count = length (grep ('NA', mcols(mdb)$proteinId))
174 174
   checkEquals (NA.string.count, 0)
175 175
   
176
-  empty.count = length (which (values (mdb)$proteinId==""))
176
+  empty.count = length (which (mcols(mdb)$proteinId==""))
177 177
   if (empty.count > 0)
178 178
     browser ('test.proteinIds')     
179 179
 
... ...
@@ -183,7 +183,7 @@ test.proteinIds = function ()
183 183
      # Herve' pointed out that this applied also to entries with no proteinId.
184 184
      # make sure this is fixed
185 185
 
186
-  x = values (mdb)
186
+  x = mcols(mdb)
187 187
   checkEquals (nrow (subset (x, !is.na (proteinIdType) & is.na (proteinId))), 0)
188 188
 
189 189
 } # test.proteinIds
... ...
@@ -193,7 +193,7 @@ test.sequenceCount = function ()
193 193
 {
194 194
   print ('--- test.sequenceCount')
195 195
   mdb = MotifDb # ()
196
-  x = values (mdb)
196
+  x = mcols(mdb)
197 197
   if (interactive ()) {
198 198
     x.up = subset (x, dataSource == 'UniPROBE')
199 199
     checkTrue (all (is.na (x.up$sequenceCount)))
... ...
@@ -216,8 +216,8 @@ test.longNames = function ()
216 216
   
217 217
   dataSources = unique (sapply (longNames, '[', 2))
218 218
 
219
-  recognized.dataSources = unique (values (mdb)$dataSource)
220
-  recognized.organisms = unique (values (mdb)$organism)
219
+  recognized.dataSources = unique (mcols(mdb)$dataSource)
220
+  recognized.organisms = unique (mcols(mdb)$organism)
221 221
     # a few (3) matrices from JASPAR core have NA organism.  make this into a character
222 222
     # so that it can be matched up against the 'NA' extracted from longNames just above
223 223
   na.indices = which (is.na (recognized.organisms))
... ...
@@ -234,14 +234,14 @@ test.organisms = function ()
234 234
 {
235 235
   print ('--- test.organisms')
236 236
   mdb = MotifDb # (quiet=TRUE)
237
-  organisms = values (mdb)$organism
237
+  organisms = mcols(mdb)$organism
238 238
 
239 239
      # jaspar_core has 3 NA speciesId: TBP, HNF4A and CEBPA (MA0108.2, MA0114.1, MA0102.2)
240 240
      # their website shows these as vertebrates, which I map to 'Vertebrata'.  An organismID of '-'
241 241
      # gets the same treatment, matching website also.
242
-  checkEquals (which (is.na (values (MotifDb)$organism)), integer (0))
242
+  checkEquals (which (is.na (mcols(MotifDb)$organism)), integer (0))
243 243
 
244
-  empty.count = length (which (values (mdb)$organism==""))
244
+  empty.count = length (which (mcols(mdb)$organism==""))
245 245
   checkEquals (empty.count, 0)
246 246
 
247 247
 } # test.organisms
... ...
@@ -250,7 +250,7 @@ test.bindingDomains = function ()
250 250
 {
251 251
   print ('--- test.bindingDomains')
252 252
   mdb = MotifDb # (quiet=TRUE)
253
-  checkTrue (length (unique (values (mdb)$bindingDomain)) > 1)
253
+  checkTrue (length (unique (mcols(mdb)$bindingDomain)) > 1)
254 254
 
255 255
 } # test.bindingDomains
256 256
 #------------------------------------------------------------------------------------------------------------------------
... ...
@@ -258,7 +258,7 @@ test.flyBindingDomains = function ()
258 258
 {
259 259
   print ('--- test.flyBindingDomains')
260 260
 
261
-  x = values (MotifDb)
261
+  x = mcols(MotifDb)
262 262
   tmp = as.list (head (sort (table (subset (x, organism=='Dmelanogaster')$bindingDomain), decreasing=TRUE), n=3))
263 263
 
264 264
     # these counts will likely change with a fresh load of data from FlyFactorSurvey.
... ...
@@ -274,7 +274,7 @@ test.experimentTypes = function ()
274 274
 {
275 275
   print ('--- test.experimentTypes')
276 276
   mdb = MotifDb # (quiet=TRUE)
277
-  x = values (mdb)
277
+  x = mcols(mdb)
278 278
   checkTrue (length (unique (x$experimentType)) >= 18)
279 279
   checkEquals (length (which (x$experimentType=='')), 0)
280 280
 
... ...
@@ -284,7 +284,7 @@ test.tfFamilies = function ()
284 284
 {
285 285
   print ('--- test.tfFamilies')
286 286
   mdb = MotifDb # (quiet=TRUE)
287
-  checkTrue (length (unique (values (mdb)$tfFamily)) > 1)
287
+  checkTrue (length (unique (mcols(mdb)$tfFamily)) > 1)
288 288
 
289 289
 } # test.tfFamilies
290 290
 #------------------------------------------------------------------------------------------------------------------------
... ...
@@ -292,14 +292,14 @@ test.bindingSequences = function ()
292 292
 {
293 293
   print ('--- test.bindingSequences')
294 294
   mdb = MotifDb # (quiet=TRUE)
295
-  checkTrue (length (unique (values (mdb)$bindingSequence)) > 1)
295
+  checkTrue (length (unique (mcols(mdb)$bindingSequence)) > 1)
296 296
 
297 297
 } # test.tfFamilies
298 298
 #------------------------------------------------------------------------------------------------------------------------
299 299
 test.pubmedIDs = function ()
300 300
 {
301 301
   print ('--- test.pubmedIDs')
302
-  x = values (MotifDb) # (quiet=TRUE))
302
+  x = mcols(MotifDb) # (quiet=TRUE))
303 303
   checkTrue (length (unique (x$pubmedID)) >= 139)
304 304
   checkEquals (length (which (x$pubmedID == '')), 0)
305 305
 
... ...
@@ -323,7 +323,7 @@ test.allFullNames = function ()
323 323
   matrices = mdb@listData
324 324
   fullNames = names (matrices)
325 325
 
326
-  all.dataSources = unique (values (mdb)$dataSource)
326
+  all.dataSources = unique (mcols(mdb)$dataSource)
327 327
   checkTrue (length (all.dataSources) >= 4)
328 328
   
329 329
   for (source in all.dataSources) {
... ...
@@ -374,7 +374,7 @@ test.query = function ()
374 374
   mdb = MotifDb
375 375
 
376 376
     # do queries on dataSource counts match those from a contingency table?
377
-  sources.list = as.list (table (values (mdb)$dataSource))
377
+  sources.list = as.list (table (mcols(mdb)$dataSource))
378 378
   checkEquals (length (query (mdb, 'flyfactorsurvey')), sources.list$FlyFactorSurvey)
379 379
   checkEquals (length (query (mdb, 'uniprobe')), sources.list$UniPROBE)
380 380
   checkEquals (length (query (mdb, 'UniPROBE')), sources.list$UniPROBE)
... ...
@@ -399,9 +399,9 @@ test.query = function ()
399 399
   checkTrue (length (uniprobe.sox.matrices) > 10)
400 400
   checkTrue (length (uniprobe.sox.matrices) < 30)
401 401
 
402
-   checkEquals (unique (values (uniprobe.sox.matrices)$dataSource), 'UniPROBE')
403
-   checkEquals (unique (values (sox.uniprobe.matrices)$dataSource), 'UniPROBE')
404
-   gene.symbols = sort (unique (values (uniprobe.sox.matrices)$geneSymbol))
402
+   checkEquals (unique (mcols(uniprobe.sox.matrices)$dataSource), 'UniPROBE')
403
+   checkEquals (unique (mcols(sox.uniprobe.matrices)$dataSource), 'UniPROBE')
404
+   gene.symbols = sort (unique (mcols(uniprobe.sox.matrices)$geneSymbol))
405 405
   
406 406
 } # test.query
407 407
 #------------------------------------------------------------------------------------------------------------------------