[dspchip] r241 committed - Nicer debug info when bigwig is going to be written

1 view
Skip to first unread message

dsp...@googlecode.com

unread,
Feb 11, 2011, 11:49:35 AM2/11/11
to dspchi...@googlegroups.com
Revision: 241
Author: daweonline
Date: Fri Feb 11 08:48:47 2011
Log: Nicer debug info when bigwig is going to be written

http://code.google.com/p/dspchip/source/detail?r=241

Modified:
/trunk/src/dclib/IO.py
/trunk/src/dspchip

=======================================
--- /trunk/src/dclib/IO.py Fri Feb 11 08:20:21 2011
+++ /trunk/src/dclib/IO.py Fri Feb 11 08:48:47 2011
@@ -705,6 +705,7 @@
except OSError:
True

+
def openPeaks(options):
bedh = open(options.bedfile, 'w')
header = "#name\tchromosome\tstart\tend\tarea\theight\tlength\tp-value\n"
@@ -739,15 +740,19 @@
fh.write(key + '\t' + str(chromLength[key]) + '\n')
fh.close()

+ Debug(1, timestring(), "Writing profile data in bigwig...")
+
# Read what has been written so far
cmd1 = subprocess.Popen([bw2bdg, fname, "stdout"], shell=False,
stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=4096)
(previousData, error) = cmd1.communicate()
# don't care about errors, previousData has been initialized :-)

# append new data to the string
- l = len(data)
+ l = float(len(data))
step = options.profStep
- for p in range(0, l, step):
+ for p in range(0, int(l), step):
+ percComplete = int(np.ceil(p / l * 99))
+ Debug(2, percComplete, "% completed")
if options.windowingFunction == 'mean':
v = np.mean(data[p:p+step])
elif options.windowingFunction == 'med':
@@ -765,7 +770,7 @@

# open the write process
cmd2 = subprocess.Popen([bdg2bw, "-clip", "stdin", gTabName, tmpFile],
shell=False, stdin=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=4096)
-
+ Debug(1, "100 % completed")
(output, error) = cmd2.communicate(previousData)

if len(error):
=======================================
--- /trunk/src/dspchip Fri Feb 11 07:17:05 2011
+++ /trunk/src/dspchip Fri Feb 11 08:48:47 2011
@@ -201,7 +201,6 @@
dclib.Helpers.Debug(1, dclib.Helpers.timestring(), "Writing
profile data in bedgraph")
dclib.IO.writeBedGraph(bdgh, theSignalA, options, chrom=chrom)
elif options.profileFormat == 'bw':
- dclib.Helpers.Debug(1, dclib.Helpers.timestring(), "Writing
profile data in bigwig")
dclib.IO.writeBigWig(theSignalA, options, chromLength, chrom=chrom)

if options.findPeaks:

Reply all
Reply to author
Forward
0 new messages