From 635a90bd2eebdd9b9ff56086ffcf7ffd41239d7a Mon Sep 17 00:00:00 2001 From: kohleman <kohleman> Date: Thu, 19 May 2011 08:43:33 +0000 Subject: [PATCH] initial checkin SVN: 21384 --- .../source/Python/solexaQa.py | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 deep_sequencing_unit/source/Python/solexaQa.py diff --git a/deep_sequencing_unit/source/Python/solexaQa.py b/deep_sequencing_unit/source/Python/solexaQa.py new file mode 100644 index 00000000000..e95dd73616e --- /dev/null +++ b/deep_sequencing_unit/source/Python/solexaQa.py @@ -0,0 +1,54 @@ +#!/usr/bin/env python +''' +Python Wrapper for a perl based program. +Generates tile based quality graphics + +Output: pdf +@author: Manuel Kohler +@copyright: ETH Zurich +@precondition: Working pdftk and SolexaQA.pl binaries + +''' + +import subprocess +import shlex +import os +import sys +from optparse import OptionParser + +SCRIPT = "/usr/local/dsu/bin/SolexaQA/SolexaQA.pl" +PDFTK = '/usr/local/dsu/pdftk-1.41/pdftk/pdftk' + +parser = OptionParser() +parser.add_option("-p", "--path", dest="path", action="store", type="string", + help="Path of the fastq files", metavar="PATH") +parser.add_option("-v", dest="verbose", action="store_true", + help="tell me all") +(options, args) = parser.parse_args() +path = options.path +os.chdir(path) + +listdir = os.listdir(path) +for file in listdir: + if file.endswith('fastq'): + args = SCRIPT + " -sanger " + path + "/" + file + Newargs = shlex.split(args) + p = subprocess.Popen(Newargs) + p.wait() + #convert -page A4 ETHZ_BSSE_110204_62Y8YAAXX_7.fastq.png ETHZ_BSSE_110204_62Y8YAAXX_7.fastq_TileStatistics_A4.pdf + convert = ['convert', '-page', 'A4', file + '.png', file + '.png.pdf'] + c = subprocess.Popen(convert) + c.wait() + #rm *.matrix *.segments *.quality *.png + os.remove(file + '.matrix') + os.remove(file + '.segments') + os.remove(file + '.quality') + os.remove(file + '.png') + + files = file + '.segments.hist.pdf', file + '.quality.pdf', file + '.png.pdf' + assemble = [ PDFTK, 'cat', 'output', file.replace('.', '_', 1) + '_SolexaQA.pdf'] + [assemble.insert(1, i) for i in files] + a = subprocess.Popen(assemble) + a.wait() + [os.remove(f) for f in files] +print("Finished...") -- GitLab