bx-python / lib / bx / align / tools / tile.py

Diff from to

lib/bx/align/tools/tile.py

     """
     Tile maf blocks onto an interval. The resulting block will span the interval
     exactly and contain the column from the highest scoring alignment at each
-    position. 
-    
+    position.
+
     `sources`: list of sequence source names to include in final block
     `index`: an instnace that can return maf blocks overlapping intervals
     `ref_src`: source name of the interval (ie, hg17.chr7)
     base_len = end - start
     blocks = index.get( ref_src, start, end )
     # From low to high score
-    blocks.sort( lambda a, b: cmp( a.score, b.score ) )
+    blocks.sort(key=lambda t: t.score)
     mask = [ -1 ] * base_len
     ref_src_size = None
     for i, block in enumerate( blocks ):
         for j in range( slice_start, slice_end ):
             mask[j-start] = i
     tiled = []
-    for i in range( len( sources ) ): 
+    for i in range( len( sources ) ):
         tiled.append( [] )
     for ss, ee, index in intervals_from_mask( mask ):
         # Interval with no covering alignments
             slice_end = start + ee
             block = blocks[index]
             ref = block.get_component_by_src_start( ref_src )
-            sliced = block.slice_by_component( ref, slice_start, slice_end ) 
+            sliced = block.slice_by_component( ref, slice_start, slice_end )
             sliced = sliced.limit_to_species( sources )
             sliced.remove_all_gap_columns()
             for i, src in enumerate( sources ):
                 if comp:
                     tiled[i].append( comp.text )
                 else:
-                    tiled[i].append( "-" * sliced.text_size )        
+                    tiled[i].append( "-" * sliced.text_size )
     return [ "".join( t ) for t in tiled ]
 
 def intervals_from_mask( mask ):
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.