forked from tgirke/systemPipeRdata
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
652 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
cluster.functions <- makeClusterFunctionsSlurm(template="batchtools.slurm.tmpl") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,172 @@ | ||
--- | ||
title: "Single Cell RNAseq" | ||
author: "Author: FirstName LastName" | ||
date: "Last update: `r format(Sys.time(), '%d %B, %Y')`" | ||
output: | ||
BiocStyle::html_document: | ||
toc_float: true | ||
code_folding: show | ||
BiocStyle::pdf_document: default | ||
package: systemPipeR | ||
vignette: | | ||
%\VignetteIndexEntry{RIBO-Seq Workflow Template} | ||
%\VignetteEncoding{UTF-8} | ||
%\VignetteEngine{knitr::rmarkdown} | ||
fontsize: 14pt | ||
bibliography: bibtex.bib | ||
editor_options: | ||
chunk_output_type: console | ||
--- | ||
|
||
<!-- | ||
Config css and r style | ||
--> | ||
|
||
```{css, echo=FALSE} | ||
pre code { | ||
white-space: pre !important; | ||
overflow-x: scroll !important; | ||
word-break: keep-all !important; | ||
word-wrap: initial !important; | ||
} | ||
``` | ||
|
||
```{r style, echo = FALSE, results = 'asis'} | ||
BiocStyle::markdown() | ||
options(width=60, max.print=1000) | ||
knitr::opts_chunk$set( | ||
eval=as.logical(Sys.getenv("KNITR_EVAL", "TRUE")), | ||
cache=as.logical(Sys.getenv("KNITR_CACHE", "TRUE")), | ||
tidy.opts=list(width.cutoff=60), tidy=TRUE) | ||
``` | ||
|
||
```{r setup, echo=FALSE, message=FALSE, warning=FALSE, eval=FALSE} | ||
suppressPackageStartupMessages({ | ||
library(systemPipeR) | ||
}) | ||
``` | ||
|
||
# About the template | ||
This section provides general description and how to use this single cell RNAseq (scRNAseq) workflow. | ||
In the actual analysis report, this section is usually **removed**. | ||
|
||
This scRNAseq workflow template is based on the | ||
|
||
|
||
This workflow does: | ||
1. | ||
|
||
|
||
![](results/plotwf_spscrna.jpg) | ||
|
||
# Introduction | ||
|
||
Users want to provide here background information about the design of their | ||
scRNAseq project. | ||
|
||
This report describes the analysis of a scRNAseq project studying drug ... | ||
|
||
## Experimental design | ||
|
||
Typically, users want to specify here all information relevant for the | ||
analysis of their scRNAseq study. This includes detailed descriptions of | ||
files, experimental design, reference genome, gene annotations, | ||
etc. | ||
|
||
# Workflow environment | ||
|
||
_`systemPipeR`_ workflows can be designed and built from start to finish with a | ||
single command, importing from an R Markdown file or stepwise in interactive | ||
mode from the R console. | ||
|
||
This tutorial will demonstrate how to build the workflow in an interactive mode, | ||
appending each step. The workflow is constructed by connecting each step via | ||
`appendStep` method. Each `SYSargsList` instance contains instructions needed | ||
for processing a set of input files with a specific command-line or R software | ||
and the paths to the corresponding outfiles generated by a particular tool/step. | ||
|
||
To create a Workflow within _`systemPipeR`_, we can start by defining an empty | ||
container and checking the directory structure: | ||
|
||
```{r create_workflow, message=FALSE, eval=FALSE} | ||
library(systemPipeR) | ||
sal <- SPRproject() | ||
sal | ||
``` | ||
|
||
## Load packages | ||
|
||
This is an empty template that contains only one demo step. | ||
Refer to our [website](https://systempipe.org/sp/spr/spr_run/) for how to | ||
add more steps. If you prefer a more enriched template, | ||
[read this page](https://systempipe.org/sp/spr/templates/) for other | ||
pre-configured templates. | ||
|
||
```{r load_packages, eval=FALSE, spr=TRUE} | ||
cat(crayon::blue$bold("To use this workflow, following R packages are expected:\n")) | ||
cat(c("'Seurat", "readr'\n"), sep = "', '") | ||
###pre-end | ||
appendStep(sal) <- LineWise( | ||
code = { | ||
library(systemPipeR) | ||
library(rBLAST) | ||
}, | ||
step_name = "load_packages" | ||
) | ||
``` | ||
|
||
|
||
## Workflow session | ||
|
||
```{r wf_session, eval=FALSE, spr=TRUE} | ||
appendStep(sal) <- LineWise( | ||
code = { | ||
sessionInfo() | ||
}, | ||
step_name = "wf_session", | ||
dependency = "xxx") | ||
``` | ||
|
||
# Manage the workflow | ||
|
||
To run the workflow, use `runWF` function. It executes all the steps store in | ||
the workflow container. The execution will be on a single machine without | ||
submitting to a queuing system of a computer cluster. | ||
|
||
```{r runWF, eval=FALSE} | ||
sal <- runWF(sal, run_step = "mandatory") # remove `run_step` to run all steps to include optional steps | ||
``` | ||
|
||
- To use complex workflow control options, such as parallelization, subsetting samples, selecting steps, read the [documents](https://systempipe.org/sp/spr/sp_run/step_run/) on our website. | ||
- Explore [other details of the workflow object](https://systempipe.org/sp/spr/sp_run/sal_explore/). | ||
- Create [logs and reports](https://systempipe.org/sp/spr/sp_run/step_reports/). | ||
- [Visualize the workflow](https://systempipe.org/sp/spr/sp_run/step_vis/). | ||
|
||
# About the workflow | ||
## Tools used | ||
To check command-line tools used in this workflow, use `listCmdTools`, and use `listCmdModules` | ||
to check if you have a modular system. | ||
|
||
The following code will print out tools required in your custom SPR project in the report. | ||
In case you are running the workflow for the first and do not have a project yet, or you | ||
just want to browser this workflow, following code displays the tools required by default. | ||
```{r list_tools} | ||
if(file.exists(file.path(".SPRproject", "SYSargsList.yml"))) { | ||
local({ | ||
sal <- systemPipeR::SPRproject(resume = TRUE) | ||
systemPipeR::listCmdTools(sal) | ||
systemPipeR::listCmdModules(sal) | ||
}) | ||
} else { | ||
cat(crayon::blue$bold("Tools and modules required by this workflow are:\n")) | ||
cat(c("NA"), sep = "\n") | ||
} | ||
``` | ||
|
||
|
||
## Session Info | ||
This is the session information for rendering this report. To access the session information | ||
of workflow running, check HTML report of `renderLogs`. | ||
```{r report_session_info, eval=TRUE} | ||
sessionInfo() | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/bin/bash | ||
|
||
## Job Resource Interface Definition | ||
## | ||
## ntasks [integer(1)]: Number of required tasks, | ||
## Set larger than 1 if you want to further parallelize | ||
## with MPI within your job. | ||
## ncpus [integer(1)]: Number of required cpus per task, | ||
## Set larger than 1 if you want to further parallelize | ||
## with multicore/parallel within each task. | ||
## walltime [integer(1)]: Walltime for this job, in minutes. | ||
## Must be at least 1 minute. | ||
## memory [integer(1)]: Memory in megabytes for each cpu. | ||
## Must be at least 100 (when I tried lower values my | ||
## jobs did not start at all). | ||
## | ||
## Default resources can be set in your .batchtools.conf.R by defining the variable | ||
## 'default.resources' as a named list. | ||
|
||
<% | ||
# relative paths are not handled well by Slurm | ||
log.file = normalizePath(log.file, winslash = "/", mustWork = FALSE) | ||
-%> | ||
|
||
|
||
#SBATCH --job-name=<%= job.name %> | ||
#SBATCH --output=<%= log.file %> | ||
#SBATCH --error=<%= log.file %> | ||
#SBATCH --time=<%= ceiling(resources$walltime / 1) %> | ||
#SBATCH --ntasks=1 | ||
#SBATCH --cpus-per-task=<%= resources$ncpus %> | ||
#SBATCH --mem-per-cpu=<%= resources$memory %> | ||
<%= if (!is.null(resources$partition)) sprintf(paste0("#SBATCH --partition='", resources$partition, "'")) %> | ||
<%= if (array.jobs) sprintf("#SBATCH --array=1-%i", nrow(jobs)) else "" %> | ||
|
||
## specify which queue on biocluster, one of 'batch', 'highmem', 'intel', 'gpu', 'mygroup' | ||
#SBATCH -p short | ||
##SBATCH -p batch | ||
##SBATCH -p intel | ||
|
||
## Initialize work environment like | ||
## source /etc/profile | ||
## module add ... | ||
|
||
## Export value of DEBUGME environemnt var to slave | ||
export DEBUGME=<%= Sys.getenv("DEBUGME") %> | ||
|
||
## Run R: | ||
## we merge R output with stdout from SLURM, which gets then logged via --output option | ||
Rscript -e 'batchtools::doJobCollection("<%= uri %>")' | ||
|
Oops, something went wrong.