Skip to content

Commit

Permalink
Recursive dir.create
Browse files Browse the repository at this point in the history
  • Loading branch information
brucemoran committed Nov 24, 2020
1 parent fc838bd commit a710e60
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export(found_in_three)
export(found_in_two)
export(genesGTF)
export(get_metadata)
export(get_tx2gen)
export(get_tx2gene)
export(limma_module)
export(master_parse_join)
export(nf_core_rnaseq_featco_parser)
Expand Down
2 changes: 1 addition & 1 deletion R/DESeq2_module.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ DESeq2_module <- function(count_data, anno_tb = NULL, tpm_tb = NULL, tag = NULL,
output_dir <- "./DEseq2"
} else {
output_dir <- paste0(output_dir, "/DEseq2")
dir.create(output_dir, showWarnings = FALSE)
dir.create(output_dir, recursive = TRUE, showWarnings = FALSE)
}

##read in condition data
Expand Down
2 changes: 1 addition & 1 deletion R/edgeR_module.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ edgeR_module <- function(count_data, anno_tb = NULL, tpm_tb = NULL, tag = NULL,
output_dir <- "./edgeR"
} else {
output_dir <- paste0(output_dir, "/edgeR")
dir.create(output_dir, showWarnings = FALSE)
dir.create(output_dir, recursive = TRUE, showWarnings = FALSE)
}

##read in condition data
Expand Down
2 changes: 1 addition & 1 deletion R/fgsea.R
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ fgsea_plot <- function(res, sig_res = NULL, msigdb_species = "Homo sapiens", msi

##plotting
out_dir <- paste0(output_dir, "/fgsea")
dir.create(out_dir, showWarnings = FALSE)
dir.create(out_dir, recursive = TRUE, showWarnings = FALSE)
gg_fgsea <- ggplot2::ggplot(fgsea_res_sig_tb, ggplot2::aes(reorder(pathway, NES), NES)) +
ggplot2::geom_col(ggplot2::aes(fill = padj)) +
ggplot2::coord_flip() +
Expand Down
2 changes: 1 addition & 1 deletion R/limma_module.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ limma_module <- function(count_data, anno_tb = NULL, tpm_tb = NULL, tag = NULL,
output_dir <- "./limma"
} else {
output_dir <- paste0(output_dir, "/limma")
dir.create(output_dir, showWarnings = FALSE)
dir.create(output_dir, recursive = TRUE, showWarnings = FALSE)
}

##read in condition data
Expand Down
2 changes: 1 addition & 1 deletion R/post_module_joins.R
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ venn_3 <- function(master_list, tag, output_dir, padj = 0.01){
##compare those lists
vdf <- cbind(unc, unlist(lapply(compf_list, length)))
colnames(vdf) <- c(names(master_list), "Counts")
dir.create(paste0(output_dir, "/venn_3"), showWarnings = FALSE)
dir.create(paste0(output_dir, "/venn_3"), recursive = TRUE, showWarnings = FALSE)
readr::write_csv(as.data.frame(vdf), path = paste0(output_dir, "/venn_3/", tag, ".", contrast, ".venn_3.csv"))

##write venn
Expand Down
4 changes: 2 additions & 2 deletions R/prep_RNAseq_output.R
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ brucemoran_rnaseq_kallisto_parser <- function(metadata_csv, data_dir = NULL, agg

##annotation to use
print("Getting tx2gene object")
tx2gene <- get_tx2gen(genome_prefix)
tx2gene <- RNAseqR::get_tx2gene(genome_prefix)

if(genome_prefix != "hsapiens"){
tx2gene1 <- tx2gene
Expand Down Expand Up @@ -99,7 +99,7 @@ brucemoran_rnaseq_kallisto_parser <- function(metadata_csv, data_dir = NULL, agg
#' @return tx2gene format for sleuth_prep() in get_abundance_tsv()
#' @export

get_tx2gen <- function(genome_prefix){
get_tx2gene <- function(genome_prefix){

datasets <- biomaRt::listDatasets(biomaRt::useMart("ensembl"))
datasetm <- paste0(genome_prefix, "_gene_ensembl")
Expand Down
6 changes: 3 additions & 3 deletions R/wrapper_scripts.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ run_prep_modules_bm <- function(metadata_csv, metadata_design, tag, output_dir =
##create an output called RNAseqR in current dir if no output_dir defined
if(is.null(output_dir)){
output_dir <- paste0(getwd(), "/", tag, "/RNAseqR")
dir.create(output_dir, showWarnings = FALSE)
dir.create(output_dir, recursive = TRUE, showWarnings = FALSE)
}

##prepare data and save
Expand All @@ -39,7 +39,7 @@ run_prep_modules_bm <- function(metadata_csv, metadata_design, tag, output_dir =
tpm_tb <- tpm_tb <- sot[[1]]$obs_raw_tpm$wide
anno_tb <- tibble::as_tibble(sot[[2]])
outdir <- paste0(output_dir, "/inputs")
dir.create(outdir, showWarnings = FALSE)
dir.create(outdir, recursive = TRUE, showWarnings = FALSE)
save(count_data, tpm_tb, anno_tb, file = paste0(outdir, "/", tag, ".count_tpm_anno.RData"))

##run modules
Expand Down Expand Up @@ -95,5 +95,5 @@ run_prep_modules_bm <- function(metadata_csv, metadata_design, tag, output_dir =
})

save(master_list, fitwo_list, fithree, fgsea_list,
paste0(outdir, "/", tag, ".full_results.RData")
paste0(outdir, "/", tag, ".full_results.RData"))
}
6 changes: 3 additions & 3 deletions man/get_tx2gen.Rd → man/get_tx2gene.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a710e60

Please sign in to comment.