Browse code

improved docs for query method

paul-shannon authored on 24/10/2018 19:02:56
Showing6 changed files

... ...
@@ -1,32 +1,26 @@
1
+Meta
2
+doc
1 3
 # History files
2 4
 .Rhistory
3 5
 .Rapp.history
4 6
 
5 7
 # Example code in package build process
6 8
 *-Ex.R
7
-
8 9
 # Output files from R CMD build
9 10
 /*.tar.gz
10
-
11 11
 # Output files from R CMD check
12 12
 /*.Rcheck/
13
-
14 13
 # RStudio files
15 14
 .Rproj.user/
16
-
17 15
 # produced vignettes
18 16
 vignettes/*.html
19 17
 vignettes/*.pdf
20
-
21 18
 # OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3
22 19
 .httr-oauth
23
-
24 20
 # knitr and R markdown default cache directories
25 21
 /*_cache/
26 22
 /cache/
27
-
28 23
 # Temporary files created by R markdown
29 24
 *.utf8.md
30 25
 *.knit.md
31
-
32 26
 .DS_Store
... ...
@@ -1,11 +1,11 @@
1 1
 Package: MotifDb
2 2
 Type: Package
3 3
 Title: An Annotated Collection of Protein-DNA Binding Sequence Motifs
4
-Version: 1.23.13
5
-Date: 2018-10-18
4
+Version: 1.23.14
5
+Date: 2018-10-24
6 6
 Author: Paul Shannon, Matt Richards
7 7
 Maintainer: Paul Shannon <pshannon@systemsbiology.org>
8
-Depends: R (>= 2.15.0), methods, BiocGenerics, S4Vectors, IRanges, Biostrings
8
+Depends: R (>= 3.5.1), methods, BiocGenerics, S4Vectors, IRanges, Biostrings
9 9
 Suggests: RUnit
10 10
 Imports: rtracklayer, splitstackshape
11 11
 Description: More than 9900 annotated position frequency matrices from 14 public sources, for multiple organisms.
... ...
@@ -1,3 +1,13 @@
1
+CHANGES IN VERSION 1.24
2
+-----------------------
3
+
4
+NEW FEATURES
5
+
6
+     o query method now flexible, with "andStrings", "orStrings", "notStrings" parameters
7
+       The previous usage style is still supported.  See man page.
8
+
9
+     o associateTranscriptionFactors (with motifs) substantially faster
10
+
1 11
 CHANGES IN VERSION 1.20
2 12
 -----------------------
3 13
 
... ...
@@ -307,8 +307,10 @@ setMethod ('query', 'MotifList',
307 307
 
308 308
          # get the cumulative intersection of all the "and" terms
309 309
          # this steadily dimishes the set of indices
310
-       for(indices in and.indices)
311
-         final.indices <- intersect(final.indices, indices)
310
+       for(indices in and.indices){
311
+          final.indices <- intersect(final.indices, indices)
312
+          #message(sprintf(" final.indices length is now %d", length(final.indices)))
313
+          }
312 314
 
313 315
          # lump all of the "or" terms together: they all get included
314 316
        final.indices <- intersect(unlist(or.indices), final.indices)
... ...
@@ -319,6 +321,7 @@ setMethod ('query', 'MotifList',
319 321
 
320 322
        object [final.indices]
321 323
        })
324
+
322 325
 #-------------------------------------------------------------------------------
323 326
 # Addition on 2017/06/15 from Matt Richards
324 327
 
... ...
@@ -449,6 +449,7 @@ test.query <- function()
449 449
   ors <- c("MA0511.1", "MA0057.1")
450 450
   ands <- c("jaspar2018", "sapiens")
451 451
   nots <- "cisbp"
452
+
452 453
   x <- query(mdb, andStrings=ands, orStrings=ors)
453 454
   checkEquals(length(x), 2)
454 455
   checkEquals(sort(names(x)),
... ...
@@ -477,6 +478,24 @@ test.query <- function()
477 478
 
478 479
 } # test.query
479 480
 #------------------------------------------------------------------------------------------------------------------------
481
+test.query2 <- function()
482
+{
483
+  mdb <- MotifDb
484
+  matrices.human <- query(mdb, 'hsapiens')
485
+  matrices.sox4 <- query(mdb, 'sox4')
486
+
487
+  matrices.human.sox4 <- query(mdb, c("hsapiens", "sox4"))
488
+  matrices.human.sox4.oldStyle <- query(matrices.human, "sox4")
489
+  checkTrue(length(matrices.human.sox4) > 0)   # 6 found on (24 oct 2018)
490
+  checkEquals(length(matrices.human.sox4), length(matrices.human.sox4.oldStyle))
491
+
492
+  checkTrue(length(matrices.human.sox4) < length(matrices.human))
493
+  checkTrue(length(matrices.human.sox4) < length(matrices.sox4))
494
+
495
+  uniprobe.sox.matrices <- query(mdb, c('uniprobe', '^sox'))
496
+
497
+} # test.query2
498
+#------------------------------------------------------------------------------------------------------------------------
480 499
 test.transformMatrixToMemeRepresentation = function ()
481 500
 {
482 501
   print ('--- test.transformMatrixToMemeRepresentation')
... ...
@@ -7,11 +7,16 @@ A very general search tool, returning all matrices whose metadata, in ANY
7 7
 column, is matched by the query string.
8 8
 }
9 9
 \usage{
10
-\S4method{query}{MotifList}(object, queryString, ignore.case=TRUE)
10
+\S4method{query}{MotifList}(object, andStrings, orStrings, notStrings, ignore.case=TRUE)
11 11
 }
12 12
 \arguments{
13 13
   \item{object}{a \code{MotifList} object.}
14
-  \item{queryString}{a \code{character} string}
14
+  \item{andStrings}{a \code{character} string vector, length one or
15
+    more, every element of which must be found in the metadata}
16
+  \item{orStrings}{a \code{character} string vector, length one or
17
+    more, any element of which must be found in the metadata}
18
+  \item{notStrings}{a \code{character} string vector, length one or
19
+    more, none of which may appear in the metadata}
15 20
   \item{ignore.case}{a \code{logical} value, default TRUE}
16 21
 
17 22
 }
... ...
@@ -22,10 +27,14 @@ A list of the matrices
22 27
 \author{Paul Shannon}
23 28
 
24 29
 \examples{
25
-  mdb <- MotifDb
26
-  matrices.human <- query(mdb, 'hsapiens')
27
-  matrices.sox4 <- query(mdb, 'sox4')
28
-  uniprobe.sox.matrices <- query(query(mdb, 'uniprobe'), '^sox')
30
+  matrices.human <- query(MotifDb, 'hsapiens')
31
+  matrices.sox4 <- query(MotifDb, 'sox4')
32
+  uniprobe.sox.matrices <- query(MotifDb, c('uniprobe', 'sox'))
33
+    # two approaches to selectinve extraction of TFEB matrices
34
+  tfeb.human.1 <- query(MotifDb, andStrings=c("TFEB", "hsapiens"), notStrings=c("hpdi", "jolma", "cisbp"))
35
+  tfeb.human.2 <- query(MotifDb, andStrings=c("TFEB", "hsapiens"), orStrings=c("hocomoco", "jaspar", "swissregulon"),
36
+                        notStrings="2016")
37
+
29 38
 }
30 39
 \seealso{
31 40
   MotifDb,