# HG changeset patch # User devteam # Date 1406562952 14400 # Node ID 783d91de9e6d7d62d866e085faeda557a036bd49 Imported from capsule None diff -r 000000000000 -r 783d91de9e6d MINE.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MINE.xml Mon Jul 28 11:55:52 2014 -0400 @@ -0,0 +1,82 @@ + + - Maximal Information-based Nonparametric Exploration + + MINE + + mine_wrapper.py + --jar "\${JAVA_JAR_PATH}/MINE.jar" + + --infile "${input_file}" + + #if str( $master_variable_type.master_variable_type_selector ) in [ 'allPairs', 'adjacentPairs' ]: + --master_variable "${master_variable_type.master_variable_type_selector}" + #else: + --master_variable "${master_variable_type.master_variable}" + #end if + + --cv "${cv}" + + --exp "${exp}" + + --c "${c}" + + ##--gc ##skip + + + #if str( $master_variable_type.master_variable_type_selector ) != 'allPairs' and $master_variable_type.permute: + --permute + #end if + + --output_results "${output_results}" + + --output_log "${output_log}" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +**What it does** + +Applies the Maximal Information-based Nonparametric Exploration strategy to an input dataset. + +See http://www.exploredata.net/ for more information. + +------ + +**Citation** + +For the underlying tool, please cite `David N. Reshef, Yakir A. Reshef, Hilary K. Finucane5, Sharon R. Grossman, Gilean McVean, Peter J. Turnbaugh, Eric S. Lander, Michael Mitzenmacher, Pardis C. Sabeti Detecting Novel Associations in Large Data Sets. Science. 2011 Dec. <http://www.sciencemag.org/content/334/6062/1518>`_ + +If you use this tool in Galaxy, please cite Blankenberg D, et al. *In preparation.* + + + diff -r 000000000000 -r 783d91de9e6d mine_wrapper.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mine_wrapper.py Mon Jul 28 11:55:52 2014 -0400 @@ -0,0 +1,85 @@ +#!/usr/bin/env python +#Dan Blankenberg + +""" +A wrapper script for running the MINE.jar commands. +""" + +import sys, optparse, os, tempfile, subprocess, shutil + +CHUNK_SIZE = 2**20 #1mb + +BASE_NAME = "galaxy_mime_file.txt" +JOB_ID = "galaxy_mine" + +def cleanup_before_exit( tmp_dir ): + if tmp_dir and os.path.exists( tmp_dir ): + print os.listdir( tmp_dir ) + shutil.rmtree( tmp_dir ) + +def open_file_from_option( filename, mode = 'rb' ): + if filename: + return open( filename, mode = mode ) + return None + + +def __main__(): + #Parse Command Line + parser = optparse.OptionParser() + parser.add_option( '-j', '--jar', dest='jar', action='store', type="string", help='Location of JAR file' ) + parser.add_option( '-i', '--infile', dest='infile', action='store', type="string", help='infile' ) + parser.add_option( '-m', '--master_variable', dest='master_variable', action='store', type="string", help='master_variable' ) + parser.add_option( '-v', '--cv', dest='cv', action='store', type="string", help='cv' ) + parser.add_option( '-e', '--exp', dest='exp', action='store', type="string", help='exp' ) + parser.add_option( '-c', '--c', dest='c', action='store', type="string", help='c' ) + parser.add_option( '-p', '--permute', dest='permute', action='store_true', default=False, help='permute' ) + parser.add_option( '-o', '--output_results', dest='output_results', action='store', type="string", help='output_results' ) + parser.add_option( '-l', '--output_log', dest='output_log', action='store', type="string", help='output_log' ) + parser.add_option( '', '--stdout', dest='stdout', action='store', type="string", default=None, help='If specified, the output of stdout will be written to this file.' ) + parser.add_option( '', '--stderr', dest='stderr', action='store', type="string", default=None, help='If specified, the output of stderr will be written to this file.' ) + (options, args) = parser.parse_args() + + tmp_dir = tempfile.mkdtemp( prefix='tmp-MINE-' ) + tmp_input_name = os.path.join( tmp_dir, BASE_NAME ) + if options.permute: + permute = "-permute" + else: + permute = "" + + os.symlink( options.infile, tmp_input_name ) + + cmd = 'java -jar "%s" "%s" %s -cv%s -exp%s -c%s %s "%s"' % ( options.jar, tmp_input_name, options.master_variable, options.cv, options.exp, options.c, permute, JOB_ID ) + print cmd + + #set up stdout and stderr output options + stdout = open_file_from_option( options.stdout, mode = 'wb' ) + stderr = open_file_from_option( options.stderr, mode = 'wb' ) + #if no stderr file is specified, we'll use our own + if stderr is None: + stderr = tempfile.NamedTemporaryFile( prefix="MINE-stderr-", dir=tmp_dir ) + + proc = subprocess.Popen( args=cmd, stdout=stdout, stderr=stderr, shell=True, cwd=tmp_dir ) + return_code = proc.wait() + + if return_code: + stderr_target = sys.stderr + else: + stderr_target = sys.stdout + stderr.flush() + stderr.seek(0) + while True: + chunk = stderr.read( CHUNK_SIZE ) + if chunk: + stderr_target.write( chunk ) + else: + break + stderr.close() + + print os.listdir( tmp_dir ) + + shutil.move( '%s,%s,Results.csv' % ( tmp_input_name, JOB_ID ), options.output_results ) + shutil.move( '%s,%s,Status.csv' % ( tmp_input_name, JOB_ID ), options.output_log ) + + cleanup_before_exit( tmp_dir ) + +if __name__=="__main__": __main__() diff -r 000000000000 -r 783d91de9e6d tool_dependencies.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tool_dependencies.xml Mon Jul 28 11:55:52 2014 -0400 @@ -0,0 +1,6 @@ + + + + + +