Browse code

Update in rankedList argument operation in DEsubs()

Panos Balomenos authored on 31/08/2018 20:52:52
Showing 5 changed files

... ...
@@ -1,5 +1,5 @@
1 1
 Package: DEsubs
2
-Version: 1.7.2
2
+Version: 1.7.3
3 3
 Date: 2017-07-23
4 4
 Title: DEsubs: an R package for flexible identification of
5 5
         differentially expressed subpathways using RNA-seq expression
... ...
@@ -107,7 +107,8 @@ importFrom( 'stats',
107 107
                 'phyper',
108 108
                 'model.matrix',
109 109
                 'cor',
110
-                'predict')
110
+                'predict',
111
+                'setNames')
111 112
 importFrom( 'pheatmap',
112 113
                 'pheatmap')
113 114
 importFrom( 'utils',
... ...
@@ -105,6 +105,22 @@
105 105
         { 
106 106
             genes <- rankedList 
107 107
         }
108
+
109
+        # [1.7.3] Since argument 'rankedList' only worked with entrezids, 
110
+        # it made sense to identify the annotation automatically for 
111
+        # compatibility considerations.
112
+        nomenclature <- .identifyNomenclature( x=names(genes), org=org )
113
+
114
+        # Change ranked-list nomenclature if necessary
115
+        if ( nomenclature != 'entrezgene' )
116
+        {
117
+            # Get a mapper from entrez to the needed nomenclature
118
+            xlib <- .annotationMap(org=org, nomenclature=nomenclature)
119
+            # Keep elements with valid entrez ids
120
+            genes <- genes[names(genes) %in% names(xlib)]
121
+            # Convert to entrez ids
122
+            names(genes) <- xlib[names(genes)] 
123
+        }
108 124
     }
109 125
 
110 126
     # if (verbose)
... ...
@@ -136,3 +136,27 @@
136 136
     }
137 137
 } 
138 138
 
139
+.annotationMap <- function(org, nomenclature)
140
+{
141
+    file <- 'extdata//Data//libraryEntrezToExternalNomenclature.RData'
142
+    file  <- system.file(file, package='DEsubs')
143
+    load(file, e <- new.env())
144
+    orgLib <- e[['libraryEntrezToExternalNomenclature']][[org]]
145
+
146
+    lib <- orgLib[[nomenclature]]
147
+    xlib <- setNames(lib[, 1], lib[, 2])
148
+    return(xlib)
149
+}
150
+
151
+.identifyNomenclature <- function(x, org)
152
+{
153
+    file <- 'extdata//Data//libraryEntrezToExternalNomenclature.RData'
154
+    file  <- system.file(file, package='DEsubs')
155
+    load(file, e <- new.env())
156
+    orgLib <- e[['libraryEntrezToExternalNomenclature']][[org]]
157
+
158
+    out <- sapply(orgLib, function(lib)
159
+        { length(base::intersect(x, lib[, 2])) })
160
+    out <- if ( max(out) > 0) names(which.max(out)) else 'entrezgene'
161
+    return(out)
162
+}
... ...
@@ -1,20 +1,18 @@
1
+1.7.3   - Updated rankedList argument in DEsubs() to receive gene identifiers
2
+            in any of the supported mRNAnomenclatures.
1 3
 1.7.2   - Removed 'Significance Analysis of Microarrays' (SAM) from 
2 4
             available differential expression analysis options due to the 
3 5
             removal of its package from the ecosystem.
6
+
4 7
 1.3.4:  - Fixing (persistent) inconsistencies between vignette output within
5 8
 			the package and the output in the landing page.
6
-
7 9
 1.3.3:  - Replaced kable tables with pure markdown syntax.
8 10
         - Placed external figure importing within chunks.
9
- 
10 11
 1.3.2:  - Version-bump 
11 12
 1.3.1:  - Minor compatibility update (igraph).
12 13
 
13 14
 1.1.3:  - Minor compatibility update.
14
-
15 15
 1.1.2:  - All visualization functions now return visualized data.
16 16
         - Added support for organism Danio rerio (zebrafish).
17
-
18 17
 1.1.1:  - Update in User Guide/User Input
19
-
20
-1.1.0:  - Initial version
21 18
\ No newline at end of file
19
+1.1.0:  - Initial version