Source code for schrodinger.application.bioluminate.patch_utils.pre_analyze
"""
Run pre-analysis on the specified structure.  Invoked as:
    pre_analyze.py <basename>
The structure will be read from <basename>.maegz and the ASL to use for the
surface will be read from <basename>.txt.  Output will be written to
<basename>.vis and <basename>.pkl.
"""
import sys
from schrodinger.application.bioluminate.patch_utils.patch_finder import \
    PreAnalyzer
from schrodinger.application.matsci import jobutils
from schrodinger.utils import cmdline
from schrodinger.utils import license
PROGRAM_NAME = 'Protein Patch Analysis'
DEFAULT_JOBNAME = 'patch_finder'
[docs]def get_job_spec_from_args(argv):
    """
    Return a JobSpecification necessary to run this script via launchapi.
    If this function is present in a script, it allows the script to run under
    job control via the -HOST flag on either localhost or remote host. The
    script will run locally without jobcontrol if -HOST is not used.
    :type argv: list
    :param argv: The list of command line arguments including the script name
        at [0], similar to that returned by sys.argv
    :rtype: schrodinger.job.launchapi.JobSpecification
    :return: The JobSpecification for this job
    """
    jobname = argv[1]
    job_builder = jobutils.prepare_job_spec_builder(argv, PROGRAM_NAME,
                                                    DEFAULT_JOBNAME)
    job_builder.setInputFile(jobname + '.maegz')
    job_builder.setInputFile(jobname + '.txt')
    job_builder.setOutputFile(jobname + '.vis')
    job_builder.setOutputFile(jobname + '.pkl')
    return job_builder.getJobSpec() 
[docs]def pre_analyze():
    basename = sys.argv[1]
    with license.License(license.BIOLUMINATE_MAIN) as biolicense:
        # Tampering with licensing is a violation of the license agreement
        if biolicense.isValid():
            pre_analyzer = PreAnalyzer.readAndRun(basename)
            pre_analyzer.write(basename)
        else:
            print("No BIOLUMINATE_MAIN license token is available. You will "
                  "not be able to run the calculation.")
            sys.exit(1) 
if __name__ == "__main__":
    cmdline.main_wrapper(pre_analyze)