From 87b4a0e7dfc2923bbfa5c1a53a968f8b0ba03a3f Mon Sep 17 00:00:00 2001 From: cying111 Date: Tue, 28 Jul 2020 06:02:23 +0000 Subject: [PATCH] moved the check condition for gtf one level down to test for txdb object first Former-commit-id: 6a1019cfabb87b3422e5df9f85673c0c19e648d9 --- R/annotationFunctions.R | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/R/annotationFunctions.R b/R/annotationFunctions.R index e410a5ed..8235a164 100755 --- a/R/annotationFunctions.R +++ b/R/annotationFunctions.R @@ -12,9 +12,6 @@ #' package = "bambu") #' gr <- prepareAnnotationsFrom(x = gtf.file) prepareAnnotations <- function(x) { - if(grepl(".gtf",x)){ - return(prepareAnnotationsFromGTF(x)) - } if(class(x) == "TxDb"){ exonsByTx = exonsBy(txdb,by='tx', use.names=TRUE) if(any(duplicated(names(exonsByTx)))) { @@ -37,8 +34,14 @@ prepareAnnotations <- function(x) { minEqClasses <- getMinimumEqClassByTx(exonsByTx) mcols(exonsByTx)$eqClass <- minEqClasses$eqClass[match(names(exonsByTx),minEqClasses$queryTxId)] return(exonsByTx) + }else{ + if(grepl(".gtf",x)){ + return(prepareAnnotationsFromGTF(x)) + } + } + }