diff --git a/modules/mmcif/pyext/src/util.py b/modules/mmcif/pyext/src/util.py index af83e17020..96b7486d37 100644 --- a/modules/mmcif/pyext/src/util.py +++ b/modules/mmcif/pyext/src/util.py @@ -41,7 +41,7 @@ def __getitem__(self, ind): return "".join(reversed(ids)) -class Convert(object): +class Writer(object): """Convert one or more IMP Models and/or RMF frames to mmCIF or BinaryCIF. diff --git a/modules/mmcif/test/standards_exceptions b/modules/mmcif/test/standards_exceptions index 63a10fdec3..49e74be8b1 100644 --- a/modules/mmcif/test/standards_exceptions +++ b/modules/mmcif/test/standards_exceptions @@ -1,4 +1,4 @@ value_object_exceptions=[] -function_name_exceptions=['System.report', 'Convert.report'] +function_name_exceptions=['System.report', 'Writer.report'] show_exceptions=[] spelling_exceptions=['rmf'] diff --git a/modules/mmcif/test/test_convert.py b/modules/mmcif/test/test_convert.py index ae31d6dbbc..3765187d9b 100644 --- a/modules/mmcif/test/test_convert.py +++ b/modules/mmcif/test/test_convert.py @@ -76,7 +76,7 @@ def test_parse_sel_tuple(self): m = IMP.Model() top = IMP.atom.Hierarchy.setup_particle(IMP.Particle(m)) self.add_chains(m, top) - c = IMP.mmcif.Convert() + c = IMP.mmcif.Writer() c.add_model([top], []) all_foo = c._parse_sel_tuple("foo") @@ -93,7 +93,7 @@ def test_no_chains(self): """Trying to add a Hierarchy with no chains should give an error""" m = IMP.Model() top = IMP.atom.Hierarchy.setup_particle(IMP.Particle(m)) - c = IMP.mmcif.Convert() + c = IMP.mmcif.Writer() self.assertIsNone(c.system.title) self.assertRaises(ValueError, c.add_model, [top], []) @@ -103,7 +103,7 @@ def test_no_state_node(self): top = IMP.atom.Hierarchy.setup_particle(IMP.Particle(m)) top.set_name("Top node") self.add_chains(m, top) - c = IMP.mmcif.Convert() + c = IMP.mmcif.Writer() c.add_model([top], []) self.assertEqual([x.description for x in c.system.entities], ['foo', 'baz']) @@ -131,7 +131,7 @@ def test_dna_rna(self): chain1 = top.get_child(1).get_child(0) self.assertTrue(IMP.atom.Chain.get_is_setup(chain1)) IMP.atom.Chain(chain1).set_chain_type(IMP.atom.DNA) - c = IMP.mmcif.Convert() + c = IMP.mmcif.Writer() c.add_model([top], []) self.assertIsInstance(c.system.entities[0].sequence[0], ihm.RNAChemComp) @@ -145,7 +145,7 @@ def test_duplicate_chain_ids(self): top.set_name("Top node") self.add_chains(m, top, chains = (('foo', 'ACGT', 'X'), ('baz', 'ACCT', 'X'))) - c = IMP.mmcif.Convert() + c = IMP.mmcif.Writer() c.add_model([top], []) self.assertEqual([x.id for x in c.system.asym_units], ['A', 'B']) @@ -158,7 +158,7 @@ def test_duplicate_molecule_names(self): self.add_chains(m, top, chains = (('foo', 'ACGT', 'X'), ('foo', 'ACCT', 'Y'), ('foo', 'ACGT', 'Z'))) - c = IMP.mmcif.Convert() + c = IMP.mmcif.Writer() c.add_model([top], []) self.assertEqual([x.id for x in c.system.asym_units], ['X', 'Y', 'Z']) @@ -188,7 +188,7 @@ def make_rmf(fname): fname = self.get_tmp_file_name("test_add_rmf.rmf3") make_rmf(fname) - c = IMP.mmcif.Convert() + c = IMP.mmcif.Writer() c.add_rmf(fname) self.assertEqual(len(c.system.entities), 2) self.assertEqual(len(c.system.asym_units), 3) @@ -203,7 +203,7 @@ def test_two_states(self): self.add_chains(m, state0) state1 = self.add_state(m, top, 1, "State_1") self.add_chains(m, state1) - c = IMP.mmcif.Convert() + c = IMP.mmcif.Writer() c.add_model([top], []) # Entities/asyms should not be duplicated self.assertEqual([x.description for x in c.system.entities], @@ -229,16 +229,16 @@ def test_filter_states(self): self.add_chains(m, state1) # No filtering -> two states - c = IMP.mmcif.Convert() + c = IMP.mmcif.Writer() c.add_model([top], []) self.assertEqual(len(c.system.state_groups[0]), 2) - c = IMP.mmcif.Convert() + c = IMP.mmcif.Writer() c.add_model([top], [], states=["State_0"]) self.assertEqual(len(c.system.state_groups[0]), 1) # No states selected (and so no groups either) - c = IMP.mmcif.Convert() + c = IMP.mmcif.Writer() c.add_model([top], [], states=["State_99"]) self.assertEqual(len(c.system.state_groups), 0) @@ -248,24 +248,24 @@ def test_group_ensembles(self): top = IMP.atom.Hierarchy.setup_particle(IMP.Particle(m)) self.add_chains(m, top) - c = IMP.mmcif.Convert() + c = IMP.mmcif.Writer() c.add_model([top], []) c.add_model([top], []) # No grouping -> ensemble for each model self.assertEqual(len(c.system.ensembles), 2) # Group into single ensemble - c = IMP.mmcif.Convert() + c = IMP.mmcif.Writer() ens = c.add_model([top], []) c.add_model([top], [], ensembles=ens) self.assertEqual(len(c.system.ensembles), 1) def test_write(self): - """Test Convert.write() method""" + """Test Writer.write() method""" m = IMP.Model() top = IMP.atom.Hierarchy.setup_particle(IMP.Particle(m)) self.add_chains(m, top) - c = IMP.mmcif.Convert() + c = IMP.mmcif.Writer() c.add_model([top], []) fname = 'test_write.cif' c.write(fname) @@ -276,12 +276,12 @@ def test_write(self): os.unlink(fname) def test_report(self): - """Test Convert.report() method""" + """Test Writer.report() method""" sio = StringIO() m = IMP.Model() top = IMP.atom.Hierarchy.setup_particle(IMP.Particle(m)) self.add_chains(m, top) - c = IMP.mmcif.Convert() + c = IMP.mmcif.Writer() c.add_model([top], []) c.report(sio) @@ -307,7 +307,7 @@ def test_sampcon_ensemble(self): self.add_protocol(m, state0, sampcon=True) for top in (top1, top2, top3): - c = IMP.mmcif.Convert() + c = IMP.mmcif.Writer() c.add_model([top], []) e, = c.system.ensembles @@ -350,7 +350,7 @@ def add_software(m, top): add_software(m, state0) for top in (top1, top2, top3): - c = IMP.mmcif.Convert() + c = IMP.mmcif.Writer() c.add_model([top], []) soft, = c.system.software @@ -385,7 +385,7 @@ def add_script(m, top): add_script(m, state0) for top in (top1, top2, top3): - c = IMP.mmcif.Convert() + c = IMP.mmcif.Writer() c.add_model([top], []) loc, = c.system.locations @@ -400,7 +400,7 @@ def test_same_assembly(self): top2 = IMP.atom.Hierarchy.setup_particle(IMP.Particle(m)) self.add_chains(m, top2) - c = IMP.mmcif.Convert() + c = IMP.mmcif.Writer() c.add_model([top1, top2], []) self.assertEqual(len(c.system.orphan_assemblies), 1) self.assertEqual(len(c.system.orphan_assemblies[0]), 3) @@ -415,7 +415,7 @@ def test_different_assembly(self): self.add_chains(m, top2, chains = (('foo', 'ACGT', 'X'), ('bar', 'ACGT', 'Y'))) - c = IMP.mmcif.Convert() + c = IMP.mmcif.Writer() c.add_model([top1, top2], []) self.assertEqual(len(c.system.orphan_assemblies), 2) self.assertEqual(len(c.system.orphan_assemblies[0]), 3) @@ -426,7 +426,7 @@ def test_model_creation(self): m = IMP.Model() top = IMP.atom.Hierarchy.setup_particle(IMP.Particle(m)) self.add_chains(m, top) - c = IMP.mmcif.Convert() + c = IMP.mmcif.Writer() chain0 = top.get_child(0).get_child(0) self.assertTrue(IMP.atom.Chain.get_is_setup(chain0)) # Test that IMP residue numbering (11-14) maps to IHM (1-4) @@ -510,7 +510,7 @@ def test_starting_models(self): frag.add_child(residue) chain1.add_child(frag) - c = IMP.mmcif.Convert() + c = IMP.mmcif.Writer() c.add_model([top], []) # Both models should have same representation, with same starting model state0_model, = c.system.state_groups[0][0][0] @@ -525,7 +525,7 @@ def test_em3d_restraint(self): top = IMP.atom.Hierarchy.setup_particle(IMP.Particle(m)) self.add_chains(m, top) self.add_protocol(m, top) - c = IMP.mmcif.Convert() + c = IMP.mmcif.Writer() chain0 = top.get_child(0).get_child(0) r1 = self.add_structured_residue(m, chain0, 1) self.add_structured_residue(m, chain0, 2) diff --git a/modules/mmcif/test/test_dumper.py b/modules/mmcif/test/test_dumper.py index f4f2989c31..60c03380ab 100644 --- a/modules/mmcif/test/test_dumper.py +++ b/modules/mmcif/test/test_dumper.py @@ -104,7 +104,7 @@ def test_software_dumper(self): m = IMP.Model() h = self.make_model(m) IMP.core.add_imp_provenance(h) - c = IMP.mmcif.Convert() + c = IMP.mmcif.Writer() c.add_model([h], [], name="model1") # Assign ID to IMP citation @@ -161,7 +161,7 @@ def test_assembly_all_modeled(self): self.add_structured_residue(m, chain2, 3) self.add_structured_residue(m, chain3, 1) self.add_structured_residue(m, chain3, 2) - c = IMP.mmcif.Convert() + c = IMP.mmcif.Writer() c.add_model([h], []) foo, bar, baz = c.system.asym_units @@ -235,7 +235,7 @@ def test_model_representation_dumper(self): frag1 = IMP.atom.Fragment.setup_particle(IMP.Particle(m), [3, 4]) self.add_structure(frag1) chain.add_child(frag1) - c = IMP.mmcif.Convert() + c = IMP.mmcif.Writer() c.add_model([h], []) self._assign_entity_ids(c) @@ -336,7 +336,7 @@ def _internal_test_starting_model_dumper(self, cif): h2 = self._make_residue_chain('Nup85', 'B', m) state2h.add_child(h2) - c = IMP.mmcif.Convert() + c = IMP.mmcif.Writer() c.add_model([top], []) self._assign_entity_ids(c) @@ -413,7 +413,7 @@ def test_workflow(self): prov = IMP.core.ScriptProvenance.setup_particle(m, IMP.Particle(m), __file__) IMP.core.add_provenance(m, h, prov) - c = IMP.mmcif.Convert() + c = IMP.mmcif.Writer() c.add_model([h], [], name="model1") root = os.path.dirname(__file__) @@ -451,7 +451,7 @@ def test_modeling_protocol(self): """Test ProtocolDumper""" m = IMP.Model() h = self.make_model_with_protocol(m) - c = IMP.mmcif.Convert() + c = IMP.mmcif.Writer() c.add_model([h], [], name="model1") self._assign_entity_ids(c) @@ -498,7 +498,7 @@ def test_post_process(self): """Test PostProcessDumper""" m = IMP.Model() h = self.make_model_with_protocol(m) - c = IMP.mmcif.Convert() + c = IMP.mmcif.Writer() c.add_model([h], [], name="model1") self._assign_entity_ids(c) @@ -534,7 +534,7 @@ def test_ensemble_info(self): """Test EnsembleDumper""" m = IMP.Model() h = self.make_model(m) - c = IMP.mmcif.Convert() + c = IMP.mmcif.Writer() ens = c.add_model([h], [], name="model1") ens[None].name = 'cluster 1' @@ -567,7 +567,7 @@ def test_model_list(self): """Test ModelListDumper""" m = IMP.Model() h = self.make_model(m) - c = IMP.mmcif.Convert() + c = IMP.mmcif.Writer() ens = c.add_model([h], [], name="model1") ens[None].model_group.name = 'cluster 1' c.add_model([h], [], name="model2", ensembles=ens) @@ -615,7 +615,7 @@ def test_em3d_dumper(self): em_filename = self.get_input_file_name('test.gmm.txt') r = MockGaussianEMRestraint(m, em_filename, [res1.get_particle()]) r.set_was_used(True) - c = IMP.mmcif.Convert() + c = IMP.mmcif.Writer() c.add_model([h], [r], name="model1") # Assign dataset ID (=2 since the gmm is derived from an MRC) @@ -668,7 +668,7 @@ def test_site_dumper_spheres_only(self): xyzr.set_radius(9.2) chains[1].add_child(pfrag) - c = IMP.mmcif.Convert() + c = IMP.mmcif.Writer() ens = c.add_model([h], [], name="model1") ens[None].model_group.name = 'cluster 1' @@ -725,7 +725,7 @@ def test_no_localization_densities(self): """Test DensityDumper with no density information""" m = IMP.Model() h = self.make_model_with_protocol(m) - c = IMP.mmcif.Convert() + c = IMP.mmcif.Writer() c.add_model([h], [], name="model1") dumper = ihm.dumper._DensityDumper() @@ -737,7 +737,7 @@ def test_sampcon_localization_densities(self): """Test DensityDumper with IMP.sampcon output""" m = IMP.Model() h = self.make_model_with_protocol(m, sampcon=True) - c = IMP.mmcif.Convert() + c = IMP.mmcif.Writer() ens = c.add_model([h], [], name="model1") e = ens[None] diff --git a/modules/mmcif/test/test_restraints.py b/modules/mmcif/test/test_restraints.py index b75b701127..dab1176de9 100644 --- a/modules/mmcif/test/test_restraints.py +++ b/modules/mmcif/test/test_restraints.py @@ -246,7 +246,7 @@ def test_all_restraints_saxs(self): def test_all_restraints_cross_link(self): """Test _AllRestraints with cross-link restraint""" - conv = IMP.mmcif.Convert() + conv = IMP.mmcif.Writer() m = IMP.Model() h = make_model(m, chains=[("Rpb1", "AMT", "X"), ("Rpb2", "ACC", "Z")])