olgert denas  committed 8037142

check cached chains are up to date and int chain score

  • Participants
  • Parent commits 4eebabf
  • Branches default

Comments (0)

Files changed (2)

File lib/bx/align/

     __slots__ = ()
     def __str__(self):
-        return "chain 0 {tName} {tSize} {tStrand} {tStart} {tEnd} {qName} {qSize} {qStrand} {qStart} {qEnd} {id}".format(**self._asdict())
+        return "chain {score} {tName} {tSize} {tStrand} {tStart} {tEnd} {qName} {qSize} {qStrand} {qStart} {qEnd} {id}".format(**self._asdict())
     def _strfactory(cls, line):
         line = line.rstrip().split()[1:] # the first component is the keyword "chain"
         tup = map(lambda t: t[0](t[1]),
-                zip([float, str, int, str, int, int, str, int, str, int, int, str], line))
+                zip([int, str, int, str, int, int, str, int, str, int, int, str], line))
         return tuple.__new__(cls, tup)
             log.debug("loading pickled file %s ..." % fname)
             return cPickle.load( open(fname) )
         elif os.path.isfile("%s.pkl" % fname):
-            log.warning("loading pickled file %s.pkl ..." % fname)
+  "loading pickled file %s.pkl ..." % fname)
+            if os.stat(fname).st_mtime > os.stat("%s.pkl" % fname).st_mtime:
+                log.critical("*** pickled file %s.pkl is not up to date ***" % (fname))
             return cPickle.load( open("%s.pkl" % fname) )
         data = fastLoadChain(fname, cls._strfactory)

File scripts/

 from bx.align.epo import bed_union as elem_u
 elem_t = np.dtype([('chrom', np.str_, 30), ('start', np.int64), ('end', np.int64), ('id', np.str_, 100)])
-LOG_LEVELS = {"info" : logging.INFO, "debug" : logging.DEBUG, "silent" : logging.CRITICAL}
+LOG_LEVELS = {"info" : logging.INFO, "debug" : logging.DEBUG, "silent" : logging.ERROR}
 log = logging.getLogger()
     parser = argparse.ArgumentParser(description=__doc__, epilog="Olgert Denas (Taylor Lab)",
-    parser.add_argument("input", nargs='*',
+    parser.add_argument("input", nargs='+',
             help="Input to process. If more than a file is specified, all files will be mapped and placed on --output, which should be a directory.")
     parser.add_argument("alignment", help="Alignment file (.chain or .pkl)")