diff --git a/R/AllGenerics.R b/R/AllGenerics.R index 65cda1fb..1e327edc 100644 --- a/R/AllGenerics.R +++ b/R/AllGenerics.R @@ -152,9 +152,11 @@ setReplaceMethod("workingDir", "FraserDataSet", function(object, value) { #' @rdname fds-methods setMethod("strandSpecific", "FraserDataSet", function(object) { if(!"strand" %in% colnames(colData(object))){ - warning("Strand is not specified. Please set the used RNA-seq", + if(ncol(object) > 0){ + warning("Strand is not specified. Please set the used RNA-seq", " protocol by using 'strandSpecific(object) <- c(...)'.", "\n\nWe assume as default a non stranded protocol.") + } return(rep(0, ncol(object))) } return(colData(object)$strand) diff --git a/R/example_functions.R b/R/example_functions.R index 1ec450d1..99b90f6d 100644 --- a/R/example_functions.R +++ b/R/example_functions.R @@ -43,6 +43,9 @@ createTestFraserSettings <- function(workingDir="FRASER_output"){ # check that NHDF is NA group sampleTable[gene=='NHDF', condition:=NA] + # set strand specificity column in colData + sampleTable[, strand := 0L] + # create FRASER object fds <- FraserDataSet(colData=sampleTable, workingDir=workingDir) diff --git a/R/mergeExternalData.R b/R/mergeExternalData.R index c5f5dc4c..44ba7123 100644 --- a/R/mergeExternalData.R +++ b/R/mergeExternalData.R @@ -93,7 +93,7 @@ mergeExternalData <- function(fds, countFiles, sampleIDs, annotation=NULL){ rownames(annotation) <- annotation[,"sampleID"] newColData <- DataFrame(rbind(fill=TRUE, as.data.table(colData(fds)), - as.data.table(annotation[sampleIDs,]))) + as.data.table(annotation[sampleIDs,,drop=FALSE]))) rownames(newColData) <- newColData[,"sampleID"] # diff --git a/R/saveHDF5Objects.R b/R/saveHDF5Objects.R index 37948de4..a7e89bb7 100644 --- a/R/saveHDF5Objects.R +++ b/R/saveHDF5Objects.R @@ -70,11 +70,12 @@ loadFraserDataSet <- function(dir, name=NULL, file=NULL, upgrade=FALSE){ # can be removed later if the full pipeline is rerun attributes(fds)$class <- structure("FraserDataSet", package="FRASER") - # adapt type of strandSpecific if needed (changed from logical to integer) - if(is.logical(strandSpecific(fds))){ - strandSpecific(fds) <- as.integer(strandSpecific(fds)) + # ensure strandSpecific slot is up-to-date with new vector format + if("strandSpecific" %in% slotNames(fds)){ + strandSpecific(fds) <- slot(fds, "strandSpecific") } + e <- try(assays(fds), silent=TRUE) if(is.error(e)){ if(grepl("DelayedMatrix .* representation .* Please update it ", diff --git a/inst/extdata/externalCounts/annotation.tsv.gz b/inst/extdata/externalCounts/annotation.tsv.gz index 780e0359..8e4edb84 100644 Binary files a/inst/extdata/externalCounts/annotation.tsv.gz and b/inst/extdata/externalCounts/annotation.tsv.gz differ