Commits

James Taylor committed ef58806

Two fixes for align.tools from Thomas Mailund

Comments (0)

Files changed (2)

lib/bx/align/tools/fuse.py

     """
     Try to fuse a list of blocks by progressively fusing each adjacent pair.
     """
-    rval = []
     last = None
     for m in mafs:
         if last is None:
             if fused:
                 last = fused
             else:
-                rval.append( last )
+                yield last
                 last = m
-    if last: rval.append( last )
-    return rval
+    if last:
+        yield last
 
 def fuse( m1, m2 ):
     """
                 self.last = m
     def close( self ):
         if self.last: self.maf_writer.write( self.last )
-        self.maf_writer.close()
+        self.maf_writer.close()

lib/bx/align/tools/thread.py

     <BLANKLINE>
     
     """
-    new = []
     for m in mafs:
         new_maf = deepcopy( m )
         new_components = get_components_for_species( new_maf, species )	
             remove_all_gap_columns( new_components )          
             new_maf.components = new_components
             new_maf.score = 0.0
-            new.append( new_maf )   
-    return new
+            new_maf.text_size = len(new_components[0].text)
+            yield new_maf
         
 def get_components_for_species( alignment, species ):
     """Return the component for each species in the list `species` or None"""
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.