Browse code

Fix checking object class.

Diego Diez authored on 19/06/2021 01:46:06
Showing 3 changed files

... ...
@@ -6,7 +6,7 @@ Version: 1.31.0
6 6
 Date: 2015-12-25
7 7
 Author: Diego Diez
8 8
 Depends: R (>= 2.10), igraph (>= 1.0)
9
-Imports: AnnotationDbi, DBI, RSQLite
9
+Imports: methods, AnnotationDbi, DBI, RSQLite
10 10
 Suggests: RUnit, BiocGenerics, MotifDb, graph, PWMEnrich, biomaRt,
11 11
         knitr, Biostrings, BSgenome.Mmusculus.UCSC.mm8.masked, org.Hs.eg.db, org.Mm.eg.db,
12 12
         ggplot2
... ...
@@ -8,6 +8,7 @@ importMethodsFrom(DBI,
8 8
                   "fetch")
9 9
 
10 10
 importFrom("grDevices", "col2rgb", "colors", "grey.colors")
11
+importFrom("methods", "is")
11 12
 importFrom(
12 13
   "graphics",
13 14
   "abline",
... ...
@@ -137,13 +137,12 @@ annotateTRM = function(g, target) {
137 137
   else
138 138
     default
139 139
 }
140
-
141 140
 plotTRM = function(g, layout = layout.fruchterman.reingold, mar = .5, vertex.col, vertex.cex, vertex.lwd, edge.col, edge.lwd, edge.lty, label = TRUE, label.cex, label.col, label.pos = NULL, label.offset = 1.5, adjust.label.col = FALSE, normalize.layout=TRUE) {
142 141
   
143
-  if(class(layout) == "function")
142
+  if(is(layout, "function"))
144 143
     l = layout(g)
145 144
   else
146
-    l = layout
145
+    l = as.matrix(layout)
147 146
 
148 147
   # normalize layout.
149 148
   if(normalize.layout)