Skip to content
Snippets Groups Projects
Commit 7f593778 authored by Bienchen's avatar Bienchen Committed by BIOPZ-Johner Niklaus
Browse files

Renamed meld to rawmodel

parent c1478f9e
No related branches found
No related tags found
No related merge requests found
""" """
Unit tests for meld. Unit tests for rawmodel.
""" """
import unittest import unittest
from promod3 import meld from promod3 import rawmodel
from ost import conop, seq, io, mol from ost import conop, seq, io, mol
class RawModelingTests(unittest.TestCase): class RawModelingTests(unittest.TestCase):
...@@ -17,14 +17,14 @@ class RawModelingTests(unittest.TestCase): ...@@ -17,14 +17,14 @@ class RawModelingTests(unittest.TestCase):
# test that BuildRawModel throws exception when no view is attached # test that BuildRawModel throws exception when no view is attached
aln = seq.CreateAlignment(seq.CreateSequence('A', 'acdef'), aln = seq.CreateAlignment(seq.CreateSequence('A', 'acdef'),
seq.CreateSequence('B', 'ac-ef')) seq.CreateSequence('B', 'ac-ef'))
self.assertRaises(RuntimeError, meld.BuildRawModel, aln) self.assertRaises(RuntimeError, rawmodel.BuildRawModel, aln)
def testModeledSequence(self): def testModeledSequence(self):
# test if the model has the sequence we want. # test if the model has the sequence we want.
tpl = io.LoadPDB('data/raw-modeling/gly.pdb') tpl = io.LoadPDB('data/raw-modeling/gly.pdb')
aln = io.LoadAlignment('data/raw-modeling/seq.fasta') aln = io.LoadAlignment('data/raw-modeling/seq.fasta')
aln.AttachView(1, tpl.CreateFullView()) aln.AttachView(1, tpl.CreateFullView())
result = meld.BuildRawModel(aln) result = rawmodel.BuildRawModel(aln)
seq1 = seq.SequenceFromChain('MODEL', result.model.chains[0]) seq1 = seq.SequenceFromChain('MODEL', result.model.chains[0])
self.assertEqual(seq1.string, aln.sequences[0].string) self.assertEqual(seq1.string, aln.sequences[0].string)
...@@ -33,7 +33,7 @@ class RawModelingTests(unittest.TestCase): ...@@ -33,7 +33,7 @@ class RawModelingTests(unittest.TestCase):
tpl = io.LoadPDB('data/raw-modeling/gly.pdb') tpl = io.LoadPDB('data/raw-modeling/gly.pdb')
aln = io.LoadAlignment('data/raw-modeling/del.fasta') aln = io.LoadAlignment('data/raw-modeling/del.fasta')
aln.AttachView(1, tpl.CreateFullView()) aln.AttachView(1, tpl.CreateFullView())
result = meld.BuildRawModel(aln) result = rawmodel.BuildRawModel(aln)
residues = result.model.residues residues = result.model.residues
self.assertEqual(len(result.gaps), 1) self.assertEqual(len(result.gaps), 1)
self.assertEqual(result.gaps[0].before, residues[2]) self.assertEqual(result.gaps[0].before, residues[2])
...@@ -45,7 +45,7 @@ class RawModelingTests(unittest.TestCase): ...@@ -45,7 +45,7 @@ class RawModelingTests(unittest.TestCase):
tpl = io.LoadPDB('data/raw-modeling/gly.pdb') tpl = io.LoadPDB('data/raw-modeling/gly.pdb')
aln = io.LoadAlignment('data/raw-modeling/ins.fasta') aln = io.LoadAlignment('data/raw-modeling/ins.fasta')
aln.AttachView(1, tpl.CreateFullView()) aln.AttachView(1, tpl.CreateFullView())
result = meld.BuildRawModel(aln) result = rawmodel.BuildRawModel(aln)
residues = result.model.residues residues = result.model.residues
self.assertEqual(len(result.gaps), 1) self.assertEqual(len(result.gaps), 1)
self.assertEqual(result.gaps[0].before, residues[1]) self.assertEqual(result.gaps[0].before, residues[1])
...@@ -58,7 +58,7 @@ class RawModelingTests(unittest.TestCase): ...@@ -58,7 +58,7 @@ class RawModelingTests(unittest.TestCase):
tpl = io.LoadPDB('data/raw-modeling/gly.pdb') tpl = io.LoadPDB('data/raw-modeling/gly.pdb')
aln = io.LoadAlignment('data/raw-modeling/ter.fasta') aln = io.LoadAlignment('data/raw-modeling/ter.fasta')
aln.AttachView(1, tpl.CreateFullView()) aln.AttachView(1, tpl.CreateFullView())
result = meld.BuildRawModel(aln) result = rawmodel.BuildRawModel(aln)
residues = result.model.residues residues = result.model.residues
self.assertEqual(len(result.gaps), 2) self.assertEqual(len(result.gaps), 2)
self.assertEqual(result.gaps[0].before, mol.ResidueHandle()) self.assertEqual(result.gaps[0].before, mol.ResidueHandle())
...@@ -73,7 +73,7 @@ class RawModelingTests(unittest.TestCase): ...@@ -73,7 +73,7 @@ class RawModelingTests(unittest.TestCase):
tpl = io.LoadPDB('data/raw-modeling/sep.pdb') tpl = io.LoadPDB('data/raw-modeling/sep.pdb')
aln = io.LoadAlignment('data/raw-modeling/sep.fasta') aln = io.LoadAlignment('data/raw-modeling/sep.fasta')
aln.AttachView(1, tpl.CreateFullView()) aln.AttachView(1, tpl.CreateFullView())
result = meld.BuildRawModel(aln) result = rawmodel.BuildRawModel(aln)
residues = result.model.residues residues = result.model.residues
self.assertEqual(len(residues), 1) self.assertEqual(len(residues), 1)
self.assertEqual(len(residues[0].atoms), 6) self.assertEqual(len(residues[0].atoms), 6)
...@@ -89,7 +89,7 @@ class RawModelingTests(unittest.TestCase): ...@@ -89,7 +89,7 @@ class RawModelingTests(unittest.TestCase):
tpl = io.LoadPDB('data/raw-modeling/cbeta.pdb') tpl = io.LoadPDB('data/raw-modeling/cbeta.pdb')
aln = io.LoadAlignment('data/raw-modeling/cbeta.fasta') aln = io.LoadAlignment('data/raw-modeling/cbeta.fasta')
aln.AttachView(1, tpl.CreateFullView()) aln.AttachView(1, tpl.CreateFullView())
result = meld.BuildRawModel(aln) result = rawmodel.BuildRawModel(aln)
residues = result.model.residues residues = result.model.residues
self.assertFalse(residues[0].FindAtom("CB").IsValid()) self.assertFalse(residues[0].FindAtom("CB").IsValid())
self.assertFalse(residues[1].FindAtom("CB").IsValid()) self.assertFalse(residues[1].FindAtom("CB").IsValid())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment