author Simon Chabot Wed, 14 Nov 2012 10:27:57 +0100 changeset 130 79d506091e46 parent 129 7120da9101de child 131 ee8d9adac929
[aligner] Let the user decide on wheter return the global alignement matrix or not
 aligner.py file | annotate | diff | comparison | revisions
```--- a/aligner.py	Wed Nov 14 09:40:30 2012 +0100
+++ b/aligner.py	Wed Nov 14 10:27:57 2012 +0100
@@ -190,7 +190,7 @@

`resultfile` (default is None). Write the matched elements in a file.

-    Return the distance matrix and the matched list.
+        Return the distance matrix and the matched list.
"""
treatments = treatments or {}

@@ -228,13 +228,15 @@

def conquer_and_divide_alignment(alignset, targetset, threshold, treatments=None,
indexes=(1,1), mode='kdtree', neighbours_threshold=0.1,
-                                 n_clusters=None, kwordsgram=1, siglen=200):
+                                 n_clusters=None, kwordsgram=1, siglen=200,
+                                 get_global_mat=True):
""" Full conquer and divide method for alignment.
Compute neighbours and merge the different subalignments.
XXX
"""
global_matched = {}
-    global_mat = lil_matrix((len(alignset), len(targetset)))
+    if get_global_mat:
+        global_mat = lil_matrix((len(alignset), len(targetset)))
for alignind, targetind in findneighbours(alignset, targetset, indexes, mode,
neighbours_threshold, n_clusters, kwordsgram, siglen):
mat, matched = subalign(alignset, targetset, alignind, targetind, threshold, treatments)
@@ -243,5 +245,8 @@
for v, d in values: