git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/gmapR@95410 bc3139a8-67e5-0310-9ffc-ced21a209358
... | ... |
@@ -1,12 +1,3 @@ |
1 |
- |
|
2 |
-### ========================================================================= |
|
3 |
-### CharOrGRangesList |
|
4 |
-### ------------------------------------------------------------------------- |
|
5 |
-### |
|
6 |
-### Unifies the two ways we can represent the genome IIT BamTally now expects |
|
7 |
-### (specifying CDS regions) |
|
8 |
-setClassUnion("CharOrGRangesList", c("character", "GRangesList", "NULL")) |
|
9 |
- |
|
10 | 1 |
### ========================================================================= |
11 | 2 |
### BamTallyParam class |
12 | 3 |
### ------------------------------------------------------------------------- |
... | ... |
@@ -44,11 +35,13 @@ normArgWhich <- function(x, genome) { |
44 | 35 |
x |
45 | 36 |
} |
46 | 37 |
|
47 |
-setGeneric("normArgCdsIIT", function(exon_iit, genome, ...) standardGeneric("normArgCdsIIT")) |
|
38 |
+setGeneric("normArgCdsIIT", function(exon_iit, genome, ...) |
|
39 |
+ standardGeneric("normArgCdsIIT")) |
|
48 | 40 |
|
49 | 41 |
setMethod("normArgCdsIIT", "ANY", function(exon_iit, genome, BPPARAM) { |
50 |
- if(!is.null(exon_iit) && (!is(exon_iit, "character") || length(exon_iit) > 1)) |
|
51 |
- stop("Invalid exon_iit value. Accepted values types are: single character value (file location), GRangesList of exons, a TxDb object (use the exons in the TxDb), a GmapGenome (use the genome gene map iit), or NULL") |
|
42 |
+ if(!is.null(exon_iit) |
|
43 |
+ && (!is(exon_iit, "character") || length(exon_iit) > 1)) |
|
44 |
+ stop("Invalid exon_iit value. See ?BamTallyParam for acceptable values") |
|
52 | 45 |
if(!is.null(exon_iit) && (nchar(exon_iit) && !file.exists(exon_iit))) |
53 | 46 |
stop("exon_iit is non-empty and does not point to an existing file") |
54 | 47 |
exon_iit |
... | ... |
@@ -56,18 +49,14 @@ setMethod("normArgCdsIIT", "ANY", function(exon_iit, genome, BPPARAM) { |
56 | 49 |
}) |
57 | 50 |
|
58 | 51 |
setMethod("normArgCdsIIT", "TxDb", function(exon_iit, genome, BPPARAM) { |
59 |
- exon_iit = iit_store(exonsBy(exon_iit, "gene"), dest = tempfile(pattern = "cds", fileext = ".iit"), BPPARAM = BPPARAM) |
|
52 |
+ exon_iit = iit_store(exonsBy(exon_iit, "gene"), |
|
53 |
+ dest = tempfile(pattern = "cds", fileext = ".iit"), BPPARAM = BPPARAM) |
|
60 | 54 |
normArgCdsIIT(exon_iit) |
61 | 55 |
}) |
62 | 56 |
|
63 | 57 |
setMethod("normArgCdsIIT", "GRangesList", function(exon_iit, genome, BPPARAM) { |
64 |
- exon_iit = iit_store(exon_iit, dest = tempfile(pattern = "cds", fileext = ".iit"), BPPARAM = BPPARAM) |
|
65 |
- normArgCdsIIT(exon_iit) |
|
66 |
-}) |
|
67 |
- |
|
68 |
- |
|
69 |
-setMethod("normArgCdsIIT", "GRanges", function(exon_iit, genome, BPPARAM) { |
|
70 |
- exon_iit = iit_store(GRangesList( exon_iit), dest = tempfile(pattern = "cds", fileext = ".iit"), BPPARAM = BPPARAM) |
|
58 |
+ exon_iit = iit_store(exon_iit, dest = tempfile(pattern = "cds", |
|
59 |
+ fileext = ".iit"), BPPARAM = BPPARAM) |
|
71 | 60 |
normArgCdsIIT(exon_iit) |
72 | 61 |
}) |
73 | 62 |
|
... | ... |
@@ -82,7 +71,9 @@ setMethod("normArgCdsIIT", "GmapGenome", function(exon_iit, genome, BPPARAM) { |
82 | 71 |
normArgsCdsIIT(exon_iit) |
83 | 72 |
}) |
84 | 73 |
|
85 |
-.makeCdsIIT= function(exons, filename = tempfile(pattern="exon_iit", fileext=".iit")) { |
|
74 |
+.makeCdsIIT <- function(exons, |
|
75 |
+ filename = tempfile(pattern="exon_iit", fileext=".iit")) |
|
76 |
+{ |
|
86 | 77 |
exonsFlat <- unlist(exons, use.names=FALSE) |
87 | 78 |
exonsPart <- PartitioningByWidth(exons) |
88 | 79 |
exonsHead <- exonsFlat[-end(exonsPart)] |