Author: bugman
Date: Wed Jan 21 15:52:03 2015
New Revision: 27259
URL: http://svn.gna.org/viewcvs/relax?rev=27259&view=rev
Log:
Created a unit test for lib.sequence_alignment.align_protein.align_pairwise().
This is to test the pairwise alignment of two protein sequences using the
Needleman-Wunsch sequence
alignment algorithm, BLOSUM62 substitution matrix, and gap penalty of 10.0.
Added:
trunk/test_suite/unit_tests/_lib/_sequence_alignment/test_align_protein.py
- copied, changed from r27254,
trunk/test_suite/unit_tests/_lib/_sequence_alignment/test_needleman_wunsch.py
Copied:
trunk/test_suite/unit_tests/_lib/_sequence_alignment/test_align_protein.py
(from r27254,
trunk/test_suite/unit_tests/_lib/_sequence_alignment/test_needleman_wunsch.py)
URL:
http://svn.gna.org/viewcvs/relax/trunk/test_suite/unit_tests/_lib/_sequence_alignment/test_align_protein.py?p2=trunk/test_suite/unit_tests/_lib/_sequence_alignment/test_align_protein.py&p1=trunk/test_suite/unit_tests/_lib/_sequence_alignment/test_needleman_wunsch.py&r1=27254&r2=27259&rev=27259&view=diff
==============================================================================
---
trunk/test_suite/unit_tests/_lib/_sequence_alignment/test_needleman_wunsch.py
(original)
+++ trunk/test_suite/unit_tests/_lib/_sequence_alignment/test_align_protein.py
Wed Jan 21 15:52:03 2015
@@ -20,39 +20,62 @@
###############################################################################
# Python module imports.
+from numpy import int16, zeros
from unittest import TestCase
# relax module imports.
-from lib.sequence_alignment.needleman_wunsch import needleman_wunsch_align
+from lib.sequence_alignment.align_protein import align_pairwise
-class Test_needleman_wunsch(TestCase):
- """Unit tests for the lib.sequence_alignment.needleman_wunsch relax
module."""
+class Test_align_protein(TestCase):
+ """Unit tests for the lib.sequence_alignment.align_protein relax module."""
- def test_needleman_wunsch_align_DNA(self):
- """Test the Needleman-Wunsch sequence alignment for two DNA
sequences."""
+ def test_align_pairwise(self):
+ """Test the Needleman-Wunsch sequence alignment for two protein
sequences.
+
+ This uses the sequences:
+
+ - 'IHAAEEKDWKTAYSYbgFYEAFEGYdsidspkaitslkymllckimlntpedvqalvsgkla',
+ -
'LHAADEKDFKTAFSYabiggapFYEAFEGYdsvdekvsaltalkymllckvmldlpdevnsllsakl'.
+
+ From online servers, the results should be::
+
+ https://www.ebi.ac.uk/Tools/psa/emboss_needle/
+ EMBOSS_001
IHAAEEKDWKTAYSY-B-G---FYEAFEGYDSIDSP-KAITSLKYMLLCKIMLNTPEDVQALVSGKLA
+ :|||:|||:|||:|| | | ||||||||||:|..
.|:|:||||||||:||:.|::|.:|:|.||
+ EMBOSS_001
LHAADEKDFKTAFSYABIGGAPFYEAFEGYDSVDEKVSALTALKYMLLCKVMLDLPDEVNSLLSAKL-
+
+ http://web.expasy.org/cgi-bin/sim/sim.pl?prot
+ UserSeq1
IHAAEEKDWKTAYSY-B-G---FYEAFEGYDSIDSP-KAITSLKYMLLCKIMLNTPEDVQALVSGKL
+ UserSeq2
LHAADEKDFKTAFSYABIGGAPFYEAFEGYDSVDEKVSALTALKYMLLCKVMLDLPDEVNSLLSAKL
+ *** *** *** ** * * ********** * * *
******** ** * * * * **
+ """
# The sequences.
- seq1 = 'GCATGCU'
- seq2 = 'GATTACA'
+ seq1 = 'IHAAEEKDWKTAYSYbgFYEAFEGYdsidspkaitslkymllckimlntpedvqalvsgkla'
+ seq2 =
'LHAADEKDFKTAFSYabiggapFYEAFEGYdsvdekvsaltalkymllckvmldlpdevnsllsakl'
print(seq1)
print(seq2)
# Perform the alignment.
- align1, align2, gaps = needleman_wunsch_align(seq1, seq2)
+ align1, align2, gaps = align_pairwise(seq1, seq2, matrix='BLOSUM62',
gap_penalty=10.0)
print(align1)
print(align2)
print(gaps)
# Check the alignment.
- self.assertEqual(align1, 'GCA-TGCU')
- self.assertEqual(align2, 'G-ATTACA')
+ self.assertEqual(align1,
'IHAAEEKDWKTAYSY-B-G---FYEAFEGYDSIDSP-KAITSLKYMLLCKIMLNTPEDVQALVSGKLA')
+ self.assertEqual(align2,
'LHAADEKDFKTAFSYABIGGAPFYEAFEGYDSVDEKVSALTALKYMLLCKVMLDLPDEVNSLLSAKL-')
# The gap matrix.
- real_gaps = [
- [0, 0, 0, 1, 0, 0, 0, 0],
- [0, 1, 0, 0, 0, 0, 0, 0]
- ]
+ real_gaps = zeros((2, 68), int16)
+ real_gaps[0, 15] = 1
+ real_gaps[0, 17] = 1
+ real_gaps[0, 19] = 1
+ real_gaps[0, 20] = 1
+ real_gaps[0, 21] = 1
+ real_gaps[0, 36] = 1
+ real_gaps[1, 67] = 1
for i in range(2):
- for j in range(8):
+ for j in range(68):
self.assertEqual(gaps[i, j], real_gaps[i][j])
_______________________________________________
relax (http://www.nmr-relax.com)
This is the relax-commits mailing list
[email protected]
To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-commits