Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warnings related to strandSpecific on load and examples #76

Merged
merged 7 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion R/AllGenerics.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions R/example_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion R/mergeExternalData.R
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

#
Expand Down
12 changes: 9 additions & 3 deletions R/saveHDF5Objects.R
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,17 @@ 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")
} else{
# adapt type of strandSpecific if needed (changed logical -> integer)
if(is.logical(strandSpecific(fds))){
strandSpecific(fds) <- as.integer(strandSpecific(fds))
}
ischeller marked this conversation as resolved.
Show resolved Hide resolved
}


e <- try(assays(fds), silent=TRUE)
if(is.error(e)){
if(grepl("DelayedMatrix .* representation .* Please update it ",
Expand Down
Binary file modified inst/extdata/externalCounts/annotation.tsv.gz
Binary file not shown.
Loading