zifornd/arrays
A Snakemake workflow to analyse Affymetrix expression arrays
Overview
Topics: snakemake microarray
Latest release: 1.0.0, Last update: 2022-12-30
Linting: linting: failed, Formatting:formatting: failed
Deployment
Step 1: Install Snakemake and Snakedeploy
Snakemake and Snakedeploy are best installed via the Mamba package manager (a drop-in replacement for conda). If you have neither Conda nor Mamba, it is recommended to install Miniforge. More details regarding Mamba can be found here.
When using Mamba, run
mamba create -c conda-forge -c bioconda --name snakemake snakemake snakedeploy
to install both Snakemake and Snakedeploy in an isolated environment. For all following commands ensure that this environment is activated via
conda activate snakemake
Step 2: Deploy workflow
With Snakemake and Snakedeploy installed, the workflow can be deployed as follows. First, create an appropriate project working directory on your system and enter it:
mkdir -p path/to/project-workdir
cd path/to/project-workdir
In all following steps, we will assume that you are inside of that directory. Then run
snakedeploy deploy-workflow https://github.com/zifornd/arrays . --tag 1.0.0
Snakedeploy will create two folders, workflow
and config
. The former contains the deployment of the chosen workflow as a Snakemake module, the latter contains configuration files which will be modified in the next step in order to configure the workflow to your needs.
Step 3: Configure workflow
To configure the workflow, adapt config/config.yml
to your needs following the instructions below.
Step 4: Run workflow
The deployment method is controlled using the --software-deployment-method
(short --sdm
) argument.
To run the workflow with automatic deployment of all required software via conda
/mamba
, use
snakemake --cores all --sdm conda
To run the workflow using apptainer
/singularity
, use
snakemake --cores all --sdm apptainer
To run the workflow using a combination of conda
and apptainer
/singularity
for software deployment, use
snakemake --cores all --sdm conda apptainer
Snakemake will automatically detect the main Snakefile
in the workflow
subfolder and execute the workflow module that has been defined by the deployment in step 2.
For further options such as cluster and cloud execution, see the docs.
Step 5: Generate report
After finalizing your data analysis, you can automatically generate an interactive visual HTML report for inspection of results together with parameters and code inside of the browser using
snakemake --report report.zip
Configuration
The following section is imported from the workflow’s config/README.md
.
Configuration
The workflow is configured by editing the following files:
config/config.yaml
config/samples.tsv
An error will be thrown if these files are missing or not formatted correctly.
Workflow config
The workflow config is a YAML file containing information about the workflow parameters:
- Each line contains a name-value pair
- Each name-value pair corresponds to a workflow parameter
The workflow config must contain the following pairs:
Name | Value | Example |
---|---|---|
samples | Path to sample sheet | config/samples.tsv |
platform | Bioconductor platform data package | pd.hugene.1.0.st.v1 |
annotation | Bioconductor annotation data package | hugene10sttranscriptcluster.db |
organism | Bioconductor organism data package | org.Hs.eg.db |
contrasts | Contrast name and conditions in sample table | treatment-control |
Contrasts for differential expression analysis are defined as shown below:
contrasts:
treatment-control:
- treatment
- control
Below is an example of a valid workflow config:
samples: config/samples.tsv
platform: pd.hugene.1.0.st.v1
annotation: hugene10sttranscriptcluster.db
organism: org.Hs.eg.db
contrasts:
treatment-control:
- treatment
- control
For this example, the workflow will install the platform, annotation, and organism Bioconductor packages and run a differential expression analysis on the treatment versus control conditions.
Sample table
The sample table is a TSV file containing data on the experimental design:
- Each row corresponds to one sample
- Each column corresponds to one attribute
For each sample, you must provide the following columns:
Column | Description | Example |
---|---|---|
sample | Sample name | S1 |
condition | Condition | treatment |
filename | Array file | S1.CEL |
To incorporate batch effects and blocking, you must add the following columns:
Column | Description | Example |
---|---|---|
batch | Batch effect | S1-B1 |
block | Sample pairing | S1-P1 |
Below is an example of a valid sample table:
sample condition filename batch block
S1 C S1.CEL A A
S2 C S2.CEL A B
S3 C S1.CEL B C
S4 T S2.CEL A A
S5 T S3.CEL A B
S6 T S4.CEL B C
Missing values can be specified by empty columns or by writing NA
in the relevent entry.
Linting and formatting
Linting results
WorkflowError in file /tmp/tmp5hg2s3x9/zifornd-arrays-d31909c/workflow/rules/common.smk, line 13:
Error validating row 0 of data frame.
ValidationError: 1 is not of type 'string'
Failed validating 'type' in schema['properties']['batch']:
OrderedDict([('type', 'string')])
On instance['batch']:
1
File "/tmp/tmp5hg2s3x9/zifornd-arrays-d31909c/workflow/Snakefile", line 20, in <module>
File "/tmp/tmp5hg2s3x9/zifornd-arrays-d31909c/workflow/rules/common.smk", line 13, in <module>
Formatting results
[DEBUG]
[DEBUG] In file "/tmp/tmp5hg2s3x9/zifornd-arrays-d31909c/workflow/rules/common.smk": Formatted content is different from original
[DEBUG]
[DEBUG] In file "/tmp/tmp5hg2s3x9/zifornd-arrays-d31909c/workflow/rules/preprocessing.smk": Formatted content is different from original
[DEBUG]
[DEBUG] In file "/tmp/tmp5hg2s3x9/zifornd-arrays-d31909c/workflow/rules/go.smk": Formatted content is different from original
[DEBUG]
[DEBUG] In file "/tmp/tmp5hg2s3x9/zifornd-arrays-d31909c/workflow/rules/qc.smk": Formatted content is different from original
[DEBUG]
[DEBUG]
[DEBUG] In file "/tmp/tmp5hg2s3x9/zifornd-arrays-d31909c/workflow/Snakefile": Formatted content is different from original
[DEBUG]
[DEBUG] In file "/tmp/tmp5hg2s3x9/zifornd-arrays-d31909c/workflow/rules/resources.smk": Formatted content is different from original
[DEBUG]
[DEBUG] In file "/tmp/tmp5hg2s3x9/zifornd-arrays-d31909c/workflow/rules/handlers.smk": Formatted content is different from original
[INFO] 7 file(s) would be changed 😬
[INFO] 1 file(s) would be left unchanged 🎉
snakefmt version: 0.8.3