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"
i = self.list3.InsertStringItem(sys.maxint, str(row[0])) for j, value in enumerate(row[1:]): self.list3.SetStringItem(i, j + 1, str(value)) p1, p2 = stats.format_plots() y1, yrange1 = p1 y2, yrange2 = p2 if (not y1.all_eq(0)): self.plot1.convert_histogram(y1) if (not y2.all_eq(0)): self.plot2.convert_histogram(y2) class adp_histogram(plots.histogram): def convert_histogram(self, bins): # XXX flex.histogram has already binned values, so I make new fake values # that matplotlib then re-bins values = [] for i, x in enumerate(bins): values.extend([i] * x) self.show_histogram(values, len(bins), y_label="# of atoms") if (__name__ == "__main__"): from mmtbx.command_line import b_factor_statistics stats = b_factor_statistics.run(sys.argv[1:]) app = wx.App(0) frame = ADPStatisticsFrame(None, -1, "ADP statistics") frame.show_statistics(stats) frame.Show() app.MainLoop()
self.list2.SetStringItem(i, j+1, str(value)) for row in t3 : i = self.list3.InsertStringItem(sys.maxint, str(row[0])) for j, value in enumerate(row[1:]) : self.list3.SetStringItem(i, j+1, str(value)) p1, p2 = stats.format_plots() y1, yrange1 = p1 y2, yrange2 = p2 if (not y1.all_eq(0)) : self.plot1.convert_histogram(y1) if (not y2.all_eq(0)) : self.plot2.convert_histogram(y2) class adp_histogram (plots.histogram) : def convert_histogram (self, bins) : # XXX flex.histogram has already binned values, so I make new fake values # that matplotlib then re-bins values = [] for i, x in enumerate(bins) : values.extend([i] * x) self.show_histogram(values, len(bins), y_label="# of atoms") if (__name__ == "__main__") : from mmtbx.command_line import b_factor_statistics stats = b_factor_statistics.run(sys.argv[1:]) app = wx.App(0) frame = ADPStatisticsFrame(None, -1, "ADP statistics") frame.show_statistics(stats) frame.Show() app.MainLoop()