<reponame>dnanexus/dnanexus-example-applets<gh_stars>10-100
#!/usr/bin/env python
#
# Copyright (C) 2013 DNAnexus, Inc.
#   This file is part of dnanexus-example-applets.
#   You may use this file under the terms of the Apache License, Version 2.0;
#   see the License.md file for more information.


# gatk_variant_recalibration_pipeline 0.0.1
# Generated by dx-app-wizard.
#
# Basic execution pattern: Your app will run on a single machine from
# beginning to end.
#
# See http://wiki.dnanexus.com/Developer-Tutorials/Intro-to-Building-Apps
# for instructions on how to modify this file.
#
# DNAnexus Python Bindings (dxpy) documentation:
#   http://autodoc.dnanexus.com/bindings/python/current/

import os
import dxpy

import subprocess

@dxpy.entry_point('main')
def main(vcf_files, reference, known_resources, training_resources, truth_resources, priors, variant_recalibrator_params="-mode SNP", annotations="-an QD -an HaplotypeScore -an MQRankSum -an ReadPosRankSum -an FS -an MQ -an DP --maxGaussians 4 --percentBadVariants 0.05", filter_level=95.0, apply_recalibration_params="-mode SNP"):

    variant_recalibrator_job = applet("gatk_variant_recalibrator").run({"vcf_files":vcf_files, "reference":reference, "known_resources":known_resources, "training_resources":training_resources, "truth_resources":truth_resources, "priors": priors, "params": variant_recalibrator_params, "annotations":annotations})

    apply_recalibration_job = applet("gatk_apply_variant_recalibration").run({"vcf_files": vcf_files, "reference": reference, "filter_level": filter_level, "params": apply_recalibration_params, "tranches_file":{"job":variant_recalibrator_job.get_id(), "field":"tranches_file"}, "recalibration_file":{"job":variant_recalibrator_job.get_id(), "field": "recalibration_file"}})

    output = {}
    output["tranches_file"] = {"job": variant_recalibrator_job.get_id(), "field": "tranches_file"}
    output["recalibration_file"] = {"job": variant_recalibrator_job.get_id(), "field": "recalibration_file"}
    output["r_plot"] = {"job": variant_recalibrator_job.get_id(), "field": "r_plot"}
    output["recalibrated_variants"] = {"job": apply_recalibration_job.get_id(), "field": "recalibrated_variants"}

    return output

def applet(name):
    return find_in_project(name=name, classname="applet", return_handler=True)

def find_in_project(**kwargs):
    kwargs["project"] = os.environ["DX_PROJECT_CONTEXT_ID"]
    return dxpy.find_one_data_object(**kwargs)



dxpy.run()

#!/usr/bin/env python
#
# Copyright (C) 2013 DNAnexus, Inc.
#   This file is part of dnanexus-example-applets.
#   You may use this file under the terms of the Apache License, Version 2.0;
#   see the License.md file for more information.


# gatk_variant_recalibration_pipeline 0.0.1
# Generated by dx-app-wizard.
#
# Basic execution pattern: Your app will run on a single machine from
# beginning to end.
#
# See http://wiki.dnanexus.com/Developer-Tutorials/Intro-to-Building-Apps
# for instructions on how to modify this file.
#
# DNAnexus Python Bindings (dxpy) documentation:
#   http://autodoc.dnanexus.com/bindings/python/current/

import os
import dxpy

import subprocess

@dxpy.entry_point('main')
def main(vcf_files, reference, known_resources, training_resources, truth_resources, priors, variant_recalibrator_params="-mode SNP", annotations="-an QD -an HaplotypeScore -an MQRankSum -an ReadPosRankSum -an FS -an MQ -an DP --maxGaussians 4 --percentBadVariants 0.05", filter_level=95.0, apply_recalibration_params="-mode SNP"):

    variant_recalibrator_job = applet("gatk_variant_recalibrator").run({"vcf_files":vcf_files, "reference":reference, "known_resources":known_resources, "training_resources":training_resources, "truth_resources":truth_resources, "priors": priors, "params": variant_recalibrator_params, "annotations":annotations})

    apply_recalibration_job = applet("gatk_apply_variant_recalibration").run({"vcf_files": vcf_files, "reference": reference, "filter_level": filter_level, "params": apply_recalibration_params, "tranches_file":{"job":variant_recalibrator_job.get_id(), "field":"tranches_file"}, "recalibration_file":{"job":variant_recalibrator_job.get_id(), "field": "recalibration_file"}})

    output = {}
    output["tranches_file"] = {"job": variant_recalibrator_job.get_id(), "field": "tranches_file"}
    output["recalibration_file"] = {"job": variant_recalibrator_job.get_id(), "field": "recalibration_file"}
    output["r_plot"] = {"job": variant_recalibrator_job.get_id(), "field": "r_plot"}
    output["recalibrated_variants"] = {"job": apply_recalibration_job.get_id(), "field": "recalibrated_variants"}

    return output

def applet(name):
    return find_in_project(name=name, classname="applet", return_handler=True)

def find_in_project(**kwargs):
    kwargs["project"] = os.environ["DX_PROJECT_CONTEXT_ID"]
    return dxpy.find_one_data_object(**kwargs)



dxpy.run()
#!/usr/bin/env python # # Copyright (C) 2013 DNAnexus, Inc. #   This file is part of dnanexus-example-applets. #   You may use this file under the terms of the Apache License, Version 2.0; #   see the License.md file for more information. # gatk_variant_recalibration_pipeline 0.0.1 # Generated by dx-app-wizard. # # Basic execution pattern: Your app will run on a single machine from # beginning to end. # # See http://wiki.dnanexus.com/Developer-Tutorials/Intro-to-Building-Apps # for instructions on how to modify this file. # # DNAnexus Python Bindings (dxpy) documentation: #   http://autodoc.dnanexus.com/bindings/python/current/