runs separately and not in parallel trimming / mapping ok (paleomix) peak calling separately Bunch of serial manual computing steps at least, singularity was already used Bioinformatic analyses source: ChIP-seq doctoral-course (2018) 2/33
Sekhar Pedamallu @ DFCI, The Broad Inst. # Date: June 2016 # Full PathSeq pipeline # time $pdir/FullPathSeq_June2016.sh $bamloc/SN218_Run0771_Lane # set start_time=`date +%s` @ noargs=$# #############################PLEASE SET THESE ENVIRONMENTAL VAR # Program Settings set Institute="BROAD" [...] if($noargs < 4) then echo "Please check your argunments" echo "Usage : ./FullPathSeq_xxxx.sh <Input file in BAM or F echo "Example : ./FullPathSeq_xxxx.sh unmappedreads.10K.fq1 exit endif ###################INPUT FILES################################# # Present Directory set pdir = `pwd` rm $pdir"/clean.files" rm -r $pdir"/Commands/" [...] FullPathSeq_June2016.sh 3/33
are mingled (here: settings) software/input de ned as absolute paths comments are instructions software dependencies not included (csh!) on HPC, no admin rights any issue implies to start over version in lename (see the usage with xxxx) le management (here: rm recursive! 😳) requires many effort to port over We start from #!/bin/csh # Created by: Chandra Sekhar Pedamallu @ DFCI, The Broad Inst. # Date: June 2016 # Full PathSeq pipeline # time $pdir/FullPathSeq_June2016.sh $bamloc/SN218_Run0771_Lane # set start_time=`date +%s` @ noargs=$# #############################PLEASE SET THESE ENVIRONMENTAL VAR # Program Settings set Institute="BROAD" [...] if($noargs < 4) then echo "Please check your argunments" echo "Usage : ./FullPathSeq_xxxx.sh <Input file in BAM or F echo "Example : ./FullPathSeq_xxxx.sh unmappedreads.10K.fq1 exit endif ###################INPUT FILES################################# # Present Directory set pdir = `pwd` rm $pdir"/clean.files" rm -r $pdir"/Commands/" [...] FullPathSeq_June2016.sh 3/33
to be, stop micromanaging your analyses use relative paths clear instructions in a README code in one folder, users edit 3 text les software installed in singularity image makes seamless deployment on HPC 🥴 singularity images are versioned, code and reports too ongoing work in temporary folders multi-platform (Windows, MacOS, GNU/Linux) What we want 4/33
diagram Explicit dependencies Parallelization: independent branches, like fastqc and adapter_removal inside a step, speci ed number of cores to used RNA-seq work ow, steps From sequence reads to differential gene expression step dependencies from my snakemake template 5/33
de nes both upstream dependencies output de nes the produced le(s) container tells to use a speci c singularity image threads speci ed. Over total of available, decide what to run if 28 cores booked, 2 indexing can be started simultaneously params are fetch from config (adv. users) next rule align_multi will use this output for its input Rule example Remember, you don't need to edit this rule star_index: input: fasta = "refs/{}.fasta".format(config["ref"]["build"]), gtf = "refs/{}.gtf".format(config["ref"]["build"]) output: directory("refs/{}".format(config["ref"]["build"])) message: "STAR indexing {}".format(config["ref"]["build"]) container: "docker://ginolhac/snake-rna-seq:0.4" threads: 12 params: build = config["ref"]["build"], extra = "" log: "logs/star_index_{}.log".format(config["ref"]["build"]) wrapper: "0.65.0/bio/star/index" 7/33
🥱 On HPC one doesn't have admin rights modules prepared by the HPC teams are great, but more speci c software are missing docker is great but requires admin rights singularity is kind of docker for HPC 10/33
🥱 On HPC one doesn't have admin rights modules prepared by the HPC teams are great, but more speci c software are missing docker is great but requires admin rights singularity is kind of docker for HPC Of course, someone has to install software, it doesn't have to be you — Aurélien adapted from Jenny Bryan hosted at DockerHub and versioned. 10/33
5. install snakemake in a conda environment 6. run snakemake on a computing node (here with 12 cores) module load tools/Singularity conda activate snakemake snakemake --use-singularity \ --singularity-args "-B /scratch/users/aginolhac:/scratch/user -j 12 -n Job counts: count jobs 5 adapter_removal_se 4 align_multi 1 all 1 deseq2 1 deseq2_init 5 fastq_screen 5 fastqc 1 feature_count 1 get_annotation 1 get_genome 1 multiqc 1 pca 1 session 1 star_index 29 This was a dry-run (flag -n). The order of jobs does not reflec 11/33
QC report a result report the matrix of counts ( object) Most analyses need more complex design than KO vs WT start from counts in can be run on a laptop now we still NEED a work ow manager for downstream analyses Completed tasks are marked as such snakemake --dag | dot -Tpdf > dag.pdf 13/33
cell lines Hyp-IL6 treatment 6 time points paired-end ➡ 72samples ➡ 144 FASTQ les Experimental design Scaling up seamlessly Without snakemake running such large experiments would be painful source: Nadège Minoungou 14/33
hours of computing (28 cores) Figure is truncated... references were not included as Nadège wanted speci c ENCODE ones Walltime for initial submission was 24h timeout 😑. Had to resubmit only the same job launcher 😎 condition is simpli ed on purpose. DGE will be redone locally TODO: helpers for editing the config les. 72 * 2 lines by hand is error-prone (and tiring) 15/33
hours of computing (28 cores) Figure is truncated... references were not included as Nadège wanted speci c ENCODE ones Walltime for initial submission was 24h timeout 😑. Had to resubmit only the same job launcher 😎 condition is simpli ed on purpose. DGE will be redone locally TODO: helpers for editing the config les. 72 * 2 lines by hand is error-prone (and tiring) today solution, using BASH ls fastq/*z | paste - - | \ awk 'BEGIN{OFS="\t";print "sample\tunit\tfq1\tfq2\tstrandedness"}{id=substr($1,index($1,"/")+1,index($1,"_")-7);print id,"1",$1,$2, " sed 's/\-/_/' > config/units.tsv ls fastq/*z | paste - - | \ awk 'BEGIN{OFS="\t";print "sample\tcondition"}{id=substr($1,index($1,"/")+1,index($1,"_")-7);print id,id}' | \ sed 's/[0-9]$//; s/\-/_/g' > config/samples.tsv 15/33
R Saving you time and stress Understand how it is implemented in targets de ne your targets connect targets to create the dependencies check dependencies with visnetwork embrace dynamic branching run only what needs to be executed bundle dependencies in a Rmarkdown document with tar_render() increase reproducibility with the package manager renv Example with RNA-seq data from Wendkouni Nadège MINOUNGOU 18/33
is the only mandatory le use a R sub-folder for functions, gets closer to a package Rmarkdown le allows to gather results in a report in a RStudio project version tracked with Folder structure ├── .git/ ├── run.R ├── _targets.R ├── _targets/ ├── Repro.Rproj ├── R │ ├── functions.R │ └── utils.R ├── run.R* ├── renv/ ├── renv.lock └── report.Rmd 19/33
analysis takes 24 minutes and 4.54 seconds Of course, someone has to remember the dependencies, it doesn't have to be you — could be William Landau via Jenny Bryan 26/33
new skill you’re going to suck. It’s going to be frustrating. The good news is that is typical and happens to everyone and it is only temporary. You can’t go from knowing nothing to becoming an expert without going through a period of great frustration and great suckiness. — Hadley Wickham How it sounds source: Hadley Wickham dplyr tutorial at useR 2014 27/33
pckage including its dependencies snapshot registers changes, hashes and origin restore to a certain point in time (snakemake also using with the image tag) renv features > renv::snapshot() The following package(s) will be updated in the lockfile: # CRAN =============================== - RcppParallel [5.0.2 -> 5.0.3] - cli [2.3.0 -> 2.3.1] - pkgload [1.1.0 -> 1.2.0] - tint [0.1.3 -> *] # GitHub ============================= - targets [ropensci/targets@main: 598d7a23 -> bdc1b29c] Do you want to proceed? [y/N]: 29/33
like a dry/black box. targets, written by William Landau (pictured), is exible, robust and still allows for a customized report. All computing is done only when needed, and code is away from writing content. Once knitted the report can be sent to the inquirer. The report as Rmarkdown documents 30/33
like a dry/black box. targets, written by William Landau (pictured), is exible, robust and still allows for a customized report. All computing is done only when needed, and code is away from writing content. Once knitted the report can be sent to the inquirer. The report as Rmarkdown documents 30/33
like a dry/black box. targets, written by William Landau (pictured), is exible, robust and still allows for a customized report. All computing is done only when needed, and code is away from writing content. Once knitted the report can be sent to the inquirer. The report as Rmarkdown documents 30/33
in the LRT step branches can be monitored too 2 videos joined as I xed an error at 1'42" option to display functions (unset here) tar_watch() shiny app from targets Bonus: watch the pipeline running live 🍿 31/33
regrets when returning to previous set-up Add shiny app by Anthoula Gaigneaux to the snakemake template Needs to have docker containers on the shiny server rst practise targets to run on HPC and slurm Link targets upstream les from snakemake at cluster (hash tracked) Design more snakemake templates (ChIP-seq) Advertise and bring in more users 32/33
early adopter of targets Marios Gavriil for yeast data Wendkouni Nadège Minoungou for the Lnc6 data Jochen Ohnmacht, Vincent Gureghian & Yujuan Gui for testing the template Sarah Peter for snakemake introduction William Landau main developer of targets Johannes Köster main developer of snakemake Thank you for your attention! 4-days R workshop in May 2021 Elixir-LU event 6th - 11th May 33/33
early adopter of targets Marios Gavriil for yeast data Wendkouni Nadège Minoungou for the Lnc6 data Jochen Ohnmacht, Vincent Gureghian & Yujuan Gui for testing the template Sarah Peter for snakemake introduction William Landau main developer of targets Johannes Köster main developer of snakemake Thank you for your attention! 4-days R workshop in May 2021 Elixir-LU event 6th - 11th May 33/33