This Snakemake workflow automates the extraction of epigenomic features using Finaletoolkit, supporting parallel processing, SLURM, and common genomic file formats.
- Finaletoolkit Support: Implements most Finaletoolkit CLI commands (excluding
gap-bedanddelfi-gc-correct). - File Compatibility: Works with BED, BAM, and CRAM files.
- Mappability Filtering: Filters interval files based on mappability scores.
- Parallelization: Supports multi-core processing.
- SLURM Integration: Enables job submission to SLURM clusters.
Reference the following commands for setup and execution:
$ git clone https://github.com/epifluidlab/finaletoolkit_workflow # Download the repository containing the workflow
$ cd finaletoolkit_workflow # Enter the repository folder
$ conda env create -f environment.yml # Create environment with relevant conda packages
$ conda activate finaletoolkit_workflow # Use environment for finaletoolkit-workflow
$ pip install finaletoolkit # Install finaletoolkit seperately through pip
$ snakemake --configfile params.yaml --cores 4 --jobs 2 # Run with parameters set in params.yamlThis workflow relies on the following tools being installed and accessible by your system PATH. FinaleToolkit must be installed through pip and the other packages through bioconda in conda (already installed if you activated the conda environment from environment.yml)
finaletoolkit: A command-line tool for epigenomic feature extraction.snakemake: A workflow engine that determines which operations ("rules") to carry out on genomic files.bedtools: A suite of utilities for working with and manipulating genomic intervals.htslib: A library that includesbgzip, necessary to GZIP uncompressed BED files.samtools: A set of tools for manipulating and analyzing sequencing BAM/CRAM data
- Configuration: Create a
params.yamlfile defining your input, output, and processing options (reference below sections). - Basic Execution: Run the workflow in the directory with the
Snakefilepresent through the following command:
cd finaletoolkit_workflow # Enter the folder with the workflow Snakefile
# --cores: Number of CPU cores to use.
# --jobs: Maximum number of concurrent jobs (limited by --cores).
snakemake --configfile params.yaml --cores <cores> --jobs <jobs>- SLURM Execution: Submit to SLURM to run the workflow through the command below (see
slurm_profile/config.yamlfor default settings).
cd finaletoolkit_workflow # Enter the folder with the workflow Snakefile
# Runs the command through params specified in slurm_profile/config.yaml in the background (&),
# Redirects all command-related output to snakemake.log
snakemake --profile slurm_profile > snakemake.log 2>&1 &- Input:
- Genomic data files are located in the directory specified by
input_dir. - Supplemental files (blacklist, mappability, intervals) are located in the directory specified by
supplement_dir.
- Genomic data files are located in the directory specified by
- Output: Processed files are written to the directory specified by
output_dir. - Configuration:
params.yamldictates workflow parameters.
-
Required:
input_dir: Path to the input directory. Defaults toinputif not specifiedoutput_dir: Path to the output directory. Defaults tooutputif not specified.file_format:"bed.gz","frag.gz","bam", or"cram"indicating the format of the input files. Defaults tobed.gzif not specified.
-
Optional:
supplement_dir: Path to supplemental files directory. Defaults tosupplementif not specified.mappability_file: Name of the bigWig mappability file insupplement_dir.mappability_threshold: Minimum average mappability score (0.0-1.0) for interval filtering.interval_file: Path to interval file insupplement_dir.finaletoolkit_command: True/False: Enables a specific Finaletoolkit command, using hyphens replaced by underscores (e.g.,adjust-wpsbecomesadjust_wps: True).finaletoolkit_command_flag: value: Sets flags for a Finaletoolkit command (e.g.,adjust_wps_max_length: 250). Flags that take input files, output files, orverboseflags do not exist here.mapping_qualityis shortened tomapqfor flags (e.g.,coverage_mapping_qualitybecomescoverage_mapq).
- Filtered Files: Files are always given a
.filteredextension before the file format when passed into the output directory (e.g.,file.filtered.bed.gz). - Command-Processed Files: Files processed by a Finaletoolkit command have the command name (with underscores) inserted before their format (e.g.,
file.frag_length_bins.bed.gz). - Multiple Commands: Input files will be processed for each enabled Finaletoolkit command.
- Uses
mappability_fileandmappability_threshold(float from 0-1) to filter intervals specified byinterval_file. - Interval files used in Finaletoolkit commands are pre-filtered by mappability quality to at least the threshold if set.
- Finaletoolkit commands are specified in
params.yamlwith underscores instead of hyphens. - Set command flags by appending
_<flag_name>to the converted command name. - This workflow respects command dependencies. For example,
adjust-wpsrequireswpsoutput, andmdsneedsend-motifs.
- If only
filter-fileis set toTrue, the output of the workflow will be only the filtered files. - If any other Finaletoolkit commands are set, they will use the output of
filter-fileas their input.
- This workflow uses
verbosefor Finaletoolkit commands by default. - Deprecated flags cannot be used in this workflow.
Li J*, Bandaru R*, Liu Y (2024) FinaleToolkit: Accelerating Cell-Free DNA Fragmentation Analysis with a High-Speed Computational Toolkit. BioRxiv Preprint
- Kundan Baliga: [email protected]
- Ravi Bandaru: [email protected]
- Yaping Liu: [email protected]
This project falls under an MIT license. See the included LICENSE file for details.