8000 wrong output file path is checked for existence · Issue #358 · al2na/methylKit · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

wrong output file path is checked for existence #358

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

Open
alexg9010 opened this issue Apr 16, 2025 · 0 comments
Open

wrong output file path is checked for existence #358

alexg9010 opened this issue Apr 16, 2025 · 0 comments
Assignees

Comments

@alexg9010
Copy link
Collaborator
alexg9010 commented Apr 16, 2025

The output file is currently assumed in the same folder as the input tabix file. This is violated if dbdir argument is given.
The file is created at the correct path though.

# catch additional args
args <- list(...)
dir <- dirname(object@dbpath)
if( "dbdir" %in% names(args) ){
if( !(is.null(args$dbdir)) ){
dir <- .check.dbdir(args$dbdir)
}
}
if(!( "suffix" %in% names(args) ) ){
suffix <- "_tiled"
} else {
suffix <- paste0("_",args$suffix)
}
# filename <- paste0(paste(object@sample.id,collapse = "_"),
# suffix,".txt")
filename <- paste0(gsub(".txt.bgz","",object@dbpath),suffix,".txt")
filename <- .checkTabixFileExists(filename)

Simple test:

library(methylKit)
data("methylKit")

dbdir <- "my_storage_path"
dbdir_unite <- file.path(dbdir,"unite")
dbdir_tile <- file.path(dbdir,"tile")
dbdir_diffmeth <- file.path(dbdir,"diffmeth")


## init methylrawlistdb in old dbdir
mlist_db <- methylRawList.obj |> makeMethylDB(dbdir = dbdir)
mlist_db |> getDBPath() |> basename() %in% dir(dbdir) |> all()


get_checked_file <- function(log) {
  matches <- log |> grep(pattern = "checking wether tabix file already exists:" ) + 1 
  return(log[matches])
}

## create new methylbase in new dbdir
unite_log <- {mlist_db_unite <- mlist_db |> unite(dbdir = dbdir_unite)} |> capture.output(type = "message")
identical(
  unite_log |> get_checked_file() |> normalizePath(),
  mlist_db_unite |> getDBPath()
  )

## prints the wrong for diffmeth
diffmeth_log <- {mlist_db_diffmeth <- mlist_db_unite |> calculateDiffMeth(dbdir = dbdir_diffmeth)} |> capture.output(type = "message")
identical(
  diffmeth_log |> get_checked_file() |> normalizePath(),
  mlist_db_diffmeth |> getDBPath()
)


## prints the wrong for tiling
tile_log <- {mlist_db_tiled <- mlist_db |> tileMethylCounts(dbdir = dbdir_tile)} |> capture.output(type = "message") 
identical(
  tile_log |> get_checked_file() |> normalizePath(),
  mlist_db_tiled |> getDBPath()
)


unlink(x = c(dbdir), recursive = TRUE)
@alexg9010 alexg9010 self-assigned this Apr 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant
0