git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/branches/RELEASE_3_2/madman/Rpacks/CNEr@110396 bc3139a8-67e5-0310-9ffc-ced21a209358
... | ... |
@@ -1,6 +1,6 @@ |
1 | 1 |
Package: CNEr |
2 |
-Version: 1.6.0 |
|
3 |
-Date: 2015-10-08 |
|
2 |
+Version: 1.6.1 |
|
3 |
+Date: 2015-11-06 |
|
4 | 4 |
Title: CNE Detection and Visualization |
5 | 5 |
Description: Large-scale identification and advanced visualization |
6 | 6 |
of sets of conserved noncoding elements. |
... | ... |
@@ -17,12 +17,13 @@ System Requirements: blat |
17 | 17 |
VignetteBuilder: knitr |
18 | 18 |
License: GPL-2 | file LICENSE |
19 | 19 |
License_restricts_use: yes |
20 |
-URL: http://ancora.genereg.net/ |
|
20 |
+URL: https://bitbucket.org/ge11232002/cner |
|
21 |
+BugReports: https://bitbucket.org/ge11232002/cner/issues |
|
21 | 22 |
Type: Package |
22 | 23 |
biocViews: GeneRegulation, Visualization, DataImport |
23 | 24 |
NeedsCompilation: yes |
24 | 25 |
LazyData: no |
25 | 26 |
Collate: AllGenerics.R AllClasses.R utils.R ceScan.R plot.R |
26 | 27 |
makeGeneDbFromUCSC.R io.R scoringMatrix.R subAxt-methods.R |
27 |
- Axt-methods.R DB.R AssemblyStats.R |
|
28 |
+ Axt-methods.R DB.R AssemblyStats.R GRB.R |
|
28 | 29 |
|
29 | 30 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,37 @@ |
1 |
+ |
|
2 |
+ |
|
3 |
+makeGRBs <- function(x, winSize=NULL, genes=NULL, ratio=0.5){ |
|
4 |
+ # winSize in kb |
|
5 |
+ x <- unlist(x) |
|
6 |
+ x <- reduce(x) |
|
7 |
+ cov <- coverage(x) |
|
8 |
+ |
|
9 |
+ # Guess winSize from genome size if NULL |
|
10 |
+ if(is.null(winSize)){ |
|
11 |
+ ## Based on 300kb for human |
|
12 |
+ winSize <- seqlengths(x) / 3e6 * 300 |
|
13 |
+ } |
|
14 |
+ winSize <- winSize * 1e3 |
|
15 |
+ |
|
16 |
+ # calculate the background percentage of coverage |
|
17 |
+ coveredAll <- sum(sum(cov)) / sum(as.numeric(seqlengths(x))) |
|
18 |
+ density <- runmean(cov, k=winSize, endrule="constant") |
|
19 |
+ |
|
20 |
+ # slice the density into GRBs |
|
21 |
+ s <- slice(density, lower=coveredAll*ratio, includeLower=FALSE) |
|
22 |
+ clusterRanges <- GRanges(seqnames=rep(names(s), elementLengths(s)), |
|
23 |
+ ranges=unlist(ranges(s)), |
|
24 |
+ strand="+", |
|
25 |
+ seqinfo=seqinfo(x)) |
|
26 |
+ |
|
27 |
+ # remove GRBs (which do not encompass any gene) |
|
28 |
+ if(!is.null(genes)){ |
|
29 |
+ hits <- findOverlaps(genes, clusterRanges, type="within", select="all", |
|
30 |
+ ignore.strand=TRUE) |
|
31 |
+ indexKeep <- unique(subjectHits(hits)) |
|
32 |
+ clusterRanges <- clusterRanges[indexKeep] |
|
33 |
+ } |
|
34 |
+ return(clusterRanges) |
|
35 |
+ |
|
36 |
+} |
|
37 |
+ |