# HG changeset patch # User Saket Choudhary # Date 1373360626 -19800 # Node ID 1a89e2bd4a9210be7a550340bf9d988949fe80f3 # Parent b63c04e54c008299b79e24f5c3b0ee252ea38ca1 Fix organisation diff -r b63c04e54c00 -r 1a89e2bd4a92 panama.xml --- a/panama.xml Tue Jul 09 04:56:18 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ - - - panama - - eQTL Analysis using PANAMA(http://ml.sheffield.ac.uk/qtl/panama/) - - panama_run.py --exp_data=$expression_data --snp_data=$snp_data --output1=$output1 - - - - - - - - - - - - - - - - - - diff -r b63c04e54c00 -r 1a89e2bd4a92 panama_run.py --- a/panama_run.py Tue Jul 09 04:56:18 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -#!/usr/bin/env python -""" -Run panama on expression and snp data -usage: panama_run.py [options] - --exp_data: Expression data CSV file - --snp_data: SNP data file - --output1: Output CSV dataset -""" - -import optparse, os, sys, subprocess, tempfile, shutil -from galaxy import eggs -import pkg_resources; pkg_resources.require( "bx-python" ) -from bx.cookbook import doc_optparse -from galaxy import util - -def stop_err( msg ): - sys.stderr.write( '%s\n' % msg ) - sys.exit() - - - -def __main__(): - #Parse Command Line - parser = optparse.OptionParser() - parser.add_option( '', '--exp_data', dest='exp_data', help='The input Expression dataset') - parser.add_option( '', '--snp_data', dest='snp_data', help='The input snp dataset' ) - parser.add_option( '', '--output1', dest='output1', help='The output CSV dataset' ) - ( options, args ) = parser.parse_args() - - try: - tmp_dir = tempfile.mkdtemp() - panama_output_file_name = os.path.join(tmp_dir, "PANAMA_results.csv") - command = 'panama %s %s -d %s' %(options.exp_data,options.snp_data,tmp_dir) - print command - tmp = tempfile.NamedTemporaryFile( dir=tmp_dir ).name - tmp_stderr = open( tmp, 'wb' ) - proc = subprocess.Popen( args=command, shell=True, stderr=tmp_stderr.fileno() ) - returncode = proc.wait() - tmp_stderr.close() - # get stderr, allowing for case where it's very large - tmp_stderr = open( tmp, 'rb' ) - stderr = '' - buffsize = 1048576 - try: - while True: - stderr += tmp_stderr.read( buffsize ) - if not stderr or len( stderr ) % buffsize != 0: - break - except OverflowError: - pass - tmp_stderr.close() - if returncode != 0: - raise Exception, stderr - except Exception, e: - #clean up temp files - print e - if os.path.exists( tmp_dir ): - shutil.rmtree( tmp_dir ) - stop_err( 'Error opening panama') - # Move tmp_aligns_file_name to our output dataset location - shutil.move( panama_output_file_name, options.output1 ) - #clean up temp files - if os.path.exists( tmp_dir ): - shutil.rmtree( tmp_dir ) - # check that there are results in the output file - if os.path.getsize( options.output1 ) > 0: - sys.stdout.write( 'PANAM results generated' ) - else: - stop_err( 'Error generating PANAMA results' ) - -if __name__=="__main__": __main__() diff -r b63c04e54c00 -r 1a89e2bd4a92 tool_dependencies.xml --- a/tool_dependencies.xml Tue Jul 09 04:56:18 2013 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ - - - - - - panama - - - PANAMA installation needs numpy ,scipy, matplotlib, ipython, cython, pandas, pygp. - Please change the "backend" to "Agg" as "backend: Agg" - - - - - diff -r b63c04e54c00 -r 1a89e2bd4a92 tools/eqtl_tools/panama.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/eqtl_tools/panama.xml Tue Jul 09 14:33:46 2013 +0530 @@ -0,0 +1,25 @@ + + + panama + + eQTL Analysis using PANAMA(http://ml.sheffield.ac.uk/qtl/panama/) + + panama_run.py --exp_data=$expression_data --snp_data=$snp_data --output1=$output1 + + + + + + + + + + + + + + + + + + diff -r b63c04e54c00 -r 1a89e2bd4a92 tools/eqtl_tools/panama_run.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/eqtl_tools/panama_run.py Tue Jul 09 14:33:46 2013 +0530 @@ -0,0 +1,71 @@ +#!/usr/bin/env python +""" +Run panama on expression and snp data +usage: panama_run.py [options] + --exp_data: Expression data CSV file + --snp_data: SNP data file + --output1: Output CSV dataset +""" + +import optparse, os, sys, subprocess, tempfile, shutil +from galaxy import eggs +import pkg_resources; pkg_resources.require( "bx-python" ) +from bx.cookbook import doc_optparse +from galaxy import util + +def stop_err( msg ): + sys.stderr.write( '%s\n' % msg ) + sys.exit() + + + +def __main__(): + #Parse Command Line + parser = optparse.OptionParser() + parser.add_option( '', '--exp_data', dest='exp_data', help='The input Expression dataset') + parser.add_option( '', '--snp_data', dest='snp_data', help='The input snp dataset' ) + parser.add_option( '', '--output1', dest='output1', help='The output CSV dataset' ) + ( options, args ) = parser.parse_args() + + try: + tmp_dir = tempfile.mkdtemp() + panama_output_file_name = os.path.join(tmp_dir, "PANAMA_results.csv") + command = 'panama %s %s -d %s' %(options.exp_data,options.snp_data,tmp_dir) + print command + tmp = tempfile.NamedTemporaryFile( dir=tmp_dir ).name + tmp_stderr = open( tmp, 'wb' ) + proc = subprocess.Popen( args=command, shell=True, stderr=tmp_stderr.fileno() ) + returncode = proc.wait() + tmp_stderr.close() + # get stderr, allowing for case where it's very large + tmp_stderr = open( tmp, 'rb' ) + stderr = '' + buffsize = 1048576 + try: + while True: + stderr += tmp_stderr.read( buffsize ) + if not stderr or len( stderr ) % buffsize != 0: + break + except OverflowError: + pass + tmp_stderr.close() + if returncode != 0: + raise Exception, stderr + except Exception, e: + #clean up temp files + print e + if os.path.exists( tmp_dir ): + shutil.rmtree( tmp_dir ) + stop_err( 'Error opening panama') + # Move tmp_aligns_file_name to our output dataset location + shutil.move( panama_output_file_name, options.output1 ) + #clean up temp files + if os.path.exists( tmp_dir ): + shutil.rmtree( tmp_dir ) + # check that there are results in the output file + if os.path.getsize( options.output1 ) > 0: + sys.stdout.write( 'PANAM results generated' ) + else: + stop_err( 'Error generating PANAMA results' ) + +if __name__=="__main__": __main__() diff -r b63c04e54c00 -r 1a89e2bd4a92 tools/tool_dependencies.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/tool_dependencies.xml Tue Jul 09 14:33:46 2013 +0530 @@ -0,0 +1,15 @@ + + + + + + panama + + + PANAMA installation needs numpy ,scipy, matplotlib, ipython, cython, pandas, pygp. + Please change the "backend" to "Agg" as "backend: Agg" + + + + +