KALLISTO QUANT#
Pseudoalign reads and quantify transcripts using kallisto.
URL: https://github.com/pachterlab/kallisto
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:
"v3.0.2-2-g0dea6a1/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.50.0
Input/Output#
Input:
fastq
: FASTQ file(s)index
: indexed file
Output:
directory with results
Params#
extra
: Additional parameters
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
" --threads {snakemake.threads}" # Number of threads
" --index {snakemake.input.index}" # Input file
" {extra}" # Optional parameters
" --output-dir {snakemake.output}" # Output directory
" {fastq}" # Input FASTQ files
" {log}" # Logging
)