--- /dev/null
+import string
+
+class Region(object):
+ """
+ Region description
+ """
+
+
+ def __init__(self, start, stop, label="", index=0, chrom="", numReads=0, foldRatio=0., multiP=0., peakDescription="", shift=0, peakPos=0, peakHeight=0):
+ self.label = label
+ self.index = index
+ self.chrom = chrom
+ self.start = start
+ self.stop = stop
+ self.numReads = numReads
+ self.foldRatio = foldRatio
+ self.multiP = multiP
+ self.peakDescription = peakDescription
+ self.shift = shift
+ self.length = abs(self.stop - self.start)
+ self.peakPos = peakPos
+ self.peakHeight = peakHeight
+
+
+ def printRegion(self, delimiter="\t"):
+ fields = ["%s%d" % (self.label, self.index),
+ "%s" % self.chrom,
+ "%d" % self.start,
+ "%d" % self.stop,
+ "%.1f" % self.numReads,
+ "%.1f" % self.foldRatio,
+ "%.1f" % self.multiP,
+ "%s" % self.peakDescription
+ ]
+
+ return string.join(fields, delimiter)
+
+
+ def printRegionWithShift(self, delimiter="\t"):
+ fields = [self.printRegion(delimiter)]
+ fields.append("%d" % self.shift)
+
+ return string.join(fields, delimiter)
+
+
+class DirectionalRegion(Region):
+ """
+ Region with percentage of plus reads.
+ """
+
+ def __init__(self, start, stop, label="", index=0, chrom="", numReads=0, foldRatio=0., multiP=0., plusP=0., leftP=0., peakDescription="", shift=0):
+ Region.__init__(self, start, stop, label, index, chrom, numReads, foldRatio, multiP, peakDescription, shift)
+ self.plusP = plusP
+ self.leftP = leftP
+
+
+ def printRegion(self, delimiter="\t"):
+ fields = ["%s%d" % (self.label, self.index),
+ "%s" % self.chrom,
+ "%d" % self.start,
+ "%d" % self.stop,
+ "%.1f" % self.numReads,
+ "%.1f" % self.foldRatio,
+ "%.1f" % self.multiP,
+ "%.1f" % self.plusP,
+ "%.1f" % self.leftP,
+ "%s" % self.peakDescription
+ ]
+
+ return string.join(fields, delimiter)
\ No newline at end of file