TABIX¶
Query given file with tabix.
URL: https://github.com/samtools/htslib
Example¶
This wrapper can be used in the following way:
rule tabix:
input:
"{prefix}.bed.gz",
"{prefix}.bed.gz.tbi"
## list the VCF/BCF as the first input
## and the index as the second input
output:
"{prefix}.output.bed"
params:
region = "1"
log:
"logs/tabix/query/{prefix}.log"
wrapper:
"v1.3.1/bio/tabix/query"
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¶
htslib==1.12
Input/Output¶
Input:
- Bgzip compressed file (e.g. BED.gz, GFF.gz, or VCF.gz)
- Tabix index file
- Region of interest to retrieve (params.region)
Output:
- Uncompressed subset of the input file from the given region
Authors¶
- William Rowell
Code¶
__author__ = "William Rowell"
__copyright__ = "Copyright 2020, William Rowell"
__email__ = "wrowell@pacb.com"
__license__ = "MIT"
from snakemake.shell import shell
extra = snakemake.params.get("extra", "")
log = snakemake.log_fmt_shell(stdout=False, stderr=True)
shell(
"tabix {extra} {snakemake.input[0]} {snakemake.params.region} > {snakemake.output} {log}"
)