lfranzen / scwat-st

Visium (10x Genomics) on human abdominal s.c white adipose tissue.
MIT License
6 stars 4 forks source link

Error in file(file, ifelse(append, "a", "w")) : cannot open the connection #3

Closed dm8000 closed 2 years ago

dm8000 commented 2 years ago

Hello @lfranzen, I will bother you again

Block {r clustering_annotations_export} which starts in line 471 gives me

Error in file(file, ifelse(append, "a", "w")) : cannot open the connection
6.
file(file, ifelse(append, "a", "w"))
5.
write.table(c_anno, file = file.path(DIR_RES, "tables", fname), row.names = F, col.names = TRUE, sep = ",", dec = ".", qmethod = "double")
4.
eval(expr, p)
3.
eval(expr, p)
2.
eval.parent(Call)
1.
write.csv(c_anno, file = file.path(DIR_RES, "tables", fname), row.names = F)

It seems to be specifically in the second line of the block, which is

write.csv(c_anno, file = file.path(DIR_RES, "tables", fname), row.names = F)

It seems to be a problem with the path. I see DIR_RES is defined in the very first block {r setup, include=FALSE}, as DIR_RES <- file.path(DIR_ROOT, "results" , PROJECT_ID). No folder called results is available and none was created when I ran the script. I decided to create both the results and figures folder manually and ran the code from the start, but I still got the error.

lfranzen commented 2 years ago

Hello! Yes that error is because you are missing the folders/path that you're trying to save the table to. I did not implement any automatic generation of the results folders, so that's something you need to add yourself or change the saving path to something different. In this case, you are trying to save the table to a folder called "tables" within the "results/_PROJECTID" dir, so you need to create that folder, or simply change the output path (DIR_RES) to something else.