def exercise_intensity_output () : if (os.path.isfile("tst_fmodel_anomalous.mtz")) : os.remove("tst_fmodel_anomalous.mtz") pdb_file = make_fake_anomalous_data.write_pdb_input_cd_cl( file_base="tst_fmodel_anomalous") # phenix.fmodel (with wavelength) args = [ pdb_file, "high_resolution=1.0", "wavelength=1.116", "obs_type=intensities", "type=real", "output.file_name=tst_fmodel_intensity.mtz", "r_free_flags_fraction=0.1", ] args2 = args + ["label=Imodel"] fmodel.run(args=args2, log=null_out()) assert os.path.isfile("tst_fmodel_intensity.mtz") mtz_in = file_reader.any_file("tst_fmodel_intensity.mtz") assert mtz_in.file_server.miller_arrays[0].is_xray_intensity_array() try : fmodel.run(args=args, log=null_out()) except Sorry : pass else : raise Exception_expected try : fmodel.run(args=args+["format=cns"], log=null_out()) except Sorry : pass else : raise Exception_expected
def exercise () : if (os.path.isfile("tst_fmodel_anomalous.mtz")) : os.remove("tst_fmodel_anomalous.mtz") pdb_file = make_fake_anomalous_data.write_pdb_input_cd_cl( file_base="tst_fmodel_anomalous") # phenix.fmodel (with wavelength) args = [ pdb_file, "high_resolution=1.0", "wavelength=1.116", "label=F", "type=real", "output.file_name=tst_fmodel_anomalous.mtz", "r_free_flags_fraction=0.1", ] fmodel.run(args=args, log=null_out()) assert os.path.isfile("tst_fmodel_anomalous.mtz") mtz_in = file_reader.any_file("tst_fmodel_anomalous.mtz") array = mtz_in.file_server.miller_arrays[0] assert (array.anomalous_flag()) anom_diffs = array.anomalous_differences() assert approx_equal(flex.max(anom_diffs.data()), 5.72, eps=0.01) # mmtbx.fmodel_simple result = easy_run.call( "mmtbx.fmodel_simple \"%s\" tst_fmodel_anomalous.mtz high_resolution=2.0" % pdb_file) print "OK"
def exercise_heavy () : from mmtbx.regression import make_fake_anomalous_data from mmtbx.command_line import validate_waters import mmtbx.ions.utils from iotbx.file_reader import any_file file_base = "tst_validate_waters_1" pdb_file = make_fake_anomalous_data.write_pdb_input_cd_cl(file_base=file_base) mtz_file = make_fake_anomalous_data.generate_mtz_file( file_base="tst_validate_waters_1", d_min=1.5, anomalous_scatterers=[ group_args(selection="element CD", fp=-0.29, fdp=2.676), group_args(selection="element CL", fp=0.256, fdp=0.5), ]) pdb_in = any_file(pdb_file) hierarchy = pdb_in.file_object.hierarchy hierarchy, n = mmtbx.ions.utils.anonymize_ions(hierarchy, log=null_out()) hierarchy.write_pdb_file("%s_start.pdb" % file_base, crystal_symmetry=pdb_in.file_object.crystal_symmetry()) args = ["tst_validate_waters_1_start.pdb", "tst_validate_waters_1.mtz", "skip_twin_detection=True"] results = validate_waters.run(args=args, out=null_out()) out = StringIO() results.show(out=out) s = easy_pickle.dumps(results) r2 = easy_pickle.loads(s) out2 = StringIO() r2.show(out=out2) assert not show_diff(out.getvalue(), out2.getvalue()) assert (results.n_bad >= 1) and (results.n_heavy == 2)
def exercise_heavy(): from mmtbx.regression import make_fake_anomalous_data from mmtbx.command_line import validate_waters import mmtbx.ions.utils from iotbx.file_reader import any_file file_base = "tst_validate_waters_1" pdb_file = make_fake_anomalous_data.write_pdb_input_cd_cl( file_base=file_base) mtz_file = make_fake_anomalous_data.generate_mtz_file( file_base="tst_validate_waters_1", d_min=1.5, anomalous_scatterers=[ group_args(selection="element CD", fp=-0.29, fdp=2.676), group_args(selection="element CL", fp=0.256, fdp=0.5), ]) pdb_in = any_file(pdb_file) hierarchy = pdb_in.file_object.hierarchy hierarchy, n = mmtbx.ions.utils.anonymize_ions(hierarchy, log=null_out()) hierarchy.write_pdb_file( "%s_start.pdb" % file_base, crystal_symmetry=pdb_in.file_object.crystal_symmetry()) args = [ "tst_validate_waters_1_start.pdb", "tst_validate_waters_1.mtz", "skip_twin_detection=True" ] results = validate_waters.run(args=args, out=null_out()) out = StringIO() results.show(out=out) s = easy_pickle.dumps(results) r2 = easy_pickle.loads(s) out2 = StringIO() r2.show(out=out2) assert not show_diff(out.getvalue(), out2.getvalue()) assert (results.n_bad >= 1) and (results.n_heavy == 2)
def exercise () : from mmtbx.command_line import b_factor_statistics from mmtbx.regression import make_fake_anomalous_data pdb_file = make_fake_anomalous_data.write_pdb_input_cd_cl( file_base="tst_b_factor_stats") out = StringIO() stats = b_factor_statistics.run(args=[pdb_file], out=out) assert ("""\ | all : 79 0 7.73 42.64 13.18 None None None |""" in out.getvalue()) out = StringIO() stats = b_factor_statistics.run(args=[pdb_file, "selection=element CD"], out=out) assert ("""\ | all(noH): 1 0 15.00 15.00 15.00 None None None |""" in out.getvalue()) print "OK"
def exercise(): from mmtbx.command_line import b_factor_statistics from mmtbx.regression import make_fake_anomalous_data pdb_file = make_fake_anomalous_data.write_pdb_input_cd_cl( file_base="tst_b_factor_stats") out = StringIO() stats = b_factor_statistics.run(args=[pdb_file], out=out) assert ("""\ | all : 79 0 7.73 42.64 13.18 None None None |""" in out.getvalue()) out = StringIO() stats = b_factor_statistics.run(args=[pdb_file, "selection=element CD"], out=out) assert ("""\ | all(noH): 1 0 15.00 15.00 15.00 None None None |""" in out.getvalue()) print "OK"