bx-python / scripts / bnMapper.py

Diff from to


     BED12_FRM = "%s\t%d\t%d\t%s\t1000\t+\t%d\t%d\t0,0,0\t%d\t%s\t%s\n"
     assert len( set(from_elem_list['chrom']) ) <= 1
+    mapped_elem_count = 0
     for from_elem in from_elem_list:
         matching_block_ids = map(attrgetter("value"), tree.find(chrom, from_elem['start'], from_elem['end']))
         # if to_species had insertions you can join elements
         to_elem_list = sorted(union_elements(to_elem_slices), key=lambda a: a[1])
         if to_elem_list:
+            mapped_elem_count += 1
             log.debug("\tjoined to %d elements" % (len(to_elem_list)))
             if opt.format == "BED4":
                 map(lambda tel: out_fd.write(BED4_FRM % tel), to_elem_list)
                         ",".join( map(lambda e: "%d" % (e[2]-e[1]), to_elem_list) ),
                         ",".join( map(lambda e: "%d" % (e[1]-start), to_elem_list) ) )
+    log.info("%s %d of %d elements mapped" % (chrom, mapped_elem_count, from_elem_list.shape[0]))
 def transform_file(ELEMS, ofname, EPO, TREE, opt):
     "transform/map the elements of this file and dump the output on 'ofname'"
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.