Zilong-Li/lcWGS-imputation-workflow

Imputation workflow for low coverage whole genome sequencing data

Overview

Topics: genotype-imputation low-coverage-sequencing snakemake-workflows

Latest release: None, Last update: 2024-08-12

Linting: linting: passed, 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/Zilong-Li/lcWGS-imputation-workflow . --tag None

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

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.

General settings

To configure this workflow, modify config/config.yaml according to your needs, following the explanations provided in the file.

Sample and reference panel sheet

  • Add samples to config/samples.tsv. For each sample, the columns sampleid, bam and depth have to be defined. sampleid has to be in the header SM tag of corresponding bam. depth represents the sequencing coverage of the bam. If downsample is defined in config/cofing.yaml, the depth is used to calculate the fraction of downsampling.

  • Add reference panel information to config/refpanel.tsv. For each chromosome, the columns chr, vcf, start and end have to be defined. The start and end refer to the position of variable SNPs in the reference VCF not for the reference genome, which is used to split the imputation tasks into multiple different chunks given chunksize in the config/config.yaml. One can also use optional column quilt_chunk, glimpse_chunk to specify the chunks from QUILT and GLIMPSE. When making accuracy plots, column truth needs to be defined which is a VCF file with truth genotypes of target samples. Optionally, column af can be used to specify the allele frequency of each variable site instead of calculated from the reference panel. The af represents a plain tab separated file of 5 columns chr,pos,ref,alt,af without header. Also, optional column quilt_map,glimpse_map refers to the genetic map file for QUILT and GLIMPSE respectively. Lastly, optional column exclude_samples can be used to remove extra samples in addition to target samples from the reference panel.

  • Imputation test on single region. Add region column in config/refpanel.tsv which is of chrom:start-end form.

Benchmarking on sequencing coverage

Modify the list of downsample in config/config.yaml.

Benchmarking on reference panel size

Modify the list of refsize in config/config.yaml. In default refsize=[0], all samples in the reference panel excluding the target samples in config/samples.tsv are used.

Different scenario run

Modify the variable scenario in config/config.yaml to decide what analyses to run.

  • all : run all comparisions across all programs and settings. requires truth to be configured.
  • speed: run only speed comparisons across all programs and settings.
  • quilt1: run only QUILT.
  • quilt2: run only QUILT2, which is the default.
  • glimpse1: run only GLIMPSE.
  • glimpse2: run only GLIMPSE2.

Linting and formatting

Linting results

None

Formatting results

[DEBUG] 
[DEBUG] 
<unknown>:1: SyntaxWarning: invalid escape sequence '\/'
<unknown>:1: SyntaxWarning: invalid escape sequence '\/'
<unknown>:1: SyntaxWarning: invalid escape sequence '\/'
<unknown>:1: SyntaxWarning: invalid escape sequence '\/'
<unknown>:1: SyntaxWarning: invalid escape sequence '\/'
[DEBUG] 
[DEBUG] In file "/tmp/tmp180y8yyl/workflow/rules/refpanels.smk":  Formatted content is different from original
[DEBUG] 
[DEBUG] 
[DEBUG] 
[DEBUG] 
[DEBUG] 
[INFO] 1 file(s) would be changed 😬
[INFO] 7 file(s) would be left unchanged 🎉

snakefmt version: 0.10.2