mailr27389 - /trunk/test_suite/system_tests/sequence.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on January 30, 2015 - 12:35:
Author: bugman
Date: Fri Jan 30 12:35:35 2015
New Revision: 27389

URL: http://svn.gna.org/viewcvs/relax?rev=27389&view=rev
Log:
Created the Sequence.test_align_molecules system test.

This will be used to implement the sequence.align user function which will be 
used for performing
sequence alignments on structural data within the relax data store and 
storing the data in the data
pipe independent sequence_alignments data store object (which will be an 
instance of
data_store.seq_align.Sequence_alignments).  The system test also checks the 
XML saving and loading
of the ds.sequence_alignments data structure.


Modified:
    trunk/test_suite/system_tests/sequence.py

Modified: trunk/test_suite/system_tests/sequence.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/test_suite/system_tests/sequence.py?rev=27389&r1=27388&r2=27389&view=diff
==============================================================================
--- trunk/test_suite/system_tests/sequence.py   (original)
+++ trunk/test_suite/system_tests/sequence.py   Fri Jan 30 12:35:35 2015
@@ -1,6 +1,6 @@
 
###############################################################################
 #                                                                            
 #
-# Copyright (C) 2006-2013 Edward d'Auvergne                                  
 #
+# Copyright (C) 2006-2015 Edward d'Auvergne                                  
 #
 # Copyright (C) 2013-2014 Troels E. Linnet                                   
 #
 #                                                                            
 #
 # This file is part of the program relax (http://www.nmr-relax.com).         
 #
@@ -37,6 +37,73 @@
 
         # Create the data pipe.
         self.interpreter.pipe.create('mf', 'mf')
+
+
+    def test_align_molecules(self):
+        """Test of the sequence.align user function."""
+
+        # Path of the structure file.
+        path = status.install_path + 
sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'cam'
+
+        # Load the two rotated structures.
+        self.interpreter.structure.read_pdb('1J7P_1st_NH.pdb', dir=path, 
set_model_num=1, set_mol_name='CaM A')
+        self.interpreter.structure.read_pdb('1J7P_1st_NH_rot.pdb', dir=path, 
set_model_num=1, set_mol_name='CaM B')
+
+        # Perform the alignment.
+        self.interpreter.sequence.align(msa_algorithm='Central Star', 
algorithm='NW70', matrix='BLOSUM62', gap_open_penalty=10.0, 
gap_extend_penalty=1.0, end_gap_open_penalty=0.5, end_gap_extend_penalty=0.1)
+
+        # Save the relax state.
+        self.tmpfile = mktemp()
+        self.interpreter.state.save(self.tmpfile, dir=None, force=True)
+
+        # Reset relax.
+        self.interpreter.reset()
+
+        # Load the results.
+        self.interpreter.state.load(self.tmpfile)
+
+        # The real data.
+        object_ids = ['mf', 'mf']
+        models = [1, 1]
+        molecules = ['CaM A', 'CaM B']
+        sequences = [
+            
'EEEIREAFRVFDKDGNGYISAAELRHVMTNLGEKLTDEEVDEMIREADIDGDGQVNYEEFVQMMTAK***',
+            
'EEEIREAFRVFDKDGNGYISAAELRHVMTNLGEKLTDEEVDEMIREADIDGDGQVNYEEFVQMMTAK***'
+        ]
+        strings = [
+            
'EEEIREAFRVFDKDGNGYISAAELRHVMTNLGEKLTDEEVDEMIREADIDGDGQVNYEEFVQMMTAK***',
+            
'EEEIREAFRVFDKDGNGYISAAELRHVMTNLGEKLTDEEVDEMIREADIDGDGQVNYEEFVQMMTAK***'
+        ]
+        gaps = []
+        for i in range(len(strings)):
+            gaps.append([])
+            for j in range(len(strings[0])):
+                gaps[i].append(0)
+        msa_algorithm = 'Central Star'
+        pairwise_algorithm = 'NW70'
+        matrix = 'BLOSUM62'
+        gap_open_penalty = 10.0
+        gap_extend_penalty = 1.0
+        end_gap_open_penalty = 0.5
+        end_gap_extend_penalty = 0.1
+
+        # Check the data.
+        for i in range(2):
+            print("Checking \"%s\"" % molecules[i])
+            self.assertEqual(ds.sequence_alignments[0].ids[i], ids[i])
+            self.assertEqual(ds.sequence_alignments[0].object_ids[i], 
object_ids[i])
+            self.assertEqual(ds.sequence_alignments[0].models[i], models[i])
+            self.assertEqual(ds.sequence_alignments[0].molecules[i], 
molecules[i])
+            self.assertEqual(ds.sequence_alignments[0].sequences[i], 
sequences[i])
+            self.assertEqual(ds.sequence_alignments[0].strings[i], 
strings[i])
+            self.assertEqual(ds.sequence_alignments[0].gaps[i], gaps[i])
+            self.assertEqual(ds.sequence_alignments[0].msa_algorithm, 
msa_algorithm)
+            self.assertEqual(ds.sequence_alignments[0].pairwise_algorithm, 
pairwise_algorithm)
+            self.assertEqual(ds.sequence_alignments[0].matrix, matrix)
+            self.assertEqual(ds.sequence_alignments[0].gap_open_penalty, 
gap_open_penalty)
+            self.assertEqual(ds.sequence_alignments[0].gap_extend_penalty, 
gap_extend_penalty)
+            self.assertEqual(ds.sequence_alignments[0].end_gap_open_penalty, 
end_gap_open_penalty)
+            
self.assertEqual(ds.sequence_alignments[0].end_gap_extend_penalty, 
end_gap_extend_penalty)
 
 
     def test_load_protein_asp_atoms_from_pdb(self):




Related Messages


Powered by MHonArc, Updated Fri Jan 30 13:00:02 2015