[dspchip] r238 committed - bugfix: remove previous bigwig files before execution

1 view
Skip to first unread message

dsp...@googlecode.com

unread,
Feb 11, 2011, 10:17:15 AM2/11/11
to dspchi...@googlegroups.com
Revision: 238
Author: daweonline
Date: Fri Feb 11 07:16:32 2011
Log: bugfix: remove previous bigwig files before execution

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

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

=======================================
--- /trunk/src/dclib/IO.py Fri Feb 11 07:05:01 2011
+++ /trunk/src/dclib/IO.py Fri Feb 11 07:16:32 2011
@@ -697,6 +697,11 @@
return bdgh


+def wipeDir(options):
+ # Clean dir from previous bigwig data... otherwise they will be read
+ # by this execution and this will likely raise errors
+ os.unlink(options.profile)
+
def openPeaks(options):
bedh = open(options.bedfile, 'w')
header = "#name\tchromosome\tstart\tend\tarea\theight\tlength\tp-value\n"
@@ -753,7 +758,7 @@
else:
end = str(int(p + step))
value = "%.3e" % v
- previousData = previousData + '\t'.join([chrom, start, end, value])
+ '\n'
+ previousData = previousData + '\t'.join([chrom, start, end, value])
+ '\n\n'

# open the write process
cmd2 = subprocess.Popen([bdg2bw, "-clip", "stdin", gTabName, tmpFile],
shell=False, stdin=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=4096)
@@ -764,7 +769,7 @@
# these should be essentially Warnings
Debug(1, "There was this error, skipping this...", error)
if "There's more than one value" in error:
- Debug(1, "The last points were", previousData[-123:])
+ Debug(1, "The last points were", previousData[-128:])
else:
# remove tab file
os.unlink(gTabName)
=======================================
--- /trunk/src/dspchip Fri Feb 11 06:25:11 2011
+++ /trunk/src/dspchip Fri Feb 11 07:16:32 2011
@@ -43,8 +43,11 @@
chromNames.sort()

# open handlers for output files, if needed
- if not options.noprof and options.profileFormat == 'bdg':
- bdgh = dclib.IO.openBedGraph(options)
+ if not options.noprof
+ if options.profileFormat == 'bdg':
+ bdgh = dclib.IO.openBedGraph(options)
+ else:
+ dclib.IO.wipeDir(options)
if options.findPeaks:
peaksh = dclib.IO.openPeaks(options)

Reply all
Reply to author
Forward
0 new messages