diff --git a/meld/src/CMakeLists.txt b/meld/src/CMakeLists.txt index ca89294ebc990824b85927827e557a6d18d882a5..400084ac9af8e812bce22d36413e6f58cf8c1ad6 100644 --- a/meld/src/CMakeLists.txt +++ b/meld/src/CMakeLists.txt @@ -8,8 +8,11 @@ gap.hh model.hh ) -module(NAME meld HEADERS ${MELD_HEADERS} SOURCES ${MELD_SOURCES} DEPENDS_ON - promod3_core LINK ${OPENGL_LIBRARIES} ${OST_LIBRARIES} ${BOOST_LIBRARIES}) +module(NAME meld + HEADERS ${MELD_HEADERS} + SOURCES ${MELD_SOURCES} + DEPENDS_ON promod3_core + LINK ${OPENGL_LIBRARIES} ${OST_LIBRARIES} ${BOOST_LIBRARIES}) if (QMEAN_ROOT) target_link_libraries(promod3_meld ${QMEAN_LIBRARIES}) diff --git a/meld/tests/CMakeLists.txt b/meld/tests/CMakeLists.txt index 331317e57404072ba4cf4432fdfd69d7f556c05e..d3c6a8f074ec5796cef9c771f906079277e8f6f0 100644 --- a/meld/tests/CMakeLists.txt +++ b/meld/tests/CMakeLists.txt @@ -20,4 +20,3 @@ set(MELD_TEST_DATA promod3_unittest(MODULE meld SOURCES "${MELD_UNIT_TESTS}" DATA "${MELD_TEST_DATA}") - diff --git a/meld/tests/test_raw_modeling.py b/meld/tests/test_raw_modeling.py index a99115ffdf86b456ea9a25932cb9f4dfed28ee8b..b18cc0e4c415d25309338e35ebeec799591bb576 100644 --- a/meld/tests/test_raw_modeling.py +++ b/meld/tests/test_raw_modeling.py @@ -1,97 +1,102 @@ +""" +Unit tests for meld. +""" import unittest from promod3 import meld from ost import conop, seq, io, mol class RawModelingTests(unittest.TestCase): - def setUp(self): - compound_lib=conop.CompoundLib.Load('data/raw-modeling/compounds.chemlib') - conop.SetDefaultLib(compound_lib) - io.profiles['DEFAULT'].processor = conop.RuleBasedProcessor(compound_lib) + def setUp(self): + compound_lib = conop.CompoundLib.Load( + 'data/raw-modeling/compounds.chemlib') + conop.SetDefaultLib(compound_lib) + io.profiles['DEFAULT'].processor = conop.RuleBasedProcessor( + compound_lib) - def testRaiseNoAttachedView(self): - # test that BuildRawModel throws exception when no view is attached - aln=seq.CreateAlignment(seq.CreateSequence('A', 'acdef'), - seq.CreateSequence('B', 'ac-ef')) - self.assertRaises(RuntimeError, meld.BuildRawModel, aln) - - def testModeledSequence(self): - # test if the model has the sequence we want. - tpl=io.LoadPDB('data/raw-modeling/gly.pdb') - aln=io.LoadAlignment('data/raw-modeling/seq.fasta') - aln.AttachView(1, tpl.CreateFullView()) - result=meld.BuildRawModel(aln) - seq1=seq.SequenceFromChain('MODEL', result.model.chains[0]) - self.assertEqual(seq1.string, aln.sequences[0].string) + def testRaiseNoAttachedView(self): + # test that BuildRawModel throws exception when no view is attached + aln = seq.CreateAlignment(seq.CreateSequence('A', 'acdef'), + seq.CreateSequence('B', 'ac-ef')) + self.assertRaises(RuntimeError, meld.BuildRawModel, aln) - def testDeletion(self): - # test if the result contains a "deletion" gap at the right spot. - tpl=io.LoadPDB('data/raw-modeling/gly.pdb') - aln=io.LoadAlignment('data/raw-modeling/del.fasta') - aln.AttachView(1, tpl.CreateFullView()) - result=meld.BuildRawModel(aln) - residues=result.model.residues - self.assertEqual(len(result.gaps), 1) - self.assertEqual(result.gaps[0].before, residues[2]) - self.assertEqual(result.gaps[0].after, residues[3]) - self.assertEqual(result.gaps[0].seq, '') + def testModeledSequence(self): + # test if the model has the sequence we want. + tpl = io.LoadPDB('data/raw-modeling/gly.pdb') + aln = io.LoadAlignment('data/raw-modeling/seq.fasta') + aln.AttachView(1, tpl.CreateFullView()) + result = meld.BuildRawModel(aln) + seq1 = seq.SequenceFromChain('MODEL', result.model.chains[0]) + self.assertEqual(seq1.string, aln.sequences[0].string) - def testInsertion(self): - # test if the result contains an "insertion" gap at the right spot. - tpl=io.LoadPDB('data/raw-modeling/gly.pdb') - aln=io.LoadAlignment('data/raw-modeling/ins.fasta') - aln.AttachView(1, tpl.CreateFullView()) - result=meld.BuildRawModel(aln) - residues=result.model.residues - self.assertEqual(len(result.gaps), 1) - self.assertEqual(result.gaps[0].before, residues[1]) - self.assertEqual(result.gaps[0].after, residues[2]) - self.assertEqual(result.gaps[0].seq, 'AV') - - def testTer(self): - # test if the result contains two terminal gaps, one at the beginning, - # one at the end - tpl=io.LoadPDB('data/raw-modeling/gly.pdb') - aln=io.LoadAlignment('data/raw-modeling/ter.fasta') - aln.AttachView(1, tpl.CreateFullView()) - result=meld.BuildRawModel(aln) - residues=result.model.residues - self.assertEqual(len(result.gaps), 2) - self.assertEqual(result.gaps[0].before, mol.ResidueHandle()) - self.assertEqual(result.gaps[0].after, residues[0]) - self.assertEqual(result.gaps[0].seq, 'G') - self.assertEqual(result.gaps[1].before, residues[-1]) - self.assertEqual(result.gaps[1].after, mol.ResidueHandle()) - self.assertEqual(result.gaps[1].seq, 'G') + def testDeletion(self): + # test if the result contains a "deletion" gap at the right spot. + tpl = io.LoadPDB('data/raw-modeling/gly.pdb') + aln = io.LoadAlignment('data/raw-modeling/del.fasta') + aln.AttachView(1, tpl.CreateFullView()) + result = meld.BuildRawModel(aln) + residues = result.model.residues + self.assertEqual(len(result.gaps), 1) + self.assertEqual(result.gaps[0].before, residues[2]) + self.assertEqual(result.gaps[0].after, residues[3]) + self.assertEqual(result.gaps[0].seq, '') - def testModified(self): - # test if we correctly strip off modifications - tpl=io.LoadPDB('data/raw-modeling/sep.pdb') - aln=io.LoadAlignment('data/raw-modeling/sep.fasta') - aln.AttachView(1, tpl.CreateFullView()) - result=meld.BuildRawModel(aln) - residues=result.model.residues - self.assertEqual(len(residues), 1) - self.assertEqual(len(residues[0].atoms), 6) - self.assertTrue(residues[0].FindAtom("N")) - self.assertTrue(residues[0].FindAtom("CA")) - self.assertTrue(residues[0].FindAtom("C")) - self.assertTrue(residues[0].FindAtom("O")) - self.assertTrue(residues[0].FindAtom("CB")) - self.assertTrue(residues[0].FindAtom("OG")) + def testInsertion(self): + # test if the result contains an "insertion" gap at the right spot. + tpl = io.LoadPDB('data/raw-modeling/gly.pdb') + aln = io.LoadAlignment('data/raw-modeling/ins.fasta') + aln.AttachView(1, tpl.CreateFullView()) + result = meld.BuildRawModel(aln) + residues = result.model.residues + self.assertEqual(len(result.gaps), 1) + self.assertEqual(result.gaps[0].before, residues[1]) + self.assertEqual(result.gaps[0].after, residues[2]) + self.assertEqual(result.gaps[0].seq, 'AV') - def testInsertCBeta(self): - # test if the dst residues contain cbeta, unless they are glycines - tpl=io.LoadPDB('data/raw-modeling/cbeta.pdb') - aln=io.LoadAlignment('data/raw-modeling/cbeta.fasta') - aln.AttachView(1, tpl.CreateFullView()) - result=meld.BuildRawModel(aln) - residues=result.model.residues - assert not residues[0].FindAtom("CB").IsValid() - assert not residues[1].FindAtom("CB").IsValid() - assert residues[2].FindAtom("CB").IsValid() - assert residues[3].FindAtom("CB").IsValid() + def testTer(self): + # test if the result contains two terminal gaps, one at the beginning, + # one at the end + tpl = io.LoadPDB('data/raw-modeling/gly.pdb') + aln = io.LoadAlignment('data/raw-modeling/ter.fasta') + aln.AttachView(1, tpl.CreateFullView()) + result = meld.BuildRawModel(aln) + residues = result.model.residues + self.assertEqual(len(result.gaps), 2) + self.assertEqual(result.gaps[0].before, mol.ResidueHandle()) + self.assertEqual(result.gaps[0].after, residues[0]) + self.assertEqual(result.gaps[0].seq, 'G') + self.assertEqual(result.gaps[1].before, residues[-1]) + self.assertEqual(result.gaps[1].after, mol.ResidueHandle()) + self.assertEqual(result.gaps[1].seq, 'G') + + def testModified(self): + # test if we correctly strip off modifications + tpl = io.LoadPDB('data/raw-modeling/sep.pdb') + aln = io.LoadAlignment('data/raw-modeling/sep.fasta') + aln.AttachView(1, tpl.CreateFullView()) + result = meld.BuildRawModel(aln) + residues = result.model.residues + self.assertEqual(len(residues), 1) + self.assertEqual(len(residues[0].atoms), 6) + self.assertTrue(residues[0].FindAtom("N")) + self.assertTrue(residues[0].FindAtom("CA")) + self.assertTrue(residues[0].FindAtom("C")) + self.assertTrue(residues[0].FindAtom("O")) + self.assertTrue(residues[0].FindAtom("CB")) + self.assertTrue(residues[0].FindAtom("OG")) + + def testInsertCBeta(self): + # test if the dst residues contain cbeta, unless they are glycines + tpl = io.LoadPDB('data/raw-modeling/cbeta.pdb') + aln = io.LoadAlignment('data/raw-modeling/cbeta.fasta') + aln.AttachView(1, tpl.CreateFullView()) + result = meld.BuildRawModel(aln) + residues = result.model.residues + self.assertFalse(residues[0].FindAtom("CB").IsValid()) + self.assertFalse(residues[1].FindAtom("CB").IsValid()) + self.assertTrue(residues[2].FindAtom("CB").IsValid()) + self.assertTrue(residues[3].FindAtom("CB").IsValid()) if __name__ == "__main__": - from ost import testutils - testutils.RunTests() + from ost import testutils + testutils.RunTests()