For merging lbm-seq results
This commit is contained in:
parent
e7f41d56f7
commit
be7453fb9d
1 changed files with 20 additions and 0 deletions
20
merge-lbm-seq.R
Normal file
20
merge-lbm-seq.R
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
library(stringr)
|
||||||
|
|
||||||
|
args <- commandArgs(trailingOnly = TRUE)
|
||||||
|
|
||||||
|
path <- args[1]
|
||||||
|
mode <- args[2]
|
||||||
|
|
||||||
|
base_folder <- str_remove(string = path, pattern = "/tmp[0-9]*$")
|
||||||
|
print(base_folder)
|
||||||
|
epoch <- str_extract(string = path, pattern = "(?<=tmp)([0-9]*)")
|
||||||
|
|
||||||
|
flist <- list.files(path, pattern = paste0(mode, ".Rds"), full.names = TRUE)
|
||||||
|
|
||||||
|
stopifnot("No files corresponding to mode found." = length(flist) > 0)
|
||||||
|
|
||||||
|
merged_res <- lapply(flist, readRDS)
|
||||||
|
|
||||||
|
names(merged_res) <- paste0("Rank", seq_along(flist) + 1)
|
||||||
|
|
||||||
|
saveRDS(merged_res, file.path(base_folder, paste0(mode, "_", epoch, ".Rds")))
|
||||||
Loading…
Add table
Reference in a new issue