def test_get_valid_model_filepaths(): targetid = 'EGFR_HUMAN_D0' templateids = ['KC1D_HUMAN_D0_4KB8_D', 'KC1D_HUMAN_D0_4HNF_A'] with integrationtest_context('refined_implicit'): valid_model_filenames = get_valid_model_ids('refine_implicit_md', targetid) assert all([fpath in templateids for fpath in valid_model_filenames])
def molprobity_validation(targetid, ensembler_stage=None, loglevel=None): set_loglevel(loglevel) valid_model_ids = [] if mpistate.rank == 0: if ensembler_stage is None: ensembler_stage = get_most_advanced_ensembler_modeling_stage( targetid) valid_model_ids = get_valid_model_ids(ensembler_stage, targetid) if ensembler_stage is None: ensembler_stage = mpistate.comm.bcast(ensembler_stage, root=0) valid_model_ids = mpistate.comm.bcast(valid_model_ids, root=0) nvalid_model_ids = len(valid_model_ids) model_structure_filename = model_filenames_by_ensembler_stage[ ensembler_stage] models_target_dir = os.path.join(default_project_dirnames.models, targetid) molprobity_results_filepath = os.path.join( models_target_dir, 'validation_scores_sorted-molprobity-{}'.format(ensembler_stage)) molprobity_scores_sublist = [] for model_index in range(mpistate.rank, nvalid_model_ids, mpistate.size): model_id = valid_model_ids[model_index] logger.debug('MPI process {} working on model {}'.format( mpistate.rank, model_id)) molprobity_score = run_molprobity_oneline_analysis_and_write_results( targetid, model_id, ensembler_stage, model_structure_filename=model_structure_filename, models_target_dir=models_target_dir, ) molprobity_scores_sublist.append((model_id, molprobity_score)) molprobity_scores_gathered_list = mpistate.comm.gather( molprobity_scores_sublist, root=0) if mpistate.rank == 0: molprobity_scores_list_of_tuples = [ item for sublist in molprobity_scores_gathered_list for item in sublist ] molprobity_scores_sorted = sorted(molprobity_scores_list_of_tuples, key=lambda x: x[1]) write_molprobity_scores_list(molprobity_scores_sorted, molprobity_results_filepath)
def molprobity_validation(targetid, ensembler_stage=None, loglevel=None): set_loglevel(loglevel) valid_model_ids = [] if mpistate.rank == 0: if ensembler_stage is None: ensembler_stage = get_most_advanced_ensembler_modeling_stage(targetid) valid_model_ids = get_valid_model_ids(ensembler_stage, targetid) if ensembler_stage is None: ensembler_stage = mpistate.comm.bcast(ensembler_stage, root=0) valid_model_ids = mpistate.comm.bcast(valid_model_ids, root=0) nvalid_model_ids = len(valid_model_ids) model_structure_filename = model_filenames_by_ensembler_stage[ensembler_stage] models_target_dir = os.path.join(default_project_dirnames.models, targetid) molprobity_results_filepath = os.path.join( models_target_dir, "validation_scores_sorted-molprobity-{}".format(ensembler_stage) ) molprobity_scores_sublist = [] for model_index in range(mpistate.rank, nvalid_model_ids, mpistate.size): model_id = valid_model_ids[model_index] logger.debug("MPI process {} working on model {}".format(mpistate.rank, model_id)) molprobity_score = run_molprobity_oneline_analysis_and_write_results( targetid, model_id, ensembler_stage, model_structure_filename=model_structure_filename, models_target_dir=models_target_dir, ) molprobity_scores_sublist.append((model_id, molprobity_score)) molprobity_scores_gathered_list = mpistate.comm.gather(molprobity_scores_sublist, root=0) if mpistate.rank == 0: molprobity_scores_list_of_tuples = [item for sublist in molprobity_scores_gathered_list for item in sublist] molprobity_scores_sorted = sorted(molprobity_scores_list_of_tuples, key=lambda x: x[1]) write_molprobity_scores_list(molprobity_scores_sorted, molprobity_results_filepath)