
Create a standard project directory tree
GenerateDirectories.RdBuilds the conventional scSidekick analysis folder layout under base_dir
and returns every created path as a named list. Replaces the usual pile of
paste0() + dir.create() lines at the top of an analysis script.
The tree created is:
Usage
GenerateDirectories(
base_dir,
subset = "All_Clusters",
object_name = NULL,
resolution = NULL,
output_subdirs = "Featuremaps",
extra_top = NULL,
set_wd = FALSE,
verbose = TRUE
)Arguments
- base_dir
Character. Project root directory. Created if absent.
- subset
Character. Name of the analysis branch under
Output/(e.g."All_Clusters","Tcells"). Default"All_Clusters".- object_name
Character or
NULL. Project label. Stored on the returned list (and used by downstream functions for file prefixes); does not affect the folder structure. DefaultNULL.- resolution
Numeric or
NULL. Clustering resolution. Stored on the returned list for reference only. DefaultNULL.- output_subdirs
Character vector. Subfolders to create inside the
Output/<subset>/branch. Default"Featuremaps". Passcharacter(0)for none, or e.g.c("Featuremaps", "DotPlots", "Pathways").- extra_top
Character vector or
NULL. Additional top-level folders to create directly underbase_dir(beyondR_Objects,R_Code,Output). DefaultNULL.- set_wd
Logical. Set the working directory to
base_dir? DefaultFALSE.- verbose
Logical. Message each folder as it is created? Default
TRUE.
Value
Invisibly, a named list of absolute paths:
base_dirthe project root
robj_dirbase_dir/R_Objectsrcode_dirbase_dir/R_Codeoutput_rootbase_dir/Outputoutput_dirbase_dir/Output/<subset>- the per-analysis branch- one entry per
output_subdirs keyed by a lower-case, snake-case version of the folder name, e.g.
featuremaps- one entry per
extra_top keyed the same way
object_name,subset,resolutionechoed back for convenience
Use output_dir directly with PrepObject() or any plotting function.
Examples
if (FALSE) { # \dontrun{
dirs <- GenerateDirectories(
base_dir = "~/Projects/YAP_scRNAseq",
subset = "All_Clusters",
object_name = "YAP project",
resolution = 1,
output_subdirs = c("Featuremaps", "DotPlots", "Pathways"))
# Wire the paths straight into the rest of the workflow:
obj <- PrepObject(obj, variables = "celltype.l1",
output_dir = dirs$output_dir, object_name = dirs$object_name)
saveRDS(obj, file.path(dirs$robj_dir, "obj.rds"))
RunGSEA(obj, output_dir = dirs$pathways)
} # }