|
18 | 18 | #' @param GRCh GRCh version to connect to. If this is NULL, then the current |
19 | 19 | #' GRCh38 is used. Otherwise, this can only be 37 (default) at the moment |
20 | 20 | #' (see \code{\link{useEnsebml}}). |
21 | | -#' @param txdb A TxDb object (default: TxDb.Hsapiens.UCSC.hg19.knownGene). |
22 | | -#' @param orgDb An orgDb object (default: org.Hs.eg.db). |
| 21 | +#' @param txdb A TxDb object. If this is NULL, then the default one is used, |
| 22 | +#' currently this is TxDb.Hsapiens.UCSC.hg19.knownGene |
| 23 | +#' @param orgDb An orgDb object If this is NULL, then the default one is used, |
| 24 | +#' currently this is org.Hs.eg.db |
23 | 25 | #' |
24 | 26 | #' @return FraseRDataSet |
25 | 27 | #' |
@@ -87,13 +89,28 @@ annotateRanges <- function(fds, feature="hgnc_symbol", featureName=feature, |
87 | 89 | #' @export |
88 | 90 | annotateRangesWithTxDb <- function(fds, feature="SYMBOL", |
89 | 91 | featureName="hgnc_symbol", |
90 | | - txdb=TxDb.Hsapiens.UCSC.hg19.knownGene, |
91 | | - orgDb=org.Hs.eg.db){ |
| 92 | + txdb=NULL, orgDb=NULL){ |
92 | 93 |
|
93 | 94 | # check input |
94 | 95 | stopifnot(is(fds, "FraseRDataSet")) |
95 | 96 | if(length(fds) == 0) return(fds) |
96 | 97 |
|
| 98 | + if(is.null(txdb)){ |
| 99 | + if(requireNamespace("TxDb.Hsapiens.UCSC.hg19.knownGene")){ |
| 100 | + txdb <- TxDb.Hsapiens.UCSC.hg19.knownGene |
| 101 | + } else{ |
| 102 | + stop("Please provide a TxDb object as input.") |
| 103 | + } |
| 104 | + |
| 105 | + } |
| 106 | + if(is.null(orgDb)){ |
| 107 | + if(requireNamespace("org.Hs.eg.db")){ |
| 108 | + orgDb <- org.Hs.eg.db |
| 109 | + } else{ |
| 110 | + stop("Please provide an OrgDb object to extract gene symbols") |
| 111 | + } |
| 112 | + } |
| 113 | + |
97 | 114 | for(i in c("psi3", "psiSite")){ |
98 | 115 | # get GRanges object with the split reads which should be annotated |
99 | 116 | gr <- rowRanges(fds, type=i) |
|
0 commit comments