예제 #1
0
def special_mtz_mode(args):
    print('Usage: %s' % USAGE_SHORT)
    check_ccp4_envvars()
    wf = workflow.Workflow('')
    wf.enable_logs = False
    try:
        mtz_meta = wf.read_mtz_metadata(args[0])
        print('Basic MTZ file info:')
        print(mtz_meta.info())
        contam_info = contaminants.get_info(mtz_meta)
        if contam_info:
            print(contam_info)
    except (IOError, RuntimeError) as e:
        put_error(e)
예제 #2
0
def special_pdb_mode(args):
    print('Proper usage: %s' % USAGE_SHORT)
    check_ccp4_envvars()
    print('...actually we can run rwcontents for you')
    wf = workflow.Workflow('')
    wf.enable_logs = False
    for p in args:
        try:
            wf.read_pdb_metadata(p, print_errors=True)
            _comment_summary_line(os.path.basename(p), wf.file_info[p])
            wf.rwcontents(xyzin=p).run()
        except (IOError, RuntimeError) as e:
            put_error(e)
        except workflow.JobError as e:
            put_error(e.msg, comment=e.note)
    print('\n\n...but this is NOT how dimple is supposed to be run.')
예제 #3
0
def main(args):
    if workflow.parse_workflow_commands():
        return

    options = parse_dimple_commands(args)
    check_ccp4_envvars()
    try:
        wf = workflow.Workflow(options.output_dir, from_job=options.from_step)
        utils.start_log(os.path.join(options.output_dir, 'dimple.log'),
                        output_dir=options.output_dir)
        utils.log_value('version', __version__)
        utils.start_log_screen(os.path.join(options.output_dir, 'screen.log'))

        dimple(wf=wf, opt=options)
        check_contaminants_if_bad(wf, mtz=options.mtz)
        exit_status = 0
    except workflow.JobError as e:
        put_error(e.msg, comment=e.note)
        try:
            utils.report_disk_space([wf.output_dir, os.getenv('CCP4_SCR')])
        except KeyboardInterrupt:
            comment('\nok, exiting...')
        exit_status = 1
    except (RuntimeError, IOError, OSError) as e:
        put_error(e)
        exit_status = 1
    finally:
        comment('\n')
    if options.cleanup:
        wf.delete_files(wf.temporary_files)
    wf.options = options
    try:
        wf.dump_pickle()
    except IOError as e:
        put_error(e)
        exit_status = 1
    return exit_status