def _create_h5obj(self): if self.name in self._parent: self.group = self._parent[self.name] else: gcpl = h5py.h5p.create(h5py.h5p.GROUP_CREATE) flags = h5py.h5p.CRT_ORDER_TRACKED | h5py.h5p.CRT_ORDER_INDEXED gcpl.set_link_creation_order(flags) name = self.name.encode("utf-8") gid = h5py.h5g.create(self._parent.id, name, gcpl=gcpl) self.group = h5py.Group(gid)
def create_h5group(parent, name): """ Creates an h5group with the given name under the given parent using the same flags and properties used in NIX (creation order tracking and indexing). """ gcpl = h5py.h5p.create(h5py.h5p.GROUP_CREATE) flags = h5py.h5p.CRT_ORDER_TRACKED | h5py.h5p.CRT_ORDER_INDEXED gcpl.set_link_creation_order(flags) name = name.encode("utf-8") gid = h5py.h5g.create(parent.id, name, gcpl=gcpl) return h5py.Group(gid)
def main(): logger.debug("%s starting" % sys.argv[0]) opt, args = getParms() infile_name = args[0] infile = h5py.File(infile_name, 'r') colours = ('grey', 'red', 'green') legends = ('non-seq', 'prod-0', 'prod-1') top = h5py.Group(infile, '/') ZMW = top["PulseData/BaseCalls/ZMW"] ZMWMetrics = top["PulseData/BaseCalls/ZMWMetrics"] holeStatus = ZMW["HoleStatus"] holeXY = ZMW["HoleXY"] holeProd = ZMWMetrics["Productivity"] nonseqHoles = holeStatus[:] != 0 # ZMWs other than sequencing prod0Holes = np.logical_and(holeProd[:] == 0, np.logical_not(nonseqHoles)) prod1Holes = np.logical_and(holeProd[:] == 1, np.logical_not(nonseqHoles)) holesByType = (nonseqHoles, prod0Holes, prod1Holes) for which in xrange(len(holesByType)): whichHoles = holesByType[which] howMany = sum(whichHoles) logger.debug("%5d %s" % (howMany, legends[which])) if howMany > 0: plt.scatter (holeXY[whichHoles,0], holeXY[whichHoles,1], \ s=1, c=colours[which], edgecolor='face', \ label="%5d %s" % (howMany, legends[which])) plt.axis('equal') plt.legend(scatterpoints=3, prop={'size': 8}) plt.savefig(opt.output) infile.close() logger.debug("complete")
def main(): logger.debug("%s starting" % sys.argv[0]) opt, args = getParms() infile_name = args[0] infile = h5py.File(infile_name, 'r') colours = ('#aaaaaa', '#ff0000', '#00ff00', '#0000ff', '#ff0080', '#8000ff', '#80ff00', '#ff8000', '#ffff00') holeStatusTable = ('SEQUENCING', 'ANTIHOLE', 'FIDUCIAL', 'SUSPECT', \ 'ANTIMIRROR', 'FDZMW', 'FBZMW', 'ANTIBEAMLET', 'OUTSIDEFOV') top = h5py.Group(infile, '/') ZMW = top["PulseData/BaseCalls/ZMW"] holeStatus = ZMW["HoleStatus"] holeXY = ZMW["HoleXY"] for num in xrange(len(holeStatusTable)): whichHoles = holeStatus[:] == num HowMany = sum(whichHoles) logger.debug("%5d ZMWs %d %s" % (HowMany, num, holeStatusTable[num])) if HowMany > 0: plt.scatter (holeXY[whichHoles,0], holeXY[whichHoles,1], \ s=1, c=colours[num], edgecolor='face', \ label="%d %5d %s" % (num, HowMany, holeStatusTable[num])) plt.axis('equal') plt.legend(scatterpoints=3, prop={'size': 8}) plt.savefig(opt.output) infile.close() logger.debug("complete")