def construct_command(commandline_args): """Put together the command for the plugin""" # The task to be carried out command = { "command": "ANALYSIS", "process_id": uuid.uuid1().get_hex(), } # Working directory if commandline_args.test: # Don't make a new directory work_dir = commandline_utils.check_work_dir( os.path.join( os.path.abspath(os.path.curdir), "rapd_analysis_%s" % ".".join( os.path.basename(commandline_args.datafile).split(".")[:-1])), active=False, up=commandline_args.dir_up) else: work_dir = commandline_utils.check_work_dir( os.path.join( os.path.abspath(os.path.curdir), "rapd_analysis_%s" % ".".join( os.path.basename(commandline_args.datafile).split(".")[:-1])), active=True, up=commandline_args.dir_up) command["directories"] = { "work": work_dir } # Information on input command["input_data"] = { "datafile": os.path.abspath(commandline_args.datafile), "db_settings": commandline_args.db_settings, } # Plugin settings command["preferences"] = { "clean": commandline_args.clean, #"dir_up": commandline_args.dir_up, "nproc": commandline_args.nproc, #"pdbquery": commandline_args.pdbquery, "json": commandline_args.json, "show_plots": commandline_args.show_plots, "progress": commandline_args.progress, "run_mode": commandline_args.run_mode, "sample_type": commandline_args.sample_type, "test": commandline_args.test, #"computer_cluster": commandline_args.computer_cluster, } # Interprocess communication #if commandline_args.queue: # command["queue"] = commandline_args.queue # logger.debug("Command for index plugin: %s", command) return command
def construct_command(commandline_args): """Put together the command for the plugin""" # The task to be carried out command = { "command": "ANALYSIS", "process_id": uuid.uuid1().get_hex(), } # Working directory if commandline_args.test: # Don't make a new directory work_dir = commandline_utils.check_work_dir(os.path.join( os.path.abspath(os.path.curdir), "rapd_analysis_%s" % ".".join( os.path.basename(commandline_args.data_file).split(".")[:-1])), active=False, up=commandline_args.dir_up) else: work_dir = commandline_utils.check_work_dir(os.path.join( os.path.abspath(os.path.curdir), "rapd_analysis_%s" % ".".join( os.path.basename(commandline_args.data_file).split(".")[:-1])), active=True, up=commandline_args.dir_up) command["directories"] = {"work": work_dir} # Information on input command["input_data"] = { "data_file": os.path.abspath(commandline_args.data_file), "db_settings": commandline_args.db_settings, } # Plugin settings command["preferences"] = { "clean": commandline_args.clean, #"dir_up": commandline_args.dir_up, "nproc": commandline_args.nproc, #"pdbquery": commandline_args.pdbquery, "json": commandline_args.json, "show_plots": commandline_args.show_plots, "progress": commandline_args.progress, "run_mode": commandline_args.run_mode, "sample_type": commandline_args.sample_type, "test": commandline_args.test, #"computer_cluster": commandline_args.computer_cluster, } # Interprocess communication #if commandline_args.queue: # command["queue"] = commandline_args.queue # logger.debug("Command for index plugin: %s", command) return command
def construct_command(image_0_data, run_data, commandline_args, detector_module): """ Put together the command for the plugin """ # The task to be carried out command = { "command": "XDS", #"INTEGRATE", "process": {"process_id": uuid.uuid1().get_hex()} } work_dir = commandline_utils.check_work_dir( os.path.join( os.path.abspath(os.path.curdir), "rapd_integrate_" + run_data["repr"]), active=True, up=commandline_args.dir_up) # Where to do the work command["directories"] = { "work": work_dir } # Data data command["data"] = { "image_data": image_0_data, "run_data": run_data } command["preferences"] = { "analysis": commandline_args.analysis, "pdbquery": commandline_args.pdbquery, "clean_up": commandline_args.clean_up, "computer_cluster": commandline_args.computer_cluster, "dir_up": commandline_args.dir_up, "exchange_dir": commandline_args.exchange_dir, "start_frame": commandline_args.start_image, "end_frame": commandline_args.end_image, "flip_beam": detector_module.XDS_FLIP_BEAM, "x_beam": commandline_args.beamcenter[0], "y_beam": commandline_args.beamcenter[1], "spacegroup": commandline_args.spacegroup, "low_res": commandline_args.lowres, "hi_res": commandline_args.hires, "json": commandline_args.json, "nproc": commandline_args.nproc, "progress": commandline_args.progress, "run_mode": commandline_args.run_mode, "show_plots": commandline_args.show_plots, "xdsinp": detector_module.XDSINP, "spacegroup_decider": commandline_args.spacegroup_decider, "rounds_polishing": commandline_args.rounds_polishing } if commandline_args.beamcenter[0]: command["preferences"]["beam_center_override"] = True return command
def construct_command(commandline_args): """ Put together the command for the plugin commandline_args needs to look like: class commandline_args(object): clean = True | False data_file = "" struct_file = "" json = True | False no_color = True | False nproc = int progress = True | False run_mode = "interactive" | "json" | "server" | "subprocess" test = True | False verbose = True | False """ # The task to be carried out command = { "command": "MR", "process_id": uuid.uuid1().get_hex(), "status": 0, } # Work directory work_dir = commandline_utils.check_work_dir(os.path.join( os.path.abspath(os.path.curdir), "rapd_mr_%s" % ".".join( os.path.basename(commandline_args.data_file).split(".")[:-1])), active=True, up=commandline_args.dir_up) command["directories"] = { "work": work_dir, "exchange_dir": commandline_args.exchange_dir } # Information on input command["input_data"] = { "data_file": os.path.abspath(commandline_args.data_file), "struct_file": os.path.abspath(commandline_args.struct_file), #"db_settings": commandline_args.db_settings } # Plugin settings command["preferences"] = { "clean": commandline_args.clean, "json": commandline_args.json, "nproc": commandline_args.nproc, "progress": commandline_args.progress, "run_mode": commandline_args.run_mode, "test": commandline_args.test, "adf": commandline_args.adf, } return command
def construct_command(commandline_args, logger): """ Put together the command for the plugin commandline_args needs to look like: class commandline_args(object): clean = True | False datafile = "" json = True | False no_color = True | False nproc = int progress = True | False run_mode = "interactive" | "json" | "server" | "subprocess" test = True | False verbose = True | False """ # The task to be carried out command = { "command": "HCMERGE", "process_id": uuid.uuid1().get_hex(), "status": 0, } work_dir = commandline_utils.check_work_dir( os.path.join( os.path.abspath(os.path.curdir), "hcmerge"), active=True, up=commandline_args.dir_up) # Work directory command["directories"] = { "work": work_dir } # Information on input command["input_data"] = { "datasets": commandline_args.datasets } # Plugin settings command["preferences"] = { "json": commandline_args.json, "nproc": commandline_args.nproc, "run_mode": commandline_args.run_mode, "test": commandline_args.test, } for setting in commandline_args._get_kwargs(): command['preferences'][setting[0]] = setting[1] logger.debug("Command for hcmerge plugin: %s", command) return command
def construct_command(commandline_args): """Put together the command for the plugin""" # The task to be carried out command = { "command": "ECHO", "process_id": uuid.uuid1().get_hex(), "status": 0, } # Work directory work_dir = commandline_utils.check_work_dir( os.path.join(os.path.abspath(os.path.curdir), run_repr), active=True, up=commandline_args.dir_up) command["directories"] = { "work": work_dir } # Check the work directory commandline_utils.check_work_dir(command["directories"]["work"], True) # Information on input command["input_data"] = { "datafile": os.path.abspath(commandline_args.datafile) } # Plugin settings command["preferences"] = { "clean": commandline_args.clean, "json": commandline_args.json, "no_color": commandline_args.no_color, "nproc": commandline_args.nproc, "progress": commandline_args.progress, "test": commandline_args.test, "verbose": commandline_args.verbose, } return command
def construct_command(commandline_args): """Put together the command for the plugin""" # The task to be carried out command = { "command": "ECHO", "process_id": uuid.uuid1().get_hex(), "status": 0, } # Work directory work_dir = commandline_utils.check_work_dir(os.path.join( os.path.abspath(os.path.curdir), run_repr), active=True, up=commandline_args.dir_up) command["directories"] = {"work": work_dir} # Check the work directory commandline_utils.check_work_dir(command["directories"]["work"], True) # Information on input command["input_data"] = { "datafile": os.path.abspath(commandline_args.datafile) } # Plugin settings command["preferences"] = { "clean": commandline_args.clean, "json": commandline_args.json, "no_color": commandline_args.no_color, "nproc": commandline_args.nproc, "progress": commandline_args.progress, "test": commandline_args.test, "verbose": commandline_args.verbose, } return command
def construct_command(commandline_args, logger): """ Put together the command for the plugin commandline_args needs to look like: class commandline_args(object): clean = True | False datafile = "" json = True | False no_color = True | False nproc = int progress = True | False run_mode = "interactive" | "json" | "server" | "subprocess" test = True | False verbose = True | False """ # The task to be carried out command = { "command": "HCMERGE", "process_id": uuid.uuid1().get_hex(), "status": 0, } work_dir = commandline_utils.check_work_dir(os.path.join( os.path.abspath(os.path.curdir), "hcmerge"), active=True, up=commandline_args.dir_up) # Work directory command["directories"] = {"work": work_dir} # Information on input command["input_data"] = {"datasets": commandline_args.datasets} # Plugin settings command["preferences"] = { "json": commandline_args.json, "nproc": commandline_args.nproc, "run_mode": commandline_args.run_mode, "test": commandline_args.test, } for setting in commandline_args._get_kwargs(): command['preferences'][setting[0]] = setting[1] logger.debug("Command for hcmerge plugin: %s", command) return command
def construct_command(commandline_args): """ Put together the command for the plugin commandline_args needs to look like: class commandline_args(object): clean = True | False contaminants = True | False datafile = "" json = True | False no_color = True | False nproc = int pdbs = False | ["pdbid", ...] progress = True | False run_mode = "interactive" | "json" | "server" | "subprocess" search = True | False test = True | False verbose = True | False """ # The task to be carried out command = { "command": "PDBQUERY", "process_id": uuid.uuid1().get_hex(), "status": 0, } # Work directory """ if commandline_args.test: # Don't make a new directory work_dir = commandline_utils.check_work_dir( os.path.join( os.path.abspath(os.path.curdir), "rapd_pdbquery_%s" % ".".join( os.path.basename(commandline_args.datafile).split(".")[:-1])), active=False, up=commandline_args.dir_up) else: work_dir = commandline_utils.check_work_dir( os.path.join( os.path.abspath(os.path.curdir), "rapd_pdbquery_%s" % ".".join( os.path.basename(commandline_args.datafile).split(".")[:-1])), active=True, up=commandline_args.dir_up) """ work_dir = commandline_utils.check_work_dir( os.path.join( os.path.abspath(os.path.curdir), "rapd_pdbquery_%s" % ".".join( os.path.basename(commandline_args.datafile).split(".")[:-1])), active=True, up=commandline_args.dir_up) command["directories"] = { "work": work_dir, "exchange_dir": commandline_args.exchange_dir } # Information on input command["input_data"] = { "datafile": os.path.abspath(commandline_args.datafile), "pdbs": commandline_args.pdbs, "db_settings": commandline_args.db_settings } # Plugin settings command["preferences"] = { "clean": commandline_args.clean, "json": commandline_args.json, "contaminants": commandline_args.contaminants, "nproc": commandline_args.nproc, "progress": commandline_args.progress, "run_mode": commandline_args.run_mode, "search": commandline_args.search, "test": commandline_args.test, #"computer_cluster": commandline_args.computer_cluster, #"results_queue": commandline_args.results_queue, } return command
def construct_command(image_headers, commandline_args, detector_module): """ Put together the command for the plugin """ # The task to be carried out command = { "command": "INDEX", "process": { "process_id": uuid.uuid1().get_hex(), "parent_id": None, "source": "commandline", "status": 0 } } # Working directory image_numbers = [] image_template = "" h5 = "" for _, header in image_headers.iteritems(): image_numbers.append(str(header["image_number"])) image_template = header["image_template"] if "hdf5_source" in header: if h5: h5 += "_" h5 += os.path.basename(header["hdf5_source"]).replace("_master.h5", "") image_numbers.sort() if h5: run_repr = "rapd_index_" + h5 else: run_repr = "rapd_index_" + image_template.replace(detector_module.DETECTOR_SUFFIX, "").\ replace("?", "") run_repr += "+".join(image_numbers) work_dir = commandline_utils.check_work_dir( os.path.join(os.path.abspath(os.path.curdir), run_repr), active=True, up=commandline_args.dir_up) command["directories"] = { "work": work_dir } # Image data images = image_headers.keys() images.sort() counter = 0 for image in images: counter += 1 command["image%d" % counter] = image_headers[image] if counter == 1: command["image2"] = None # Plugin settings command["preferences"] = {} # JSON output? command["preferences"]["json"] = commandline_args.json command["preferences"]["json_fd"] = commandline_args.json_fd command["preferences"]["progress"] = commandline_args.progress command["preferences"]["no_color"] = commandline_args.no_color # Show plots command["preferences"]["show_plots"] = commandline_args.show_plots # Strategy type command["preferences"]["strategy_type"] = commandline_args.strategy_type # Best command["preferences"]["best_complexity"] = commandline_args.best_complexity command["preferences"]["shape"] = 2.0 command["preferences"]["susceptibility"] = 1.0 command["preferences"]["aimed_res"] = 0.0 # Best & Labelit command["preferences"]["sample_type"] = commandline_args.sample_type command["preferences"]["spacegroup"] = commandline_args.spacegroup command["preferences"]["unitcell"] = commandline_args.unitcell # Labelit command["preferences"]["index_hi_res"] = try_float(commandline_args.hires, 0.0) command["preferences"]["x_beam"] = commandline_args.beamcenter[0] command["preferences"]["y_beam"] = commandline_args.beamcenter[1] command["preferences"]["beam_search"] = commandline_args.beam_search # Mosflm command["preferences"]["mosflm_rot"] = float(commandline_args.mosflm_range) command["preferences"]["mosflm_seg"] = int(commandline_args.mosflm_segments) command["preferences"]["mosflm_start"] = float(commandline_args.mosflm_start) command["preferences"]["mosflm_end"] = float(commandline_args.mosflm_end) command["preferences"]["reference_data"] = None command["preferences"]["reference_data_id"] = None # Change these if user wants to continue dataset with other crystal(s). # "reference_data_id": None, #MOSFLM # #"reference_data_id": 1,#MOSFLM # #"reference_data": [['/gpfs6/users/necat/Jon/RAPD_test/index09.mat', 0.0, 30.0, 'junk_1_1-30', # 'P41212']],#MOSFLM # 'reference_data': [['/gpfs6/users/necat/Jon/RAPD_test/Output/junk/5/index12.mat', # 0.0, # 20.0, # 'junk', # 'P3'], # ['/gpfs6/users/necat/Jon/RAPD_test/Output/junk/5/index12.mat', # 40.0, # 50.0, # 'junk2', # 'P3'] # ],#MOSFLM # Raddose command["preferences"]["crystal_size_x"] = 100.0 command["preferences"]["crystal_size_y"] = 100.0 command["preferences"]["crystal_size_z"] = 100.0 command["preferences"]["solvent_content"] = commandline_args.solvent #command["preferences"][] # Unknown command["preferences"]["beam_flip"] = False #command["preferences"]["multiprocessing"] = False # Launches jobs at same time using more cores. Much Faster!! #command["preferences"]["multiprocessing"] = True command["preferences"]["nproc"] = commandline_args.nproc # The run mode for rapd command["preferences"]["run_mode"] = commandline_args.run_mode # Site parameters command["preferences"]["site_parameters"] = {} command["preferences"]["site_parameters"]["DETECTOR_DISTANCE_MAX"] = \ commandline_args.site_det_dist_max command["preferences"]["site_parameters"]["DETECTOR_DISTANCE_MIN"] = \ commandline_args.site_det_dist_min command["preferences"]["site_parameters"]["DIFFRACTOMETER_OSC_MIN"] = \ commandline_args.site_osc_min command["preferences"]["site_parameters"]["DETECTOR_TIME_MIN"] = \ commandline_args.site_det_time_min return command
def construct_command(image_headers, commandline_args, detector_module): """ Put together the command for the plugin """ # The task to be carried out command = { "command": "INDEX", "process": { "process_id": uuid.uuid1().get_hex(), "parent_id": None, "source": "commandline", "status": 0 } } # Working directory image_numbers = [] image_template = "" h5 = "" for _, header in image_headers.iteritems(): image_numbers.append(str(header["image_number"])) image_template = header["image_template"] if "hdf5_source" in header: if h5: h5 += "_" h5 += os.path.basename(header["hdf5_source"]).replace("_master.h5", "") image_numbers.sort() if h5: run_repr = "rapd_index_" + h5 else: run_repr = "rapd_index_" + image_template.replace(detector_module.DETECTOR_SUFFIX, "").\ replace("?", "") run_repr += "+".join(image_numbers) work_dir = commandline_utils.check_work_dir( os.path.join(os.path.abspath(os.path.curdir), run_repr), active=True, up=commandline_args.dir_up) command["directories"] = { "work": work_dir } # Image data images = image_headers.keys() images.sort() counter = 0 for image in images: counter += 1 command["image%d" % counter] = image_headers[image] if counter == 1: command["image2"] = None # Plugin settings command["preferences"] = {} # JSON output? command["preferences"]["json"] = commandline_args.json command["preferences"]["json_fd"] = commandline_args.json_fd command["preferences"]["progress"] = commandline_args.progress command["preferences"]["no_color"] = commandline_args.no_color # Show plots command["preferences"]["show_plots"] = commandline_args.show_plots # Strategy type command["preferences"]["strategy_type"] = commandline_args.strategy_type # Best command["preferences"]["best_complexity"] = commandline_args.best_complexity command["preferences"]["shape"] = 2.0 command["preferences"]["susceptibility"] = 1.0 command["preferences"]["aimed_res"] = 0.0 command["preferences"]["aimed_redundancy"] = commandline_args.best_aimed_redundancy # Best & Labelit command["preferences"]["sample_type"] = commandline_args.sample_type command["preferences"]["spacegroup"] = commandline_args.spacegroup command["preferences"]["unitcell"] = commandline_args.unitcell # Labelit command["preferences"]["index_hi_res"] = try_float(commandline_args.hires, 0.0) command["preferences"]["x_beam"] = commandline_args.beamcenter[0] command["preferences"]["y_beam"] = commandline_args.beamcenter[1] command["preferences"]["beam_search"] = commandline_args.beam_search # Mosflm command["preferences"]["mosflm_rot"] = float(commandline_args.mosflm_range) command["preferences"]["mosflm_seg"] = int(commandline_args.mosflm_segments) command["preferences"]["mosflm_start"] = float(commandline_args.mosflm_start) command["preferences"]["mosflm_end"] = float(commandline_args.mosflm_end) command["preferences"]["reference_data"] = None command["preferences"]["reference_data_id"] = None # Change these if user wants to continue dataset with other crystal(s). # "reference_data_id": None, #MOSFLM # #"reference_data_id": 1,#MOSFLM # #"reference_data": [['/gpfs6/users/necat/Jon/RAPD_test/index09.mat', 0.0, 30.0, 'junk_1_1-30', # 'P41212']],#MOSFLM # 'reference_data': [['/gpfs6/users/necat/Jon/RAPD_test/Output/junk/5/index12.mat', # 0.0, # 20.0, # 'junk', # 'P3'], # ['/gpfs6/users/necat/Jon/RAPD_test/Output/junk/5/index12.mat', # 40.0, # 50.0, # 'junk2', # 'P3'] # ],#MOSFLM # Raddose command["preferences"]["crystal_size_x"] = 100.0 command["preferences"]["crystal_size_y"] = 100.0 command["preferences"]["crystal_size_z"] = 100.0 command["preferences"]["solvent_content"] = commandline_args.solvent #command["preferences"][] # Unknown command["preferences"]["beam_flip"] = False #command["preferences"]["multiprocessing"] = False # Launches jobs at same time using more cores. Much Faster!! #command["preferences"]["multiprocessing"] = True command["preferences"]["nproc"] = commandline_args.nproc # The run mode for rapd command["preferences"]["run_mode"] = commandline_args.run_mode # Site parameters command["preferences"]["site_parameters"] = {} command["preferences"]["site_parameters"]["DETECTOR_DISTANCE_MAX"] = \ commandline_args.site_det_dist_max command["preferences"]["site_parameters"]["DETECTOR_DISTANCE_MIN"] = \ commandline_args.site_det_dist_min command["preferences"]["site_parameters"]["DIFFRACTOMETER_OSC_MIN"] = \ commandline_args.site_osc_min command["preferences"]["site_parameters"]["DETECTOR_TIME_MIN"] = \ commandline_args.site_det_time_min return command