def test_init(self): m = SASModel() m.read(self.testfile) n = SASModel(self.testfile) param1 = m.rfactor param2 = n.rfactor self.assertEqual(param1, param2, msg="pdb file not read correctly")
def assign_models(self, molecule=None): """ Create SASModels from pdb files saved in self.inputfiles and saved them in self.models. Center of mass, inertia tensor and canonical parameters are computed for each SASModel. :param molecule: optional 2d array, coordinates of the atoms for the model to create :return self.models: list of SASModel """ if not self.inputfiles and len(molecule) == 0: logger.error("No input files") if self.inputfiles: for inputpdb in self.inputfiles: model = SASModel() model.read(inputpdb) model.centroid() model.inertiatensor() model.canonical_parameters() self.sasmodels.append(model) if len(self.inputfiles) != len(self.sasmodels): logger.error("Problem of assignment\n%s models for %s files" % (len(self.sasmodels), len(self.inputfiles))) elif len(molecule) != 0: model = SASModel() model.atoms = molecule model.centroid() model.inertiatensor() model.canonical_parameters() self.sasmodels.append(model) return self.sasmodels
def test_same(self): m = SASModel() m.read(self.testfile) m.save(self.outfile) infile = open(self.testfile).read() outfile = open(self.outfile).read() self.assertEqual(infile, outfile, msg="file content is the same")
def assign_models(self, molecule=None): """ Create SASModels from pdb files saved in self.inputfiles and saved them in self.models. Center of mass, inertia tensor and canonical parameters are computed for each SASModel. :param molecule: optional 2d array, coordinates of the atoms for the model to create :return self.models: list of SASModel """ if not self.inputfiles and len(molecule) == 0: logger.error("No input files") if self.inputfiles: for inputpdb in self.inputfiles: model = SASModel() model.read(inputpdb) model.centroid() model.inertiatensor() model.canonical_parameters() self.sasmodels.append(model) if len(self.inputfiles) != len(self.sasmodels): logger.error("Problem of assignment\n%s models for %s files" % (len(self.sasmodels), len(self.inputfiles))) elif len(molecule) != 0: model = SASModel() model.atoms = molecule model.centroid() model.inertiatensor() model.canonical_parameters() self.sasmodels.append(model) return self.sasmodels
def test_distance(self): m = SASModel() n = SASModel() m.read(self.testfile1) n.read(self.testfile2) f_np = m.dist(n, m.atoms, n.atoms, False) f_cy = m.dist(n, m.atoms, n.atoms, True) self.assertAlmostEqual(f_np, f_cy, 10, "distance is the same %s!=%s" % (f_np, f_cy))
def test_same(self): m = SASModel() n = SASModel() m.read(self.testfile1) n.read(self.testfile1) numpy.random.shuffle(n.atoms) f_np = m.dist(n, m.atoms, n.atoms, False) f_cy = m.dist(n, m.atoms, n.atoms, True) self.assertAlmostEqual(f_np, 0, 10, "NSD not nul with np") self.assertAlmostEqual(f_cy, 0, 10, "NSD not nul with cy")
def test_invariants(self): m = SASModel() m.read(self.testfile1) f_np, r_np, d_np = m.calc_invariants(False) f_cy, r_cy, d_cy = m.calc_invariants(True) self.assertAlmostEqual(f_np, f_cy, 10, "fineness is the same %s!=%s" % (f_np, f_cy)) self.assertAlmostEqual(r_np, r_cy, 10, "Rg is the same %s!=%s" % (r_np, r_cy)) self.assertAlmostEqual(d_np, d_cy, 10, "Dmax is the same %s!=%s" % (d_np, d_cy))
def assign_models(self): """ Create SASModels from pdb files saved in self.inputfiles and saved them in self.models. Center of mass, inertia tensor and canonical parameters are computed for each SASModel. :return self.models: list of SASModel """ for inputpdb in self.inputfiles: model = SASModel() model.read(inputpdb) model.centroid() model.inertiatensor() model.canonical_parameters() self.models.append(model) if len(self.inputfiles) != len(self.models): logger.error("Problem of assignment\n%s models for %s files" % (len(self.models), len(self.inputfiles))) return self.models
def assign_models(self): """ Create SASModels from pdb files saved in self.inputfiles and saved them in self.models. Center of mass, inertia tensor and canonical parameters are computed for each SASModel. :return self.models: list of SASModel """ for inputpdb in self.inputfiles: model = SASModel() model.read(inputpdb) model.centroid() model.inertiatensor() model.canonical_parameters() self.models.append(model) if len(self.inputfiles) != len(self.models): logger.error("Problem of assignment\n%s models for %s files" % (len(self.models), len(self.inputfiles))) return self.models
def test_rfactor(self): m = SASModel() m.read(self.testfile) n = SASModel() n.read(self.testfile) self.assertEqual(m.rfactor, n.rfactor, msg="R-factor is not the same %s != %s"%(m.rfactor, n.rfactor))