diff test.py @ 2:46fb79167a61 tip

Main Code
author Victor Padilla <victor.padilla.mc@gmail.com>
date Mon, 04 May 2015 22:56:18 +0200
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test.py	Mon May 04 22:56:18 2015 +0200
@@ -0,0 +1,29 @@
+'''
+@organization: Lancaster University & University of Leeds
+@version: 1.0
+Created on 11/12/2014
+
+@author: Victor Padilla
+@contact: v.padilla@lancaster.ac.uk
+
+test file for checking
+'''
+
+from MultipleOMR.Alignment import FastAlignmentArrays  
+from MultipleOMR.Alignment import NWunsch
+ 
+a=["foo00","abc","123"]
+b=["foo000","abc","1234"]
+
+# a=['TS:3/8', 'CL:G', 'KS:0', u'N:C5_0.125', '!', u'N:B4_1.0', u'N:A4_0.5', '!', 'R:1.5', '!', 'R:0.5', u'N:F5_0.25', u'N:D5_0.25', u'N:E5_0.25', u'N:F5_0.25', '!', u'N:D5_0.25', u'N:E5_0.25', u'N:F5_0.5', u'N:G5_0.5', '!', u'N:E5_0.5', '!', 'KS:-3', 'R:0.5', u'N:E-5_0.25', u'N:C5_0.25', u'N:D5_0.25', u'N:E-5_0.25', '!', u'N:C5_0.25', u'N:D5_0.25', u'N:E-5_0.5', u'N:F5_0.5', '!', u'N:D5_0.5', u'N:B-4_0.5', u'N:B-5_0.5', '!', u'N:B-5_0.5', u'N:G5_0.5', u'N:F5_0.25', '!', 'R:1.5', '!', u'N:B-4_1.0', '!', 'R:1.0', 'KS:0', u'N:E3_0.25', u'N:C3_0.25', '!', 'CL:F', u'N:D3_0.5', 'R:0.5', 'R:0.5', '!', u'N:D3_0.5', u'N:D4_0.5', u'N:D4_0.5', '!', 'R:0.25', u'N:B3_0.5', u'N:A3_0.25', u'N:G3_0.25', u'N:F3_0.25', '!', u'N:E3_0.25', '!', 'R:1.5', '!', 'KS:-3', u'N:B-4_1.0', u'N:C5_0.25', u'N:A4_0.25', '!', 'CL:G', u'C:[:A-4_0.5[:A-5_0.5', u'C:[:G4_0.5[:G5_0.5', u'C:[:B-4_0.5[:B-5_0.5', '!', u'N:D5_1.0', u'N:G5_2.0', '!', u'N:E-5_0.25', u'N:C5_0.25', u'C:[:A-4_0.5[:A-5_0.5', u'C:[:G4_0.5[:G5_0.5', '!', u'C:[:B-4_0.5[:B-5_0.5', '!', u'N:D5_1.0', u'N:G5_2.0', '!', u'N:E-5_0.25', u'N:C5_0.25', u'N:B-4_0.25', u'N:D5_0.25', u'N:F5_0.25', u'N:B-5_0.25', '!', u'N:F5_0.25', u'N:D5_0.25', u'N:E-5_0.25', u'N:C5_0.25', u'N:A4_0.25', u'N:B-4_0.25', '!', u'N:D5_0.25', u'N:F4_0.25', u'N:B-4_0.25', u'N:F4_0.25', u'N:D4_0.25', u'N:E-4_0.25', '!', u'N:C4_0.25', u'N:A3_0.25', u'N:B-3_0.5', 'R:0.5', '!', u'C:[:F3_0.5[:B-3_0.5', u'C:[:F3_0.5[:B-3_0.5', 'R:0.5', '!', 'R:0.5', '!', 'R:0.25', u'N:A4_0.25', u'N:B-4_0.25', u'N:C5_0.25', u'N:A4_0.25', u'N:B-4_0.25', '!', u'N:C5_0.25', u'N:A4_0.25', u'N:B-4_0.25', u'N:B-5_1.0', '!', u'N:D5_0.5', u'N:E-5_0.25', u'N:A4_0.25', u'N:B-4_0.25', u'N:C5_0.25', '!', u'N:A4_0.25', u'N:B-4_0.25', u'N:C5_0.25', u'N:A4_0.25', u'N:B-4_0.25', u'N:B-5_1.0', '!', u'N:E5_0.5', '!', u'N:F5_0.25', u'N:A4_0.25', u'N:B-4_0.25', u'N:C5_0.25', u'N:A4_0.25', u'N:B-4_0.25', '!', u'N:C5_0.25', u'N:A4_0.25', u'N:B-4_0.25', u'N:B-5_1.0', '!', u'N:F5_0.5', 'R:0.5', u'N:G-5_0.5', '!', u'N:E-5_0.5', 'R:0.5', u'N:E-5_0.5', '!', u'N:A4_0.5', 'R:0.5', u'N:B-4_0.5', '!', u'N:D5_0.5', u'N:F5_0.5', u'N:A5_0.5', '!', u'N:B-5_0.5', '!', u'N:B-4_0.5', u'C:[:D4_0.5[:A-4_0.5', '!', u'C:[:D4_0.5[:A-4_0.5', 'R:0.5', 'R:0.5', '!', 'R:0.5', 'R:0.5', u'N:B-5_0.25', u'N:G5_0.5', u'N:C6_0.25', u'N:B-5_0.25', u'N:F5_0.5', u'N:A-5_0.25', '!', u'N:B-5_0.25', u'N:E-5_0.5', u'N:A-5_0.25', u'N:G5_0.25', u'N:D5_0.5', u'N:A-5_0.25', u'N:G5_0.25', u'N:F5_0.25', '!', u'N:G5_0.25', u'N:C5_0.5', u'N:F5_0.25', u'N:E-5_0.25', u'N:B-4_0.5', u'N:F5_0.25', u'N:E-5_0.25', u'N:D5_0.25', '!', u'N:E-5_0.25', u'N:A-4_0.5', u'N:D5_0.25', u'N:C5_0.25', u'N:G4_0.5', u'N:D5_0.25', u'N:C5_0.25', u'N:B-4_0.5', '!', u'N:B-4_1.5', u'N:F4_0.5', u'N:E-4_0.5', u'N:D4_0.5', '!', u'C:[:D4_0.5[:B-4_0.5', u'C:[:E-4_0.5[:C5_0.5', u'C:[:F4_0.5[:D5_0.5', '!', u'N:E-5_0.25', u'N:G4_1.0', u'N:G5_0.375', u'N:F5_0.25', u'N:E-5_0.25', u'N:D5_0.25', u'N:E-5_0.25', '!', u'N:G4_1.0', u'C:[:A-4_0.5[:C5_0.5', u'N:D5_0.25', u'N:C5_0.25', u'N:B-4_1.0', '!', u'N:A-4_0.25', u'N:F4_0.5', u'N:G4_0.125', u'N:A-4_0.125', u'N:G4_0.5', u'N:D5_0.5', '!', u'N:E-5_0.5', '!', 'R:0.5', u'N:B-5_0.5', u'N:G5_0.5', '!', 'R:0.25', u'N:F5_0.25', u'N:G5_0.25', u'N:A-5_0.25', u'N:B-5_0.25', u'N:C6_0.25', '!', u'N:C6_0.25', u'N:B-5_0.25', u'N:A-5_0.25', u'N:G5_0.25', u'N:F5_0.25', u'N:D5_0.25', '!', u'N:E-5_0.25', u'N:B-4_0.25', u'N:G4_0.25', u'N:B-4_0.25', u'N:G4_0.25', u'N:E-4_0.25', '!', u'N:D4_0.25', u'N:F4_0.25', u'N:A-4_0.25', u'N:G4_0.25', u'N:B-4_0.25', u'N:G4_0.25', '!', u'N:E-5_0.25', u'N:B-4_0.25', u'N:G4_0.25', u'N:A-4_0.25', u'N:F4_0.25', u'N:D4_0.25', '!', u'N:E-4_0.5', 'R:0.5', u'C:[:B-3_0.5[:E-4_0.5', '!', u'C:[:B-3_0.5[:E-4_0.5', 'R:0.5', 'R:0.5', '!', u'N:E-5_0.5', u'N:E-5_0.125', u'N:F5_0.125', u'N:E-5_0.125', u'N:D-5_0.125', u'N:C5_0.5', '!', 'R:0.5', u'N:A-5_0.5', u'N:A-5_0.5', '!', u'N:G5_0.5', u'N:G5_0.125', u'N:A-5_0.125', u'N:B-5_0.125', u'N:A-5_0.125', u'N:G5_0.5', '!', 'R:0.5', u'N:D-6_0.5', u'N:D-6_0.5', '!', u'N:C6_0.5', u'N:C6_0.125', u'N:C6_1.0', u'N:D6_0.125', u'N:E-6_0.125', u'N:D6_0.125', u'N:C6_0.5', '!', 'R:0.5', 'KS:0', '!', u'N:F5_0.5', 'R:1.0', '!', u'N:F5_0.5', u'N:F5_0.25', '!', 'R:1.5', '!', 'R:1.5', '!', u'N:G4_0.5', 'KS:-3', 'R:0.5', u'N:G5_0.5', '!', u'N:F5_0.5', 'KS:0', 'R:0.5', u'N:A5_0.5', '!', 'R:0.5', u'N:C6_0.5', u'N:B-5_0.125', u'N:A5_0.125', u'N:G5_0.125', u'N:F5_0.125', '!', u'N:E5_1.0', u'N:D5_0.5', '!', 'R:4.0', '!', 'R:0.5', 'R:0.5', u'N:B5_0.25', u'N:G5_0.25', u'N:A5_0.25', u'N:B5_0.25', '!', 'R:0.5', u'N:G5_0.25', u'N:A5_0.25', '!', 'KS:-3', u'N:B-5_0.5', u'N:C6_0.5', u'N:A-5_0.5', '!', 'R:0.5', u'N:A-5_0.25', u'N:F5_0.25', u'N:G5_0.25', u'N:A-5_0.25', '!', u'N:F5_0.25', u'N:G5_0.25', u'N:A-5_0.5', u'N:B-5_0.5', '!', u'N:G5_0.5', u'N:E-5_0.5', u'N:E-6_0.5', '!', u'N:E-6_0.5', u'N:C6_0.5', '!', 'R:1.5', '!', u'N:E-5_1.0', u'N:A-5_2.0', '!', u'N:F5_0.25', u'N:D5_0.25', u'N:E-5_0.5', 'R:0.5', '!', 'R:0.5', u'N:B-4_0.5', u'N:G5_0.25', u'N:D5_0.25', '!', u'N:E-5_0.25', u'N:G5_0.25', u'N:D5_0.25', u'N:E-5_0.25', u'N:C5_0.5', '!', u'N:B-4_0.25', u'N:A-4_0.25', u'N:G4_0.25', u'N:F4_0.25', '!', u'N:E-4_1.0', u'N:A-4_2.0', '!', u'N:F4_0.25', u'N:D4_0.25', u'C:[:D-4_0.5[:D-5_0.5', u'C:[:C4_0.5[:C5_0.5', '!', u'C:[:E-4_0.5[:E-5_0.5', u'N:G4_1.0', '!', u'N:C5_2.0', '!', u'N:A-4_0.25', u'N:F4_0.25', u'C:[:D-5_0.5[:D-6_0.5', u'C:[:C5_0.5[:C6_0.5', '!', u'C:[:E-5_0.5[:E-6_0.5', '!', u'N:G5_1.0', u'N:C6_3.0', '!', u'N:A-5_0.25', u'N:F5_0.25', u'N:E-5_0.25', u'N:G5_0.25', u'N:B-5_0.25', u'N:E-6_0.25', '!', u'N:B-5_0.25', u'N:G5_0.25', u'N:A-5_0.25', u'N:F5_0.25', u'N:D5_0.25', u'N:E-5_0.25', '!', u'N:G5_0.25', u'N:B-4_0.25', u'N:E-5_0.25', u'N:B-4_0.25', u'N:G4_0.25', u'N:A-4_0.25', '!', u'N:F4_0.25', u'N:D4_0.25', u'N:E-4_0.5', 'R:0.5', '!', u'C:[:B-3_0.5[:E-4_0.5', u'C:[:B-3_0.5[:E-4_0.5', 'R:0.5', '!', 'R:0.5', '!']
+# b=['TS:3/8', 'CL:G', 'KS:-3', 'R:0.5', u'N:G5_0.5', u'N:F5_0.125', u'N:E-5_0.125', u'N:D5_0.125', u'N:C5_0.125', '!', u'N:B-4_1.0', u'N:A4_0.5', '!', 'R:1.5', '!', 'R:0.5', u'N:F5_0.25', u'N:D5_0.25', u'N:E-5_0.25', u'N:F5_0.25', u'N:D5_0.25', u'N:E-5_0.25', '!', u'N:F5_0.5', u'N:G5_0.5', u'N:E-5_0.5', '!', 'KS:-3', 'R:0.5', u'N:E-5_0.25', u'N:C5_0.25', u'N:D5_0.25', u'N:E-5_0.25', u'N:C5_0.25', u'N:D5_0.25', '!', u'N:E-5_0.5', u'N:F5_0.5', u'N:D5_0.5', '!', u'N:B-4_0.5', u'N:B-5_0.5', u'N:B-5_0.5', '!', u'N:G5_0.5', u'N:F5_0.25', u'N:E-5_0.25', u'N:D5_0.25', u'N:C5_0.25', '!', 'KS:-3', u'N:B-4_1.0', u'N:C5_0.25', u'N:A4_0.25', '!', u'N:B-4_0.5', 'R:0.5', 'R:0.5', '!', u'N:B-4_0.5', u'N:B-5_0.5', u'N:B-5_0.5', '!', u'N:G5_0.5', u'N:F5_0.25', u'N:E-5_0.25', u'N:D5_0.25', u'N:C5_0.25', '!', 'KS:-3', u'N:B-4_1.0', u'N:C5_0.25', u'N:A4_0.25', '!', u'C:[:A-4_0.5[:A-5_0.5', u'C:[:G4_0.5[:G5_0.5', u'C:[:B-4_0.5[:B-5_0.5', '!', u'N:D5_1.0', u'N:E-5_0.25', u'N:C5_0.25', '!', u'C:[:A-4_0.5[:A-5_0.5', u'C:[:G4_0.5[:G5_0.5', u'C:[:B-4_0.5[:B-5_0.5', '!', 'KS:-3', u'N:D5_1.0', 'R:0.5', '!', u'N:B-4_0.25', u'N:D5_0.25', u'N:F5_0.25', u'N:B-5_0.25', u'N:F5_0.25', u'N:D5_0.25', u'N:E-5_0.25', u'N:C5_0.25', u'N:A4_0.25', '!', u'N:B-4_0.25', u'N:D5_0.25', u'N:F4_0.25', u'N:B-4_0.25', u'N:F4_0.25', u'N:D4_0.25', u'N:E-4_0.25', u'N:C4_0.25', u'N:A3_0.25', '!', u'N:B-3_0.5', 'R:0.5', u'C:[:F3_0.5[:B-3_0.5', '!', u'C:[:F3_0.5[:B-3_0.5', 'R:0.5', 'R:0.5', '!', 'KS:-3', 'R:1.5', '!', 'R:0.25', u'N:A4_0.25', u'N:B-4_0.25', u'N:C5_0.25', u'N:A4_0.25', u'N:B-4_0.25', u'N:C5_0.25', u'N:A4_0.25', u'N:B-4_0.25', '!', u'N:B-5_1.0', u'N:D5_0.5', '!', u'N:E-5_0.25', u'N:A4_0.25', u'N:B-4_0.25', u'N:C5_0.25', u'N:A4_0.25', u'N:B-4_0.25', u'N:C5_0.25', u'N:A4_0.25', u'N:B-4_0.25', '!', u'N:B-5_1.0', u'N:E5_0.5', '!', 'KS:-3', u'N:F5_0.25', u'N:A4_0.25', u'N:B-4_0.25', u'N:C5_0.25', u'N:A4_0.25', u'N:B-4_0.25', u'N:C5_0.25', u'N:A4_0.25', u'N:B-4_0.25', '!', u'N:B-5_1.0', u'N:F5_0.5', '!', 'R:0.5', u'N:G-5_0.5', u'N:E-5_0.5', '!', 'R:0.5', u'N:E-5_0.5', u'N:A4_0.5', '!', 'R:0.5', u'N:B-4_0.5', u'N:D5_0.5', '!', u'N:F5_0.5', u'N:A5_0.5', u'N:B-5_0.5', '!', 'KS:-3', u'N:B-4_0.5', 'R:0.5', u'C:[:D4_0.5[:A-4_0.5', '!', u'C:[:D4_0.5[:A-4_0.5', 'R:0.5', 'R:0.5', '!', 'R:0.5', 'R:0.5', u'N:B-5_0.25', u'N:G5_0.5', u'N:C6_0.25', u'N:B-5_0.25', u'N:A-5_0.25', u'N:F5_0.5', u'N:B-5_0.25', u'N:A-5_0.25', '!', u'N:G5_0.25', u'N:E-5_0.5', u'N:A-5_0.25', u'N:G5_0.25', u'N:F5_0.25', u'N:D5_0.5', u'N:G5_0.25', u'N:F5_0.25', u'N:E-5_0.25', u'N:C5_0.5', u'N:F5_0.25', u'N:E-5_0.25', '!', u'N:D5_0.25', u'N:B-4_0.5', u'N:E-5_0.25', u'N:D5_0.25', u'N:C5_0.25', u'N:A-4_0.5', u'N:D5_0.25', u'N:C5_0.25', u'N:B-4_0.5', u'N:G4_0.5', '!', u'N:B-4_1.5', u'N:F4_0.5', 'KS:-3', u'N:E-4_0.5', u'N:D4_0.5', '!', u'N:E-5_0.25', u'N:G4_1.0', u'N:G5_0.25', u'N:F5_0.25', u'N:E-5_0.25', u'N:D5_0.25', u'N:E-5_0.25', u'N:C5_0.25', u'N:A-4_0.5', u'N:D5_0.25', u'N:C5_0.25', '!', u'N:B-4_1.0', u'N:G4_1.0', u'N:A-4_0.25', u'N:F4_0.5', u'N:G4_0.125', u'N:A-4_0.125', '!', u'N:G4_0.5', u'N:D5_0.5', u'N:E-5_0.5', '!', 'KS:-3', 'R:0.5', u'N:B-5_0.5', u'N:G5_0.5', '!', 'R:0.25', u'N:F5_0.25', u'N:G5_0.25', u'N:A-5_0.25', u'N:B-5_0.25', u'N:C6_0.25', '!', u'N:C6_0.25', u'N:B-5_0.25', u'N:A-5_0.25', u'N:G5_0.25', u'N:F5_0.25', u'N:D5_0.25', '!', u'N:E-5_0.25', u'N:B-4_0.25', u'N:G4_0.25', u'N:B-4_0.25', u'N:G4_0.25', u'N:E-4_0.25', u'N:D4_0.25', u'N:F4_0.25', u'N:A-4_0.25', '!', u'N:G4_0.25', u'N:B-4_0.25', u'N:G4_0.25', u'N:E-5_0.25', u'N:B-4_0.25', u'N:G4_0.25', u'N:A-4_0.25', u'N:F4_0.25', u'N:D4_0.25', '!', u'N:E-4_0.5', 'R:0.5', u'C:[:B-3_0.5[:E-4_0.5', '!', 'KS:-3', u'C:[:B-3_0.5[:E-4_0.5', 'R:0.5', 'R:0.5', '!', u'N:E-5_0.5', u'N:E-5_0.125', u'N:F5_0.125', u'N:E-5_0.125', u'N:D-5_0.125', u'N:C5_0.5', '!', 'R:0.5', u'N:A-5_0.5', u'N:A-5_0.5', '!', u'N:G5_0.5', u'N:G5_0.125', u'N:A-5_0.125', u'N:B-5_0.125', u'N:A-5_0.125', u'N:G5_0.5', '!', 'R:0.5', u'N:D-6_0.5', u'N:D-6_0.5', '!', 'KS:-3', u'N:C6_0.5', u'N:C6_0.125', u'N:D-6_0.125', u'N:E-6_0.125', u'N:D-6_0.125', u'N:C6_0.5', '!', 'R:0.5', u'N:F5_0.5', u'N:F5_0.5', '!', u'N:F5_0.25', u'N:E5_0.25', u'N:G5_0.25', u'N:E5_0.25', u'N:C5_0.25', u'N:B-4_0.25', '!', u'N:A-4_0.5', 'R:0.5', u'N:E-5_0.5', '!', u'N:E-5_0.25', u'N:D5_0.25', u'N:F5_0.25', u'N:D5_0.25', u'N:B-4_0.25', u'N:A-4_0.25', '!', 'KS:-3', u'N:G4_0.5', 'R:0.5', u'N:G5_0.5', '!', u'N:F5_0.5', 'R:0.5', u'N:A-5_0.5', '!', 'R:0.5', u'N:C6_0.5', u'N:B-5_0.125', u'N:A-5_0.125', u'N:G5_0.125', u'N:F5_0.125', '!', u'N:E-5_1.0', u'N:D5_0.5', '!', 'R:1.5', '!', 'R:0.5', u'N:B-5_0.25', u'N:G5_0.25', u'N:A-5_0.25', u'N:B-5_0.25', u'N:G5_0.25', u'N:A-5_0.25', '!', 'KS:-3', u'N:B-5_0.5', u'N:C6_0.5', u'N:A-5_0.5', '!', 'R:0.5', u'N:A-5_0.375', u'N:F5_0.25', u'N:G5_0.25', 'R:0.125', '!', u'N:A-5_0.5', u'N:B-5_0.5', u'N:G5_0.5', '!', u'N:E-5_0.5', u'N:E-6_0.5', u'N:E-6_0.5', '!', u'N:C6_0.5', u'N:B-5_0.25', u'N:A-5_0.25', u'N:G5_0.25', u'N:F5_0.25', '!', 'KS:-3', u'N:E-5_1.0', 'R:0.5', '!', u'N:E-5_0.5', 'R:0.5', 'R:0.5', '!', u'N:B-4_0.5', u'N:G5_0.25', u'N:D5_0.25', u'N:E-5_0.25', u'N:G5_0.25', u'N:D5_0.25', u'N:E-5_0.25', '!', u'N:C5_0.5', u'N:B-4_0.25', u'N:A-4_0.25', u'N:G4_0.25', u'N:F4_0.25', '!', 'KS:-3', u'N:E-4_1.0', u'N:F4_0.25', u'N:D4_0.25', '!', u'C:[:D-4_0.5[:D-5_0.5', u'C:[:C4_0.5[:C5_0.5', u'C:[:E-4_0.5[:E-5_0.5', '!', u'N:G4_1.0', u'N:A-4_0.25', u'N:F4_0.25', '!', u'C:[:D-5_0.5[:D-6_0.5', u'C:[:C5_0.5[:C6_0.5', u'C:[:E-5_0.5[:E-6_0.5', '!', 'KS:-3', u'N:G5_1.0', u'N:A-5_0.25', u'N:F5_0.25', '!', u'N:E-5_0.25', u'N:G5_0.25', u'N:B-5_0.25', u'N:E-6_0.25', u'N:B-5_0.25', u'N:G5_0.25', u'N:A-5_0.25', u'N:F5_0.25', u'N:D5_0.25', '!', u'N:E-5_0.25', u'N:G5_0.25', u'N:B-4_0.25', u'N:E-5_0.25', u'N:B-4_0.25', u'N:G4_0.25', u'N:A-4_0.25', u'N:F4_0.25', u'N:D4_0.25', '!', u'N:E-4_0.5', 'R:0.5', u'C:[:B-3_0.5[:E-4_0.5', '!', u'C:[:B-3_0.5[:E-4_0.5', 'R:0.5', 'R:0.5', '!']
+
+ 
+faa=FastAlignmentArrays()
+alignment,finalValue,finalScore=faa.needleman_wunsch(a, b,isFast=False)
+print finalScore
+alignment,finalValue,finalScore=faa.needleman_wunsch(a, b,isFast=True)
+print finalScore
+score=NWunsch.NWunsch_getSimilarity(a,b)
+print score
+