Browse code

suppress the warning when calculating the density

Ge Tan authored on 19/10/2016 17:07:37
Showing 3 changed files

... ...
@@ -144,13 +144,13 @@ makeCNEDensity <- function(x, outputDir=".",
144 144
   message("Making bedGraph files...")
145 145
   bedFirst <- reduce(bedFirst, ignore.strand=TRUE)
146 146
   covFirst <- coverage(bedFirst)
147
-  densityFirst <- runmean(covFirst, k=windowSizeFirst*1000, 
148
-                          endrule = "constant") * 100
147
+  densityFirst <- suppressWarnings(runmean(covFirst, k=windowSizeFirst*1000, 
148
+                          endrule = "constant") * 100)
149 149
   
150 150
   bedSecond <- reduce(bedSecond, ignore.strand=TRUE)
151 151
   covSecond <- coverage(bedSecond)
152
-  densitySecond <- runmean(covSecond, k=windowSizeSecond*1000,
153
-                           endrule = "constant") * 100
152
+  densitySecond <- suppressWarnings(runmean(covSecond, k=windowSizeSecond*1000,
153
+                           endrule = "constant") * 100)
154 154
  
155 155
   firstTrackLine <- new("GraphTrackLine",
156 156
                         name=paste(genomeFirst, "CNEs density", threshold),
... ...
@@ -37,7 +37,7 @@ makeGRBs <- function(x, winSize=NULL, genes=NULL, ratio=1,
37 37
     stop("The `genes` must be a `GRanges` object!")
38 38
   }
39 39
 
40
-  density <- runmean(cov, k=winSize,  endrule="constant")
40
+  density <- suppressWarnings(runmean(cov, k=winSize,  endrule="constant"))
41 41
   if(background == "genome"){
42 42
     # calculate the background percentage of coverage
43 43
     totalGenomeSize <- 
... ...
@@ -118,5 +118,4 @@ makeGRBs <- function(x, winSize=NULL, genes=NULL, ratio=1,
118 118
   clusterRanges <- clusterRanges[indexToKeep]
119 119
   
120 120
   return(clusterRanges)
121
-}
122
-
121
+}
123 122
\ No newline at end of file
... ...
@@ -49,7 +49,7 @@ CNEDensity <- function(dbName, tableName, chr, start, end,
49 49
   # Implement get_cne_ranges_in_region_partitioned_by_other_chr later!!!
50 50
   ranges <- reduce(ranges)
51 51
   covAll <- coverage(ranges, width=context_end)
52
-  runMeanAll <- runmean(covAll, k=windowSize, "constant")
52
+  runMeanAll <- suppressWarnings(runmean(covAll, k=windowSize, "constant"))
53 53
   ans <- as(runMeanAll, "GRanges")
54 54
   ans$score <- ans$score * 100
55 55
   return(ans)