Skip to content

Commit

Permalink
Add --version to run_deepvariant. (#332)
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 326249008
  • Loading branch information
pichuan authored and copybara-github committed Aug 12, 2020
1 parent 698f96a commit f101492
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions scripts/run_deepvariant.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,12 @@
using the binaries in the Docker image.
For more details, see:
https://github.com/google/deepvariant/blob/r0.10/docs/deepvariant-quick-start.md
https://github.com/google/deepvariant/blob/r1.0/docs/deepvariant-quick-start.md
"""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import os
import subprocess
import sys
import tempfile

from absl import app
Expand Down Expand Up @@ -74,6 +71,11 @@
'Optional. If specified, this should be an existing '
'directory that is visible insider docker, and will be '
'used to to store intermediate outputs.')
flags.DEFINE_boolean(
'version',
None,
'Optional. If true, print out version number and exit.',
allow_hide_cpp=True)
# Optional flags for call_variants.
flags.DEFINE_string(
'customized_model', None,
Expand Down Expand Up @@ -120,6 +122,10 @@
'HYBRID_PACBIO_ILLUMINA': '/opt/models/hybrid_pacbio_illumina/model.ckpt',
}

# Current release version of DeepVariant.
# Should be the same in dv_vcf_constants.py.
DEEP_VARIANT_VERSION = '1.0.0'


def _is_quoted(value):
if value.startswith('"') and value.endswith('"'):
Expand Down Expand Up @@ -328,6 +334,16 @@ def create_all_commands(intermediate_results_dir):


def main(_):
if FLAGS.version:
print('DeepVariant version {}'.format(DEEP_VARIANT_VERSION))
return

for flag_key in ['model_type', 'ref', 'reads', 'output_vcf']:
if FLAGS.get_flag_value(flag_key, None) is None:
sys.stderr.write('--{} is required.\n'.format(flag_key))
sys.stderr.write('Pass --helpshort or --helpfull to see help on flags.\n')
sys.exit(1)

intermediate_results_dir = check_or_create_intermediate_results_dir(
FLAGS.intermediate_results_dir)
check_flags()
Expand All @@ -345,10 +361,4 @@ def main(_):


if __name__ == '__main__':
flags.mark_flags_as_required([
'model_type',
'ref',
'reads',
'output_vcf',
])
app.run(main)

0 comments on commit f101492

Please sign in to comment.