Skip to content

Commit

Permalink
remove redundant assays from fds in FRASER2
Browse files Browse the repository at this point in the history
  • Loading branch information
AtaJadidAhari committed Jan 16, 2025
1 parent bb9fa71 commit 012590a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,35 @@ fds <- loadFraserDataSet(dir=workingDir, name=dataset)
implementation <- snakemake@config$aberrantSplicing$implementation

for(type in psiTypes){
currentType(fds) <- type
q <- bestQ(fds, type)
verbose(fds) <- 3 # Add verbosity to the FRASER object
fds <- fit(fds, q=q, type=type, iterations=15, implementation=implementation)
fds <- saveFraserDataSet(fds)
currentType(fds) <- type
q <- bestQ(fds, type)
verbose(fds) <- 3 # Add verbosity to the FRASER object
fds <- fit(fds, q=q, type=type, iterations=15, implementation=implementation)
}

# remove .h5 files from previous runs with other FRASER version
fdsDir <- dirname(snakemake@output$fdsout[1])
for(type in psiTypesNotUsed){
predMeansFile <- file.path(fdsDir, paste0("predictedMeans_", type, ".h5"))
if(file.exists(predMeansFile)){
unlink(predMeansFile)
}
predMeansFile <- file.path(fdsDir, paste0("predictedMeans_", type, ".h5"))
if(file.exists(predMeansFile)){
unlink(predMeansFile)
assay(fds, paste0("predictedMeans_", type), withDimnames=FALSE) <- NULL
}
deltaFiles <- file.path(fdsDir, paste0("delta_", type, ".h5"))
if(file.exists(deltaFiles)){
unlink(deltaFiles)
assay(fds, paste0("delta_", type), withDimnames=FALSE) <- NULL
}
psiFiles <- file.path(fdsDir, paste0(type, ".h5"))
if(file.exists(psiFiles)){
unlink(psiFiles)
assay(fds, type, withDimnames=FALSE) <- NULL
}
rawOtherFiles <- file.path(fdsDir, paste0("rawOtherCounts_", type, ".h5"))
if(file.exists(rawOtherFiles)){
unlink(rawOtherFiles)
assay(fds, paste0("rawOtherCounts_", type), withDimnames=FALSE) <- NULL
}
}

fds <- saveFraserDataSet(fds)
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ library(AnnotationDbi)

annotation <- snakemake@wildcards$annotation
dataset <- snakemake@wildcards$dataset
fdsFile <- snakemake@input$fdsin
# TODO: remove fds_in from wbuild args too
workingDir <- snakemake@params$workingDir
outputDir <- snakemake@params$outputDir

Expand Down Expand Up @@ -60,11 +60,3 @@ fds_input <- annotateIntronReferenceOverlap(fds_input, txdb)
# save fds
fds <- saveFraserDataSet(fds_input, dir=outputDir, name = paste(dataset, annotation, sep = '--'), rewrite = TRUE)

# remove .h5 files from previous runs with other FRASER version
fdsDir <- dirname(snakemake@output$fdsout[1])
for(type in psiTypesNotUsed){
predMeansFile <- file.path(fdsDir, paste0("predictedMeans_", type, ".h5"))
if(file.exists(predMeansFile)){
unlink(predMeansFile)
}
}

0 comments on commit 012590a

Please sign in to comment.