/PLNnetwork-workflow

Infer network from count data within Snakemake using a sparse Poisson lognormal model (PLNnetwork)

Primary LanguageR

PLNnetwork-workflow

Infer a network from count data within Snakemake using a sparse Poisson lognormal model (PLNnetwork)

This Snakemake workflow provides the means to fit a sparse Poisson lognormal model for sparse covariance inference for counts (aka PLNnetwork). This model is a subset of a nice collection of models bundled into the R package PLNmodels. The R version and package dependencies are contained within conda environment for reproducibility. The R commands are splitted as Snakemake rules to be able to start again on error and follow up the dependencies between the created files (such as RDS files for the models or bootstraps).

Usage

The organisation of this workflow was adapted from the template of snakemake workflows.

Step 1: Obtain a copy of this workflow

  1. Create a new github repository using this workflow as a template.
  2. Clone the newly created repository to your local system, into the place where you want to perform the data analysis.

Step 2: Configure workflow

Configure the workflow according to your needs via editing the config.yaml file in the config/ folder. The default configuration runs with a toy dataset which is a subset of the example used in the R package PLNmodels.

Step 3: Install Snakemake

Install Snakemake using conda:

conda create -c bioconda -c conda-forge -n snakemake snakemake

For installation details, see the instructions in the Snakemake documentation.

Step 4: Execute workflow

Activate the conda environment:

conda activate snakemake

Test your configuration by performing a dry-run via

snakemake --use-conda -n

Execute the workflow locally via

snakemake --use-conda --cores $N 

If you have previously installed the dependencies (R and PLNmodels) for this workflow independently or using the following commands, the --use-conda is not necessary:

conda create -n PLNmodels r-plnmodels
snakemake -n --cores $N 

Step 5: Visualise an automatic report of the results

Snakemake has built-in capabilities of reporting the results of the workflow. To do so, you can execute the following line:

snakemake --report report.html