KALLISTO QUANT

Pseudoalign reads and quantify transcripts using kallisto.

URL:

Example

This wrapper can be used in the following way:

rule kallisto_quant:
    input:
        fastq = ["reads/{exp}_R1.fastq", "reads/{exp}_R2.fastq"],
        index = "index/transcriptome.idx"
    output:
        directory('quant_results_{exp}')
    params:
        extra = ""
    log:
        "logs/kallisto_quant_{exp}.log"
    threads: 1
    wrapper:
        "v1.2.0/bio/kallisto/quant"

Note that input, output and log file paths can be chosen freely.

When running with

snakemake --use-conda

the software dependencies will be automatically deployed into an isolated environment before execution.

Software dependencies

  • kallisto==0.45.0

Authors

  • Joël Simoneau

Code

"""Snakemake wrapper for Kallisto quant"""

__author__ = "Joël Simoneau"
__copyright__ = "Copyright 2019, Joël Simoneau"
__email__ = "simoneaujoel@gmail.com"
__license__ = "MIT"

from snakemake.shell import shell

# Creating log
log = snakemake.log_fmt_shell(stdout=True, stderr=True)

# Placeholder for optional parameters
extra = snakemake.params.get("extra", "")

# Allowing for multiple FASTQ files
fastq = snakemake.input.get("fastq")
assert fastq is not None, "input-> a FASTQ-file is required"
fastq = " ".join(fastq) if isinstance(fastq, list) else fastq

shell(
    "kallisto quant "  # Tool
    "{extra} "  # Optional parameters
    "--threads={snakemake.threads} "  # Number of threads
    "--index={snakemake.input.index} "  # Input file
    "--output-dir={snakemake.output} "  # Output directory
    "{fastq} "  # Input FASTQ files
    "{log}"  # Logging
)