Commit 4ef71d0e authored by Sander Bollen's avatar Sander Bollen

add cli for evaluation

parent 103371d5
Pipeline #2128 failed with stage
...@@ -39,7 +39,8 @@ setup( ...@@ -39,7 +39,8 @@ setup(
"console_scripts": [ "console_scripts": [
"vtools-filter = vtools.cli:filter_cli", "vtools-filter = vtools.cli:filter_cli",
"vtools-stats = vtools.cli:stats_cli", "vtools-stats = vtools.cli:stats_cli",
"vtools-gcoverage = vtools.cli:gcoverage_cli" "vtools-gcoverage = vtools.cli:gcoverage_cli",
"vtools-evaluate = vtools.cli:evaluate_cli"
] ]
}, },
classifiers=[ classifiers=[
......
...@@ -6,12 +6,36 @@ vtools.cli ...@@ -6,12 +6,36 @@ vtools.cli
:copyright: (c) Leiden University Medical Center :copyright: (c) Leiden University Medical Center
:license: MIT :license: MIT
""" """
import json
import click import click
from cyvcf2 import VCF, Writer
from .evaluate import site_concordancy
from .filter import FilterParams, FilterClass, Filterer
from .stats import Stats
from .gcoverage import RefRecord, region_coverages
from .filter import *
from .stats import * @click.command()
from .gcoverage import * @click.option("-c", "--call-vcf", type=click.Path(exists=True),
help="Path to VCF with calls to be evaluated",
required=True)
@click.option("-p", "--positive-vcf", type=click.Path(exists=True),
help="Path to VCF with known calls",
required=True)
@click.option("-cs", "--call-samples", type=click.STRING, multiple=True,
help="Sample(s) in call-vcf to consider. "
"May be called multiple times",
required=True)
@click.option("-ps", "--positive-samples", type=click.STRING, multiple=True,
help="Sample(s) in positive-vcf to consider. "
"May be called multiple times",
required=True)
def evaluate_cli(call_vcf, positive_vcf, call_samples, positive_samples):
c_vcf = VCF(call_vcf, gts012=True)
p_vcf = VCF(positive_vcf, gts012=True)
evaluated = site_concordancy(c_vcf, p_vcf, call_samples, positive_samples)
print(json.dumps(evaluated))
@click.command() @click.command()
...@@ -80,7 +104,7 @@ def stats_cli(input): ...@@ -80,7 +104,7 @@ def stats_cli(input):
default=True, default=True,
help="Collect metrics per exon or per transcript") help="Collect metrics per exon or per transcript")
def gcoverage_cli(input_gvcf, refflat_file, per_exon): def gcoverage_cli(input_gvcf, refflat_file, per_exon):
reader = cyvcf2.VCF(input_gvcf) reader = VCF(input_gvcf)
header = None header = None
with open(refflat_file) as handle: with open(refflat_file) as handle:
for line in handle: for line in handle:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment