files.new_contents: #!/usr/local/bin/env python
  
  # =============================================================================================
  # MODULE DOCSTRING
  # =============================================================================================
  
  """
  Analyze YANK output file.
  
  """
  
  # =============================================================================================
  # MODULE IMPORTS
  # =============================================================================================
  
  # Module imports handled in individual functions since CLI should be faster to boot up
  
  # =============================================================================================
  # COMMAND-LINE INTERFACE
  # =============================================================================================
  
  usage = """
  YANK analyze
  
  Usage: 
    yank analyze ((-s STORE | --store=STORE) | (-y YAML | --yaml=YAML)) [-e SERIAL | --serial=SERIAL] [--skipunbiasing] [--distcutoff=DISTANCE] [--energycutoff=ENERGY] [-v | --verbose] [--fulltraj]
    yank analyze report ((-s STORE | --store=STORE) | (-y YAML | --yaml=YAML)) (-o OUTPUT | --output=OUTPUT) [--format=FORMAT] [-e SERIAL | --serial=SERIAL] [--skipunbiasing] [--distcutoff=DISTANCE] [--energycutoff=ENERGY] [-v | --verbose] [--fulltraj]
    yank analyze extract-trajectory --netcdf=FILEPATH [--checkpoint=FILEPATH ] (--state=STATE | --replica=REPLICA) --trajectory=FILEPATH [--start=START_FRAME] [--skip=SKIP_FRAME] [--end=END_FRAME] [--nosolvent] [--discardequil] [--imagemol] [-v | --verbose]
  
  Description:
    Analyze the data to compute Free Energies OR extract the trajectory from the NetCDF file into a common format.
    yank analyze report generates a Jupyter (Ipython) notebook of the report instead of writing it to standard output
  
  Free Energy Required Arguments:
    -s STORE, --store=STORE       Storage directory for NetCDF data files. 
                                  EXCLUSIVE with -y and --yaml
    -y YAML, --yaml=YAML          Target YAML file which setup and ran the experiment(s) being analyzed. 
                                  This slightly changes the optional -o|--output flag.
                                  EXCLUSIVE
  
  [... the rest is omitted ...]
files.new_path: Yank/commands/analyze.py
files.old_contents: #!/usr/local/bin/env python
  
  # =============================================================================================
  # MODULE DOCSTRING
  # =============================================================================================
  
  """
  Analyze YANK output file.
  
  """
  
  # =============================================================================================
  # MODULE IMPORTS
  # =============================================================================================
  
  import io
  import re
  import os
  import pickle
  
  from simtk import unit
  
  import pkg_resources
  from .. import utils, analyze, mpi
  
  # =============================================================================================
  # COMMAND-LINE INTERFACE
  # =============================================================================================
  
  usage = """
  YANK analyze
  
  Usage: 
    yank analyze ((-s STORE | --store=STORE) | (-y YAML | --yaml=YAML)) [-e SERIAL | --serial=SERIAL] [--skipunbiasing] [--distcutoff=DISTANCE] [--energycutoff=ENERGY] [-v | --verbose] [--fulltraj]
    yank analyze report ((-s STORE | --store=STORE) | (-y YAML | --yaml=YAML)) (-o OUTPUT | --output=OUTPUT) [--format=FORMAT] [-e SERIAL | --serial=SERIAL] [--skipunbiasing] [--distcutoff=DISTANCE] [--energycutoff=ENERGY] [-v | --verbose] [--fulltraj]
    yank analyze extract-trajectory --netcdf=FILEPATH [--checkpoint=FILEPATH ] (--state=STATE | --replica=REPLICA) --trajectory=FILEPATH [--start=START_FRAME] [--skip=SKIP_FRAME] [--end=END_FRAME] [--nosolvent] [--discardequil] [--imagemol] [-v | --verbose]
  
  Description:
    Analyze the data to compute Free Energies OR extract the trajectory from the NetCDF file into a common format.
    yank analyze report generates a Jupyter (Ipython) notebook of the report instead of writing it to standard output
  
  Free Energy Required Arguments:
    -s STORE, --store=STORE       Storage directory for NetCDF data files. 
                                  EXCLUSIVE with -y and --yaml
    -y YAML, --yaml=YAML          Target YAML file which setup and ran the experiment(s) being analyzed.
  
  [... the rest is omitted ...]
files.old_path: Yank/commands/analyze.py
files.new_contents: #!/usr/local/bin/env python
  
  # =============================================================================================
  # MODULE DOCSTRING
  # =============================================================================================
  
  """
  Set up and run YANK calculation from script.
  
  """
  
  # =============================================================================================
  # GLOBAL IMPORTS
  # =============================================================================================
  
  # Module imports handled in individual functions since CLI should be faster to boot up
  
  # =============================================================================================
  # COMMAND-LINE INTERFACE
  # =============================================================================================
  
  usage = """
  YANK script
  
  Usage:
    yank script (-y FILEPATH | --yaml=FILEPATH) [--jobid=INTEGER] [--njobs=INTEGER] [-o OVERRIDE]...
  
  Description:
    Set up and run free energy calculations from a YAML script. All options can be specified in the YAML script.
  
  Required Arguments:
    -y, --yaml=FILEPATH           Path to the YAML script specifying options and/or how to set up and run the experiment.
  
  Optional Arguments:
    --jobid=INTEGER               You can run only a subset of the experiments by specifying jobid and njobs, where
                                  1 <= job_id <= n_jobs. In this case, njobs must be specified as well and YANK will
                                  run only 1/n_jobs of the experiments. This can be used to run several separate YANK
                                  executions in parallel starting from the same script.
                                  Alternatively, a zero-indexed environment variable name can be specified, in which
                                  case the jobid will be taken from this variable (0 <= environment variable < n_jobs).
    --njobs=INTEGER               Specify the total number of parallel executions. jobid has to be specified too.
                                  Alternatively, an environment variable name can be specified, in which
                                  case the number of jobs jobid will be taken from this variable.
    -o, --override=OVERRIDE       Override a single option in the script file. May be specified multiple times.
                                  Specified as a nested dictionary of the form:
                                  top_option:sub_option:value
                                  of any depth level where the last entry is always the value, do not use quotes.
                                  Please see script file documentation for valid options.
                                  Specifying the same option multiple times results in an error.
                                  This method is not recommended for complex options such as lists or combinations
  """
  
  # =============================================================================================
  # COMMAND DISPATCH
  # =
  
  [... the rest is omitted ...]
files.new_path: Yank/commands/script.py
files.old_contents: #!/usr/local/bin/env python
  
  # =============================================================================================
  # MODULE DOCSTRING
  # =============================================================================================
  
  """
  Set up and run YANK calculation from script.
  
  """
  
  # =============================================================================================
  # GLOBAL IMPORTS
  # =============================================================================================
  
  import os
  from ..experiment import ExperimentBuilder
  
  
  # =============================================================================================
  # COMMAND-LINE INTERFACE
  # =============================================================================================
  
  usage = """
  YANK script
  
  Usage:
    yank script (-y FILEPATH | --yaml=FILEPATH) [--jobid=INTEGER] [--njobs=INTEGER] [-o OVERRIDE]...
  
  Description:
    Set up and run free energy calculations from a YAML script. All options can be specified in the YAML script.
  
  Required Arguments:
    -y, --yaml=FILEPATH           Path to the YAML script specifying options and/or how to set up and run the experiment.
  
  Optional Arguments:
    --jobid=INTEGER               You can run only a subset of the experiments by specifying jobid and njobs, where
                                  1 <= job_id <= n_jobs. In this case, njobs must be specified as well and YANK will
                                  run only 1/n_jobs of the experiments. This can be used to run several separate YANK
                                  executions in parallel starting from the same script.
                                  Alternatively, a zero-indexed environment variable name can be specified, in which
                                  case the jobid will be taken from this variable (0 <= environment variable < n_jobs).
    --njobs=INTEGER               Specify the total number of parallel executions. jobid has to be specified too.
                                  Alternatively, an environment variable name can be specified, in which
                                  case the number of jobs jobid will be taken from this variable.
    -o, --override=OVERRIDE       Override a single option in the script file. May be specified multiple times.
                                  Specified as a nested dictionary of the form:
                                  top_option:sub_option:value
                                  of any depth level where the last entry is always the value, do not use quotes.
                                  Please see script file documentation for valid options.
                                  Specifying the same option multiple times results in an error.
                                  This method is not recommended for complex options such as lists or combinations
  """
  
  # =============================================================================================
  # COMMAND DISPATCH
  # =============================================================================================
  
  
  def
  
  [... the rest is omitted ...]
files.old_path: Yank/commands/script.py
files.new_contents: #!/usr/local/bin/env python
  
  # =============================================================================================
  # MODULE DOCSTRING
  # =============================================================================================
  
  """
  Run YANK self tests after installation.
  
  """
  
  # =============================================================================================
  # MODULE IMPORTS
  # =============================================================================================
  
  # Module imports handled in individual functions since CLI should be faster to boot up
  
  # =============================================================================================
  # COMMAND-LINE INTERFACE
  # =============================================================================================
  usage = """
  YANK selftest
  
  Usage:
    yank selftest  [-d | --doctests] [-n | --nosetests] [--verbosity=#] [(--skip (platforms | openeye))]...
  
  Description:
    Run the YANK selftests to check that functions are behaving as expected and if external licenses are available
  
  General Options:
    -d, --doctests                Run module doctests
    -n, --nosetests               Run the nosetests (slow) on YANK
    --verbosity=#                 Optional verbosity level of nosetests OR verbose doctests [default: 1]
                                  Does nothing without -n or -d
    --skip                        Skips a named selftests (platforms OR openeye) for speed
                                  May be specified multiple times, once per TEST
  
  """
  # =============================================================================================
  # COMMAND DISPATCH
  # =============================================================================================
  
  
  class LicenseError(Exception):
      """Error raised by a missing License."""
      pass
  
  
  def dispatch(args):
  
      import re
      import doctest
      import pkgutil
      import subprocess
      import simtk.openmm as mm
      from .. import version
      from . import platforms
  
      # Determine verbosity in advance
      # TODO: Figure out how to get -v back in to command and allow -vv and -vvv
      # nosetests: -v == --verbosity=2
      # Assuming that verbosity = 1 (or no -v) is no verbosity for doctests
      # verbosity = max(args['-v'] + 1, int(args['--verbosity']))
      verbosity = int(args['--verbosity'])
      # Header
      print("\n")
      print("YANK Selftest")
      print("-------------")
  
      # Yank Version
      print("Yank Version %s \n" % version
  
  [... the rest is omitted ...]
files.new_path: Yank/commands/selftest.py
files.old_contents: #!/usr/local/bin/env python
  
  # =============================================================================================
  # MODULE DOCSTRING
  # =============================================================================================
  
  """
  Run YANK self tests after installation.
  
  """
  
  # =============================================================================================
  # MODULE IMPORTS
  # =============================================================================================
  
  import doctest
  import pkgutil
  import subprocess
  import re
  
  from .. import version
  from . import platforms
  import simtk.openmm as mm
  
  
  # =============================================================================================
  # COMMAND-LINE INTERFACE
  # =============================================================================================
  usage = """
  YANK selftest
  
  Usage:
    yank selftest  [-d | --doctests] [-n | --nosetests] [--verbosity=#] [(--skip (platforms | openeye))]...
  
  Description:
    Run the YANK selftests to check that functions are behaving as expected and if external licenses are available
  
  General Options:
    -d, --doctests                Run module doctests
    -n, --nosetests               Run the nosetests (slow) on YANK
    --verbosity=#                 Optional verbosity level of nosetests OR verbose doctests [default: 1]
                                  Does nothing without -n or -d
    --skip                        Skips a named selftests (platforms OR openeye) for speed
                                  May be specified multiple times, once per TEST
  
  """
  # =============================================================================================
  # COMMAND DISPATCH
  # =============================================================================================
  
  class LicenseError(Exception):
      """Error raised by a missing License."""
      pass
  
  
  def dispatch(args):
  
      # Determine verbosity in advance
      # TODO: Figure out how to get -v back in to command and allow -vv and -vvv
      # nosetests: -v == --verbosity=2
      # Assuming that verbosity = 1 (or no -v) is no verbosity for doctests
      # verbosity = max(args['-v'] + 1, int(args['--verbosity']))
      verbosity = int(args['--verbosity'])
      # Header
      print("\n")
      print("YANK Selftest")
      print("-------------")
  
      # Yank Version
      print("Yank Version %s \n" % version.version)
  
      # OpenMM Platforms
      if not (args['platforms'] > 0):  #
  
  [... the rest is omitted ...]
files.old_path: Yank/commands/selftest.py
files.new_contents: #!/usr/local/bin/env python
  
  # =============================================================================================
  # MODULE DOCSTRING
  # =============================================================================================
  
  """
  Query output files for quick status.
  
  """
  
  # =============================================================================================
  # MODULE IMPORTS
  # =============================================================================================
  
  # Module imports handled in individual functions since CLI should be faster to boot up
  
  # =============================================================================================
  # COMMAND-LINE INTERFACE
  # =============================================================================================
  
  usage = """
  YANK status
  
  Usage:
    yank status (-y FILEPATH | --yaml=FILEPATH) [--status=STRING] [--njobs=INTEGER] [-v | --verbose]
  
  Description:
    Print the current status of the experiments.
  
  Required Arguments:
    -y, --yaml=FILEPATH           Path to the YAML script specifying options and/or how to
                                  set up and run the experiment.
  
  General Options:
    --status=STRING               Print only the jobs in a particular status. Accepted values
                                  are "completed", "ongoing", and "pending". This works only
                                  if verbose is set.
    --njobs=INTEGER               Print the job id associated to each experiment assuming
                                  njobs to be the one specified here.
    -v, --verbose                 Print status of each experiment individually. If this is
                                  not set, only a summary of the status of all experiments
                                  is printed.
  
  """
  
  
  # =============================================================================================
  # COMMAND DISPATCH
  # =============================================================================================
  
  def find_contiguous_ids(job_ids):
      """Return the contiguous job ids in the given list.
  
      Returns
      -------
      contiguous_job_ids : str
          The job ids organized in contiguous sets.
  
      """
  
      import operator
      import itertools
  
      contiguous_job_ids = []
      for k, g in itertools.groupby(enumerate(job_ids), lambda x: x[0]-x[1]):
          group = list(map(operator.itemgetter(1), g))
          if len(group) == 1:
              contiguous_job_ids.append(str(group[0]))
          else:
              contiguous_job_ids.append('{}-{}'.format(group[0], group[-1]))
      return ','.join(contiguous_job_ids)
  
  
  def dispatch(args):
  
      import collections
      from .. import experiment
  
      # Handle optional arguments.
      if args['--njobs']:
          n_jobs
  
  [... the rest is omitted ...]
files.new_path: Yank/commands/status.py
files.old_contents: #!/usr/local/bin/env python
  
  # =============================================================================================
  # MODULE DOCSTRING
  # =============================================================================================
  
  """
  Query output files for quick status.
  
  """
  
  # =============================================================================================
  # MODULE IMPORTS
  # =============================================================================================
  
  import operator
  import itertools
  import collections
  
  from .. import experiment
  
  # =============================================================================================
  # COMMAND-LINE INTERFACE
  # =============================================================================================
  
  usage = """
  YANK status
  
  Usage:
    yank status (-y FILEPATH | --yaml=FILEPATH) [--status=STRING] [--njobs=INTEGER] [-v | --verbose]
  
  Description:
    Print the current status of the experiments.
  
  Required Arguments:
    -y, --yaml=FILEPATH           Path to the YAML script specifying options and/or how to
                                  set up and run the experiment.
  
  General Options:
    --status=STRING               Print only the jobs in a particular status. Accepted values
                                  are "completed", "ongoing", and "pending". This works only
                                  if verbose is set.
    --njobs=INTEGER               Print the job id associated to each experiment assuming
                                  njobs to be the one specified here.
    -v, --verbose                 Print status of each experiment individually. If this is
                                  not set, only a summary of the status of all experiments
                                  is printed.
  
  """
  
  
  # =============================================================================================
  # COMMAND DISPATCH
  # =============================================================================================
  
  def find_contiguous_ids(job_ids):
      """Return the contiguous job ids in the given list.
  
      Returns
      -------
      contiguous_job_ids : str
          The job ids organized in contiguous sets.
  
      """
      contiguous_job_ids = []
      for k, g in itertools.groupby(enumerate(job_ids), lambda x:x[0]-x[1]):
          group = list(map(operator.itemgetter(1), g))
          if len(group) == 1:
              contiguous_job_ids.append(str(group[0]))
          else:
              contiguous_job_ids.append('{}-{}'.format(group[0], group[-1]))
      return ','.join(contiguous_job_ids)
  
  
  def dispatch(args):
      # Handle optional arguments.
      if args['--njobs']:
          n_jobs = int(args['--njobs'])
      else:
          n_jobs = None
  
      # Turn
  
  [... the rest is omitted ...]
files.old_path: Yank/commands/status.py