diff --git a/config/config_final.yml b/config/config_final.yml index d67a752..ae4b8b7 100755 --- a/config/config_final.yml +++ b/config/config_final.yml @@ -30,6 +30,7 @@ conda: STAR: $envsdir/STAR.yml stringtie: $envsdir/stringtie.yml salmon: $envsdir/salmon.yml + r: $envsdir/R.yml # reference files, genome indices and data reference: diff --git a/workflow/R/R_custom.R b/workflow/R/R_custom.R index 4e7c9d3..4cbad82 100755 --- a/workflow/R/R_custom.R +++ b/workflow/R/R_custom.R @@ -1,17 +1,8 @@ ### Create and load vector of packages #setwd(final_output) source("workflow/R/config_all.R") -new.packages <- my_packages_cran[!(my_packages_cran %in% installed.packages()[,"Package"])] -if(length(new.packages)) install.packages(new.packages) -# Load BiocManager -if (!requireNamespace("BiocManager", quietly = TRUE)) - install.packages("BiocManager") -# Check and install missing packages -missing_packages <- my_packages_bioconductor[!(my_packages_bioconductor %in% installed.packages()[,"Package"])] -if (length(missing_packages)) - BiocManager::install(missing_packages) -lapply(my_packages_cran, require, character.only = TRUE) -lapply(mmy_packages_bioconductor, require, character.only = TRUE) +lapply(my_packages, require, character.only = TRUE) + ### Create a list with all txt files containing the samples for each tissues ### Extract all samples from the txt list files for each tissues setwd(txt_files_dir) diff --git a/workflow/R/config_all.R b/workflow/R/config_all.R index c441521..06e8c09 100755 --- a/workflow/R/config_all.R +++ b/workflow/R/config_all.R @@ -20,9 +20,8 @@ BRAF_ids <- c("ENST00000288602.11","ENST00000469930.2","ENST00000479537.6","ENST "ENST00000647434.1") ## libraries -my_packages_cran <- c("dplyr","ggplot2","tidyr","ggsignif","ggpubr","patchwork","stringr","ggrepel","tibble") -my_packages_bioconductor <- c("GenomicAlignments","tximport","tximeta") -my_packages_github <- c("bedtoolsr") +my_packages <- c("dplyr","ggplot2","tidyr","ggsignif","ggpubr","patchwork","stringr", + "ggrepel","GenomicAlignments","bedtoolsr","tximport","tximeta","tibble") ## Sample typologies samples_typologies <- c("Lung") diff --git a/workflow/envs/R.yml b/workflow/envs/R.yml new file mode 100644 index 0000000..6c24b0d --- /dev/null +++ b/workflow/envs/R.yml @@ -0,0 +1,11 @@ +name: my_r_env +channels: + - conda-forge + - bioconda + - nodefaults ## block user/system channels +dependencies: + - r-base=4.2 ## always specify the R version (faster solve; more stable) + - r-essentials + - bioconductor-GenomicAlignments + - bioconductor-tximport + - bioconductor-tibble \ No newline at end of file diff --git a/workflow/snakefile_final.smk b/workflow/snakefile_final.smk index 7ad49ac..c851aa2 100755 --- a/workflow/snakefile_final.smk +++ b/workflow/snakefile_final.smk @@ -402,6 +402,8 @@ rule polyA_r_script: output: polyA_204 = config['datadirs']['r'] + "polyA_filtered_3UTR204.csv", polyA_220 = config['datadirs']['r'] + "polyA_filtered_3UTR220.csv" + conda: + config['conda']['r'] shell: "Rscript {params.r_polya}" @@ -412,6 +414,8 @@ rule custom_r_script: r_custom = config['scripts']['r_custom'] output: boxplot_custom = config['datadirs']['r'] + "ratio_BRAF.pdf" + conda: + config['conda']['r'] shell: "Rscript {params.r_custom}" @@ -424,5 +428,7 @@ rule salmon_r_script: boxplot_salmon = config['datadirs']['r'] + "ratio_salmon.pdf", piecharts_salmon = config['datadirs']['r'] + "pie_charts.pdf", total_salmon = config['datadirs']['r'] + "total_salmon.pdf" + conda: + config['conda']['r'] shell: "Rscript {params.r_salmon}"