xqtl-protocol
xqtl-protocol copied to clipboard
avoid jumping around wd in the psichomics modules
I wonder if the following script can be changed to get rid of setwd so that the wd will not be messed up so easily and give us a headache.
for (f in c(${_input:ar,})){
filename = gsub("^.*/", "", f)
directory = gsub(filename, "", f)
if (length(files[[directory]]) == 0){
files[[directory]] = filename
} else {
files[[directory]] = append(files[[directory]], filename)
}
}
if (length(files) == 1) {
setwd(names(files)[1])
res = prepareJunctionQuant(files[[1]])
} else {
res = list()
for (i in 1:(length(files))) {
d = names(files[i])
setwd(d)
res[[d]] = prepareJunctionQuant(files[[d]])
}
res = res %>% reduce(full_join, by = "Junction ID")
}
res[is.na(res)] <- 0