Browse code

version 1.9.44

Filter GRBs with few CNEs

Ge Tan authored on 18/10/2016 11:10:02
Showing 3 changed files

... ...
@@ -1,6 +1,6 @@
1 1
 Package: CNEr 
2
-Version: 1.9.43
3
-Date: 2016-10-06
2
+Version: 1.9.44
3
+Date: 2016-10-18
4 4
 Title: CNE Detection and Visualization
5 5
 Description: Large-scale identification and advanced visualization 
6 6
              of sets of conserved noncoding elements.
... ...
@@ -2,7 +2,8 @@
2 2
 ### make GRBs from CNEs
3 3
 ### Exported!
4 4
 makeGRBs <- function(x, winSize=NULL, genes=NULL, ratio=1, 
5
-                     background=c("chromosome", "genome")){#,
5
+                     background=c("chromosome", "genome"),
6
+                     minCNEs=1L){#,
6 7
                      #byChrom=FALSE
7 8
   if(!is(x, "GRangesList")){
8 9
     stop("The input `x` must be a `GRangesList` object!")
... ...
@@ -98,6 +99,11 @@ makeGRBs <- function(x, winSize=NULL, genes=NULL, ratio=1,
98 99
     mcols(clusterRanges)[[names(xList)[i]]][as.integer(names(cnes))] <- cnes
99 100
   }
100 101
   
102
+  # Filter out the GRBs with few CNEs
103
+  indexToKeep <- apply(as.data.frame(mcols(clusterRanges)[names(xList)]) >= 
104
+                         minCNEs, 1, any)
105
+  clusterRanges <- clusterRanges[indexToKeep]
106
+  
101 107
   return(clusterRanges)
102 108
 }
103 109
 
... ...
@@ -9,7 +9,7 @@
9 9
 }
10 10
 \usage{
11 11
   makeGRBs(x, winSize=NULL, genes=NULL, ratio=1,
12
-           background=c("chromosome", "genome"))
12
+           background=c("chromosome", "genome"), minCNEs=1L)
13 13
 }
14 14
   
15 15
 \arguments{
... ...
@@ -36,14 +36,18 @@
36 36
     can be "chromosome" or "genome". When slice the CNE density,
37 37
     the background is calculated on a per-chromosome or whole-genome basis.
38 38
   }
39
+  \item{minCNEs}{
40
+    \code{integer}(1): the minimal number of CNEs that a GRB need to have.
41
+  }
39 42
 }
40 43
 \details{
41 44
   First we calculated the CNE densities from the CNEs.
42 45
   Then we segment the regions according to the values of CNE densities.
43 46
   The regions with CNE densities above the expected CNE densities * ratio are
44 47
   considered as putative GRBs.
45
-  As a last step, the putative GRBs that do not encompass any gene
46
-  are filtered out.
48
+  Of course, the putative GRBs that do not encompass any gene are filtered out.
49
+  Finanlly, the GRBs that have fewered than \code{minCNEs} number of CNEs will
50
+  be filtered out.
47 51
 }
48 52
 \value{
49 53
   A \code{GRanges} object of GRB coordinates is returned, with the number of CNEs
... ...
@@ -69,5 +73,5 @@
69 73
   makeGRBs(cneList, winSize=200, genes=refGenesDanRer10, ratio=1.2,
70 74
            background="genome")
71 75
   makeGRBs(cneList, winSize=200, genes=refGenesDanRer10, ratio=1.2,
72
-           background="chromosome")
76
+           background="chromosome", minCNEs=3L)
73 77
 }