Browse code

version 1.13.1

fix the DBI import


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

Ge Tan authored on 03/07/2017 12:49:54
Showing 5 changed files

... ...
@@ -1,12 +1,13 @@
1 1
 Package: CNEr 
2
-Version: 1.13.0
3
-Date: 2017-04-10
2
+Version: 1.13.1
3
+Date: 2017-07-03
4 4
 Title: CNE Detection and Visualization
5 5
 Description: Large-scale identification and advanced visualization 
6 6
              of sets of conserved noncoding elements.
7 7
 Author: Ge Tan <ge_tan@live.com>
8 8
 Maintainer: Ge Tan <ge_tan@live.com>
9 9
 Imports: Biostrings (>= 2.33.4),
10
+         DBI (>= 0.7),
10 11
          RSQLite (>= 0.11.4),
11 12
          GenomeInfoDb (>= 1.1.3),
12 13
          GenomicRanges (>= 1.23.16),
... ...
@@ -27,7 +28,7 @@ Imports: Biostrings (>= 2.33.4),
27 28
          GO.db (>= 3.3.0),
28 29
          R.utils (>= 2.3.0),
29 30
          KEGGREST (>= 1.14.0)
30
-Depends: R (>= 3.2.2)
31
+Depends: R (>= 3.4)
31 32
 Suggests: Gviz (>= 1.7.4),
32 33
           BiocStyle,
33 34
           knitr,
... ...
@@ -19,7 +19,8 @@ importMethodsFrom(GenomeInfoDb, seqnames, seqlengths, seqinfo, as.data.frame,
19 19
 importMethodsFrom(GenomicRanges, reduce, "strand<-", strand, start, end,
20 20
                                  findOverlaps, coverage, grglist)
21 21
 importMethodsFrom(XVector, subseq)
22
-importMethodsFrom(RSQLite, dbGetQuery, dbConnect, dbDisconnect, dbWriteTable)
22
+importMethodsFrom(DBI, dbGetQuery)
23
+importMethodsFrom(RSQLite, dbConnect, dbDisconnect, dbWriteTable)
23 24
 importMethodsFrom(methods, initialize, show)
24 25
 importMethodsFrom(Biostrings, compareStrings)
25 26
 importMethodsFrom(S4Vectors, Rle, isConstant, runmean, elementNROWS, first,
... ...
@@ -156,7 +157,7 @@ export(
156 157
   plotCNEWidth, plotCNEDistribution,
157 158
   
158 159
   # GO.R
159
-  addAncestorGO,
160
+  ## addAncestorGO,
160 161
   
161 162
   ## AssemblyStats.R
162 163
   N50, N90
... ...
@@ -138,9 +138,10 @@ addAncestorGO <- function(go){
138 138
   }
139 139
   goID2Ancestor <- c(as.list(GOBPANCESTOR), as.list(GOMFANCESTOR), 
140 140
                      as.list(GOCCANCESTOR))
141
-  newGo <- lapply(relist(lapply(mapply(append, unlist(go), 
142
-                                       goID2Ancestor[unlist(go)]), 
143
-                                function(x){x[x!="all"]}), go), unlist)
141
+  allGo <- unlist(go)
142
+  goID2Ancestor <- lapply(goID2Ancestor, function(x){x[x%in%allGo]})
143
+  newGo <- lapply(relist(mapply(append, allGo, goID2Ancestor[allGo]), go),
144
+                  unlist)
144 145
   newGo <- lapply(newGo, function(x){if(is.null(x)){character(0)}else{x}})
145 146
   return(newGo)
146 147
 }
147 148
new file mode 100644
... ...
@@ -0,0 +1,39 @@
1
+\name{addAncestorGO}
2
+\alias{addAncestorGO}
3
+\title{
4
+  Add ancestor GO IDs
5
+}
6
+\description{
7
+  Given a list of GO IDs, add the corresponding ancestor GO IDs.
8
+}
9
+\usage{
10
+  addAncestorGO(go)
11
+}
12
+\arguments{
13
+  \item{go}{
14
+    A \code{list} of GO IDs. The elements of the list can be empty.
15
+  }
16
+}
17
+\details{
18
+  The ancestor GO IDs for each GO ID are added to the elements.
19
+}
20
+\value{
21
+  A \code{list} of GO IDs with their ancestor GO IDs.
22
+}
23
+\author{
24
+  Ge Tan
25
+}
26
+\note{
27
+  This function is mainly designed for processing the gff annotation generated
28
+  from interproscan, where for each gene, a set of GO IDs are assigned.
29
+  However, for GO enrichment analysis, we need a list of mapping from genes to
30
+  the GO IDs and their ancestor GO IDs as well.
31
+}
32
+
33
+\examples{
34
+  \donttest{
35
+    library(GO.db)
36
+    go <- list(c("GO:0005215", "GO:0006810", "GO:0016020"), "GO:0016579")
37
+    addAncestorGO(go)
38
+  }
39
+}
0 40
new file mode 100644
... ...
@@ -0,0 +1,6 @@
1
+test_that("test_addAncestorGO", {
2
+  library(GO.db)
3
+  go <- list(c("GO:0005215", "GO:0006810", "GO:0016020"), "GO:0016579")
4
+  newGO <- addAncestorGO(go)
5
+  expect_equal(lengths(newGO), c(8, 17))
6
+})
0 7
\ No newline at end of file