From 04e0834500a4f9e7fb1747225f873e7a950afd08 Mon Sep 17 00:00:00 2001 From: Greg Von Kuster Date: Wed, 4 Jun 2008 13:02:15 +0000 Subject: [PATCH] Revert 2715. --- lib/galaxy/config.py | 2 - lib/galaxy/datatypes/data.py | 8 +- lib/galaxy/datatypes/sniff.py | 16 +- lib/galaxy/model/__init__.py | 1 - lib/galaxy/tools/__init__.py | 2 - lib/galaxy/tools/actions/upload.py | 7 +- lib/galaxy/tools/util/hyphy_util.py | 1016 ++++++++--------- lib/galaxy/tools/util/maf_utilities.py | 4 +- tools/data_source/biomart_filter.py | 2 +- tools/data_source/gbrowse_datasource.py | 2 +- tools/data_source/hbvar_filter.py | 2 +- tools/data_source/ucsc_tablebrowser.py | 3 +- tools/data_source/ucsc_tablebrowser.xml | 2 +- .../data_source/ucsc_tablebrowser_archaea.xml | 2 +- tools/data_source/ucsc_tablebrowser_test.xml | 2 +- .../fasta_concatenate_by_species.py | 3 +- .../fasta_concatenate_by_species.xml | 2 +- tools/filters/join.py | 29 +- tools/filters/joiner.xml | 2 +- tools/hyphy/hyphy_branch_lengths_wrapper.py | 8 +- tools/hyphy/hyphy_branch_lengths_wrapper.xml | 2 +- tools/hyphy/hyphy_dnds_wrapper.py | 12 +- tools/hyphy/hyphy_dnds_wrapper.xml | 2 +- tools/hyphy/hyphy_nj_tree_wrapper.py | 10 +- tools/hyphy/hyphy_nj_tree_wrapper.xml | 2 +- tools/maf/genebed_maf_to_fasta.xml | 4 +- tools/maf/interval2maf.py | 5 +- tools/maf/interval2maf.xml | 2 +- tools/maf/interval2maf_pairwise.xml | 2 +- tools/maf/interval_maf_to_merged_fasta.py | 8 +- tools/maf/interval_maf_to_merged_fasta.xml | 4 +- tools/maf/maf_stats.py | 3 +- tools/maf/maf_stats.xml | 1 - tools/metag_tools/blat_wrapper.py | 3 +- tools/metag_tools/blat_wrapper.xml | 1 - tools/metag_tools/megablast_wrapper.py | 3 +- tools/metag_tools/megablast_wrapper.xml | 2 +- tools/metag_tools/rmap_wrapper.py | 3 +- tools/metag_tools/rmap_wrapper.xml | 4 +- tools/metag_tools/rmapq_wrapper.py | 3 +- tools/metag_tools/rmapq_wrapper.xml | 4 +- .../short_reads_figure_high_quality_length.py | 7 +- ...short_reads_figure_high_quality_length.xml | 2 +- tools/metag_tools/short_reads_figure_score.py | 7 +- .../metag_tools/short_reads_figure_score.xml | 2 +- tools/metag_tools/short_reads_trim_seq.py | 9 +- tools/metag_tools/short_reads_trim_seq.xml | 2 +- tools/plotting/bar_chart.py | 3 +- tools/plotting/bar_chart.xml | 85 +- tools/regVariation/getIndelRates_3way.py | 3 +- tools/regVariation/getIndelRates_3way.xml | 2 +- .../aggregate_binned_scores_in_intervals.xml | 4 +- tools/stats/aggregate_scores_in_intervals.py | 11 +- tools/stats/grouping.py | 11 +- tools/stats/grouping.xml | 3 +- tools/stats/gsummary.py | 3 +- tools/stats/gsummary.xml | 2 +- tools/taxonomy/find_diag_hits.py | 23 +- tools/taxonomy/find_diag_hits.xml | 5 +- tools/taxonomy/gi2taxonomy.py | 3 +- tools/taxonomy/gi2taxonomy.xml | 2 +- tools/taxonomy/t2ps_wrapper.py | 24 +- tools/taxonomy/t2ps_wrapper.xml | 2 +- universe_wsgi.ini.sample | 2 - 64 files changed, 695 insertions(+), 717 deletions(-) diff --git a/lib/galaxy/config.py b/lib/galaxy/config.py index f01aec919b5..909a6cea43d 100644 --- a/lib/galaxy/config.py +++ b/lib/galaxy/config.py @@ -31,8 +31,6 @@ class Configuration( object ): # Where dataset files are stored self.file_path = resolve_path( kwargs.get( "file_path", "database/files" ), self.root ) self.new_file_path = resolve_path( kwargs.get( "new_file_path", "database/tmp" ), self.root ) - # Directory to be used when creating temporary files ( generally from tools ) - self.tmp_file_path = resolve_path( kwargs.get( "tmp_file_path", "/tmp" ), self.root ) self.tool_path = resolve_path( kwargs.get( "tool_path", "tools" ), self.root ) self.tool_data_path = resolve_path( kwargs.get( "tool_data_path", "tool-data" ), os.getcwd() ) self.test_conf = resolve_path( kwargs.get( "test_conf", "" ), self.root ) diff --git a/lib/galaxy/datatypes/data.py b/lib/galaxy/datatypes/data.py index 2162c5e7540..3fc880f9143 100644 --- a/lib/galaxy/datatypes/data.py +++ b/lib/galaxy/datatypes/data.py @@ -223,10 +223,10 @@ class Data( object ): class Text( Data ): - def write_from_stream( self, dataset, stream, directory=None ): + def write_from_stream(self, dataset, stream): """Writes data from a stream""" # write it twice for now - fd, temp_name = tempfile.mkstemp( dir=directory ) + fd, temp_name = tempfile.mkstemp() while 1: chunk = stream.read(1048576) if not chunk: @@ -241,9 +241,9 @@ class Text( Data ): fp.write(line) fp.close() - def set_raw_data( self, dataset, data, directory=None ): + def set_raw_data(self, dataset, data): """Saves the data on the disc""" - fd, temp_name = tempfile.mkstemp( dir=directory ) + fd, temp_name = tempfile.mkstemp() os.write(fd, data) os.close(fd) diff --git a/lib/galaxy/datatypes/sniff.py b/lib/galaxy/datatypes/sniff.py index de3e513755e..7b66c7989b1 100644 --- a/lib/galaxy/datatypes/sniff.py +++ b/lib/galaxy/datatypes/sniff.py @@ -12,11 +12,11 @@ def get_test_fname(fname): full_path = os.path.join(path, 'test', fname) return full_path -def stream_to_file( stream, directory=None ): +def stream_to_file(stream): """ Writes a stream to a temporary file, returns the temporary file's name """ - fd, temp_name = tempfile.mkstemp( dir=directory ) + fd, temp_name = tempfile.mkstemp() while 1: chunk = stream.read(1048576) if not chunk: @@ -25,7 +25,7 @@ def stream_to_file( stream, directory=None ): os.close(fd) return temp_name -def convert_newlines( fname, directory=None ): +def convert_newlines( fname ): """ Converts in place a file from universal line endings to Posix line endings. @@ -37,7 +37,7 @@ def convert_newlines( fname, directory=None ): >>> file(fname).read() '1 2\\n3 4\\n' """ - fd, temp_name = tempfile.mkstemp( dir=directory ) + fd, temp_name = tempfile.mkstemp() fp = os.fdopen( fd, "wt" ) for i, line in enumerate( file( fname, "U" ) ): fp.write( "%s\n" % line.rstrip( "\r\n" ) ) @@ -46,7 +46,7 @@ def convert_newlines( fname, directory=None ): # Return number of lines in file. return i + 1 -def sep2tabs( fname, patt="\\s+", directory=None ): +def sep2tabs(fname, patt="\\s+"): """ Transforms in place a 'sep' separated file to a tab separated one @@ -58,7 +58,7 @@ def sep2tabs( fname, patt="\\s+", directory=None ): '1\\t2\\n3\\t4\\n' """ regexp = re.compile( patt ) - fd, temp_name = tempfile.mkstemp( dir=directory ) + fd, temp_name = tempfile.mkstemp() fp = os.fdopen( fd, "wt" ) for i, line in enumerate( file( fname ) ): line = line.rstrip( '\r\n' ) @@ -69,7 +69,7 @@ def sep2tabs( fname, patt="\\s+", directory=None ): # Return number of lines in file. return i + 1 -def convert_newlines_sep2tabs( fname, patt="\\s+", directory=None ): +def convert_newlines_sep2tabs( fname, patt="\\s+" ): """ Combines above methods: convert_newlines() and sep2tabs() so that files do not need to be read twice @@ -82,7 +82,7 @@ def convert_newlines_sep2tabs( fname, patt="\\s+", directory=None ): '1\\t2\\n3\\t4\\n' """ regexp = re.compile( patt ) - fd, temp_name = tempfile.mkstemp( dir=directory ) + fd, temp_name = tempfile.mkstemp() fp = os.fdopen( fd, "wt" ) for i, line in enumerate( file( fname, "U" ) ): line = line.rstrip( '\r\n' ) diff --git a/lib/galaxy/model/__init__.py b/lib/galaxy/model/__init__.py index 81143ceec8c..eba267448c4 100644 --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -174,7 +174,6 @@ class Dataset( object ): EMPTY = 'empty', ERROR = 'error', DELETED = 'deleted') - # The following is used for functional tests file_path = "/tmp/" engine = None def __init__( self, id=None, hid=None, name=None, info=None, blurb=None, peek=None, extension=None, diff --git a/lib/galaxy/tools/__init__.py b/lib/galaxy/tools/__init__.py index 8e6cca41700..ba81e6483e5 100644 --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -985,8 +985,6 @@ class Tool: param_dict['__new_file_path__'] = os.path.abspath(self.app.config.new_file_path) # The following points to location (xxx.loc) files which are pointers to locally cached data param_dict['GALAXY_DATA_INDEX_DIR'] = self.app.config.tool_data_path - # Directory to be used when creating temporary files ( generally from tools ) - param_dict['GALAXY_TMP_FILE_DIR'] = self.app.config.tmp_file_path # Return the dictionary of parameters return param_dict diff --git a/lib/galaxy/tools/actions/upload.py b/lib/galaxy/tools/actions/upload.py index 886d0fcf734..32628b13682 100644 --- a/lib/galaxy/tools/actions/upload.py +++ b/lib/galaxy/tools/actions/upload.py @@ -79,8 +79,7 @@ class UploadToolAction( object ): def add_file( self, trans, file_obj, file_name, file_type, dbkey, info=None, space_to_tab=False ): data_type = None - tmp_file_path = trans.app.config.tmp_file_path - temp_name = sniff.stream_to_file( file_obj, directory=tmp_file_path ) + temp_name = sniff.stream_to_file( file_obj ) # See if we have an empty file if not os.path.getsize( temp_name ) > 0: @@ -93,7 +92,7 @@ class UploadToolAction( object ): elif is_gzipped and is_valid: #We need to decompress the temp_name file CHUNK_SIZE = 2**20 # 1Mb - fd, uncompressed = tempfile.mkstemp( dir=tmp_file_path ) + fd, uncompressed = tempfile.mkstemp() gzipped_file = gzip.GzipFile( temp_name ) while 1: try: @@ -147,7 +146,7 @@ class UploadToolAction( object ): if data_type != 'binary' and data_type != 'zip': if space_to_tab: - self.line_count = sniff.convert_newlines_sep2tabs( temp_name, directory=tmp_file_path ) + self.line_count = sniff.convert_newlines_sep2tabs( temp_name ) else: self.line_count = sniff.convert_newlines( temp_name ) if file_type == 'auto': diff --git a/lib/galaxy/tools/util/hyphy_util.py b/lib/galaxy/tools/util/hyphy_util.py index 6e6623cff97..08d9dccc21b 100644 --- a/lib/galaxy/tools/util/hyphy_util.py +++ b/lib/galaxy/tools/util/hyphy_util.py @@ -2,8 +2,8 @@ #Contains file contents and helper methods for HYPHY configurations import tempfile, os -def get_filled_temp_filename( contents, directory=None ): - fh = tempfile.NamedTemporaryFile( mode='w', dir=directory ) +def get_filled_temp_filename(contents): + fh = tempfile.NamedTemporaryFile('w') filename = fh.name fh.close() fh = open(filename, 'w') @@ -13,160 +13,160 @@ def get_filled_temp_filename( contents, directory=None ): NJ_tree_shared_ibf = """ COUNT_GAPS_IN_FREQUENCIES = 0; -methodIndex = 1; +methodIndex = 1; /*-----------------------------------------------------------------------------------------------------------------------------------------*/ function InferTreeTopology(verbFlag) { - distanceMatrix = {ds.species,ds.species}; + distanceMatrix = {ds.species,ds.species}; - MESSAGE_LOGGING = 0; - ExecuteAFile (HYPHY_BASE_DIRECTORY+"TemplateBatchFiles"+DIRECTORY_SEPARATOR+"chooseDistanceFormula.def"); - InitializeDistances (0); - - for (i = 0; i methodIndex)>=ds.species; - - treeNodes = {2*(ds.species+1),3}; - cladesInfo = {ds.species-1,2}; - - for (i=Rows(treeNodes)-1; i>=0; i=i-1) - { - treeNodes[i][0] = njm[i][0]; - treeNodes[i][1] = njm[i][1]; - treeNodes[i][2] = njm[i][2]; - } + if (ds.species == 2) + { + d1 = distanceMatrix[0][1]/2; + treeNodes = {{0,1,d1__}, + {1,1,d1__}, + {2,0,0}}; + + cladesInfo = {{2,0}}; + } + else + { + if (ds.species == 3) + { + /* generate least squares estimates here */ + + d1 = (distanceMatrix[0][1]+distanceMatrix[0][2]-distanceMatrix[1][2])/2; + d2 = (distanceMatrix[0][1]-distanceMatrix[0][2]+distanceMatrix[1][2])/2; + d3 = (distanceMatrix[1][2]+distanceMatrix[0][2]-distanceMatrix[0][1])/2; + + treeNodes = {{0,1,d1__}, + {1,1,d2__}, + {2,1,d3__} + {3,0,0}}; + + cladesInfo = {{3,0}}; + } + else + { + njm = (distanceMatrix > methodIndex)>=ds.species; + + treeNodes = {2*(ds.species+1),3}; + cladesInfo = {ds.species-1,2}; + + for (i=Rows(treeNodes)-1; i>=0; i=i-1) + { + treeNodes[i][0] = njm[i][0]; + treeNodes[i][1] = njm[i][1]; + treeNodes[i][2] = njm[i][2]; + } - for (i=Rows(cladesInfo)-1; i>=0; i=i-1) - { - cladesInfo[i][0] = njm[i][3]; - cladesInfo[i][1] = njm[i][4]; - } - - njm = 0; - } - } - return 1.0; + for (i=Rows(cladesInfo)-1; i>=0; i=i-1) + { + cladesInfo[i][0] = njm[i][3]; + cladesInfo[i][1] = njm[i][4]; + } + + njm = 0; + } + } + return 1.0; } /*-----------------------------------------------------------------------------------------------------------------------------------------*/ function TreeMatrix2TreeString (doLengths) { - treeString = ""; - p = 0; - k = 0; - m = treeNodes[0][1]; - n = treeNodes[0][0]; - treeString*(Rows(treeNodes)*25); + treeString = ""; + p = 0; + k = 0; + m = treeNodes[0][1]; + n = treeNodes[0][0]; + treeString*(Rows(treeNodes)*25); - while (m) - { - if (m>p) - { - if (p) - { - treeString*","; - } - for (j=p;j.5) - { - nodeName = ":"+treeNodes[k][2]; - treeString*nodeName; - } - k=k+1; - p=m; - n=treeNodes[k][0]; - m=treeNodes[k][1]; - } + while (m) + { + if (m>p) + { + if (p) + { + treeString*","; + } + for (j=p;j.5) + { + nodeName = ":"+treeNodes[k][2]; + treeString*nodeName; + } + k=k+1; + p=m; + n=treeNodes[k][0]; + m=treeNodes[k][1]; + } - for (j=m;jtable browser - ucsc_tablebrowser.py $output ${GALAXY_TMP_FILE_DIR} + ucsc_tablebrowser.py $output go to UCSC Table Browser $GALAXY_URL diff --git a/tools/data_source/ucsc_tablebrowser_archaea.xml b/tools/data_source/ucsc_tablebrowser_archaea.xml index 24cddc11add..f2bd657d6e6 100644 --- a/tools/data_source/ucsc_tablebrowser_archaea.xml +++ b/tools/data_source/ucsc_tablebrowser_archaea.xml @@ -3,7 +3,7 @@ table browser - ucsc_tablebrowser.py $output ${GALAXY_TMP_FILE_DIR} + ucsc_tablebrowser.py $output go to UCSC Table Browser $GALAXY_URL diff --git a/tools/data_source/ucsc_tablebrowser_test.xml b/tools/data_source/ucsc_tablebrowser_test.xml index 4737d59aeb2..4413f1d6f63 100644 --- a/tools/data_source/ucsc_tablebrowser_test.xml +++ b/tools/data_source/ucsc_tablebrowser_test.xml @@ -3,7 +3,7 @@ table browser - ucsc_tablebrowser.py $output ${GALAXY_TMP_FILE_DIR} + ucsc_tablebrowser.py $output go to UCSC Table Browser $GALAXY_URL diff --git a/tools/fasta_tools/fasta_concatenate_by_species.py b/tools/fasta_tools/fasta_concatenate_by_species.py index 4041923c15e..b5465b51bd3 100644 --- a/tools/fasta_tools/fasta_concatenate_by_species.py +++ b/tools/fasta_tools/fasta_concatenate_by_species.py @@ -14,14 +14,13 @@ from galaxy.util.odict import odict def __main__(): input_filename = sys.argv[1] output_filename = sys.argv[2] - tmp_file_dir = sys.argv[3] species = odict() cur_size = 0 for components in iter_fasta_alignment( input_filename ): species_not_written = species.keys() for component in components: if component.species not in species: - species[component.species] = tempfile.TemporaryFile( dir=tmp_file_dir ) + species[component.species] = tempfile.TemporaryFile() species[component.species].write( "-" * cur_size ) species[component.species].write( component.text ) try: diff --git a/tools/fasta_tools/fasta_concatenate_by_species.xml b/tools/fasta_tools/fasta_concatenate_by_species.xml index c6c30cc2117..f85976c3574 100644 --- a/tools/fasta_tools/fasta_concatenate_by_species.xml +++ b/tools/fasta_tools/fasta_concatenate_by_species.xml @@ -1,6 +1,6 @@ FASTA alignment by species - fasta_concatenate_by_species.py $input1 $out_file1 ${GALAXY_TMP_FILE_DIR} + fasta_concatenate_by_species.py $input1 $out_file1 diff --git a/tools/filters/join.py b/tools/filters/join.py index 7fd342b10c5..f9ad0e7137f 100644 --- a/tools/filters/join.py +++ b/tools/filters/join.py @@ -12,8 +12,8 @@ import optparse, os, sys, tempfile, struct import psyco_full class OffsetList: - def __init__( self, filesize=0, fmt=None, directory=None ): - self.file = tempfile.NamedTemporaryFile( mode='w+b', dir=directory ) + def __init__( self, filesize = 0, fmt = None ): + self.file = tempfile.NamedTemporaryFile( 'w+b' ) if fmt: self.fmt = fmt elif filesize and filesize <= sys.maxint * 2: @@ -59,12 +59,11 @@ class OffsetList: self.file = temp_file class SortedOffsets( OffsetList ): - def __init__( self, indexed_filename, column, tmp_file_dir, split = None ): - OffsetList.__init__( self, filesize=os.stat( indexed_filename ).st_size, directory=tmp_file_dir ) + def __init__( self, indexed_filename, column, split = None ): + OffsetList.__init__( self, os.stat( indexed_filename ).st_size ) self.indexed_filename = indexed_filename self.indexed_file = open( indexed_filename, 'rb' ) self.column = column - self.tmp_file_dir = tmp_file_dir self.split = split self.last_identifier = None self.last_identifier_merged = None @@ -75,7 +74,7 @@ class SortedOffsets( OffsetList ): keys.sort() identifier2 = keys.pop( 0 ) - result_offsets = OffsetList( fmt=self.fmt, directory=self.tmp_file_dir ) + result_offsets = OffsetList( fmt = self.fmt ) offsets1 = enumerate( self.get_offsets() ) try: index1, offset1 = offsets1.next() @@ -125,11 +124,10 @@ class SortedOffsets( OffsetList ): #indexed set of offsets, index is built on demand class OffsetIndex: - def __init__( self, filename, column, tmp_file_dir, split = None, index_depth = 3 ): + def __init__( self, filename, column, split = None, index_depth = 3 ): self.filename = filename self.file = open( filename, 'rb' ) self.column = column - self.tmp_file_dir = tmp_file_dir self.split = split self._offsets = {} self._index = None @@ -194,7 +192,7 @@ class OffsetIndex: while True: if not keys: if first_char not in self._offsets: - self._offsets[first_char] = SortedOffsets( self.filename, self.column, self.tmp_file_dir, split=self.split ) + self._offsets[first_char] = SortedOffsets( self.filename, self.column, self.split ) self._offsets[first_char].merge_with_dict( temp ) return identifier = keys.pop( 0 ) @@ -202,14 +200,14 @@ class OffsetIndex: temp[identifier] = d[identifier] else: if first_char not in self._offsets: - self._offsets[first_char] = SortedOffsets( self.filename, self.column, self.tmp_file_dir, split=self.split ) + self._offsets[first_char] = SortedOffsets( self.filename, self.column, self.split ) self._offsets[first_char].merge_with_dict( temp ) temp = { identifier: d[identifier] } first_char = identifier[0] class BufferedIndex: - def __init__( self, filename, column, tmp_file_dir, split = None, buffer = 1000000, index_depth = 3 ): - self.index = OffsetIndex( filename, column, tmp_file_dir, split=split, index_depth=index_depth ) + def __init__( self, filename, column, split = None, buffer = 1000000, index_depth = 3 ): + self.index = OffsetIndex( filename, column, split, index_depth ) self.buffered_offsets = {} f = open( filename, 'rb' ) offset = f.tell() @@ -237,7 +235,7 @@ class BufferedIndex: for offset in self.buffered_offsets[identifier]: yield self.index.get_line_by_offset( offset ) -def join_files( filename1, column1, filename2, column2, out_filename, tmp_file_dir, split = None, buffer = 1000000, keep_unmatched = False, keep_partial = False, index_depth = 3 ): +def join_files( filename1, column1, filename2, column2, out_filename, split = None, buffer = 1000000, keep_unmatched = False, keep_partial = False, index_depth = 3 ): #return identifier based upon line def get_identifier_by_line( line, column, split = None ): if isinstance( line, str ): @@ -246,7 +244,7 @@ def join_files( filename1, column1, filename2, column2, out_filename, tmp_file_d return fields[column] return None out = open( out_filename, 'w+b' ) - index = BufferedIndex( filename2, column2, tmp_file_dir, split=split, buffer=buffer, index_depth=index_depth ) + index = BufferedIndex( filename2, column2, split, buffer, index_depth ) for line1 in open( filename1, 'rb' ): identifier = get_identifier_by_line( line1, column1, split ) if identifier: @@ -295,7 +293,6 @@ def main(): column1 = int( args[2] ) - 1 column2 = int( args[3] ) - 1 out_filename = args[4] - tmp_file_dir = args[5] except: print >> sys.stderr, "Error parsing command line." sys.exit() @@ -303,6 +300,6 @@ def main(): #Character for splitting fields and joining lines split = "\t" - return join_files( filename1, column1, filename2, column2, out_filename, tmp_file_dir, split, options.buffer, options.keep_unmatched, options.keep_partial, options.index_depth ) + return join_files( filename1, column1, filename2, column2, out_filename, split, options.buffer, options.keep_unmatched, options.keep_partial, options.index_depth ) if __name__ == "__main__": main() diff --git a/tools/filters/joiner.xml b/tools/filters/joiner.xml index a4e6de1f80c..1d866804a64 100644 --- a/tools/filters/joiner.xml +++ b/tools/filters/joiner.xml @@ -1,6 +1,6 @@ side by side on a specified field - join.py $input1 $input2 $field1 $field2 $out_file1 ${GALAXY_TMP_FILE_DIR} $unmatched $partial --index_depth=3 --buffer=50000000 + join.py $input1 $input2 $field1 $field2 $out_file1 $unmatched $partial --index_depth=3 --buffer=50000000 diff --git a/tools/hyphy/hyphy_branch_lengths_wrapper.py b/tools/hyphy/hyphy_branch_lengths_wrapper.py index a63f02c7fa5..7e1126db542 100644 --- a/tools/hyphy/hyphy_branch_lengths_wrapper.py +++ b/tools/hyphy/hyphy_branch_lengths_wrapper.py @@ -4,8 +4,6 @@ import os, sys from galaxy import eggs from galaxy.tools.util import hyphy_util -# Directory to be used when creating temporary files -tmp_file_dir = sys.argv.pop() #Retrieve hyphy path, this will need to be the same across the cluster tool_data = sys.argv.pop() HYPHY_PATH = os.path.join( tool_data, "HYPHY" ) @@ -21,7 +19,7 @@ model_options = sys.argv[6].strip() #Set up Temporary files for hyphy run #set up tree file -tree_filename = hyphy_util.get_filled_temp_filename( tree_contents, directory=tmp_file_dir ) +tree_filename = hyphy_util.get_filled_temp_filename(tree_contents) #Guess if this is a single or multiple FASTA input file found_blank = False @@ -35,10 +33,10 @@ for line in open(input_filename): else: found_blank = False #set up BranchLengths file -BranchLengths_filename = hyphy_util.get_filled_temp_filename( hyphy_util.BranchLengths, directory=tmp_file_dir ) +BranchLengths_filename = hyphy_util.get_filled_temp_filename(hyphy_util.BranchLengths) if is_multiple: os.unlink(BranchLengths_filename) - BranchLengths_filename = hyphy_util.get_filled_temp_filename( hyphy_util.BranchLengthsMF, directory=tmp_file_dir ) + BranchLengths_filename = hyphy_util.get_filled_temp_filename(hyphy_util.BranchLengthsMF) print "Multiple Alignment Analyses" else: print "Single Alignment Analyses" diff --git a/tools/hyphy/hyphy_branch_lengths_wrapper.xml b/tools/hyphy/hyphy_branch_lengths_wrapper.xml index ee5154bcccd..397fd195e39 100644 --- a/tools/hyphy/hyphy_branch_lengths_wrapper.xml +++ b/tools/hyphy/hyphy_branch_lengths_wrapper.xml @@ -3,7 +3,7 @@ Estimation - hyphy_branch_lengths_wrapper.py $input1 $out_file1 "$tree" "$model" "$base_freq" "Global" ${GALAXY_DATA_INDEX_DIR} ${GALAXY_TMP_FILE_DIR} + hyphy_branch_lengths_wrapper.py $input1 $out_file1 "$tree" "$model" "$base_freq" "Global" ${GALAXY_DATA_INDEX_DIR} diff --git a/tools/hyphy/hyphy_dnds_wrapper.py b/tools/hyphy/hyphy_dnds_wrapper.py index 50d2d017e02..f0d861f6d09 100644 --- a/tools/hyphy/hyphy_dnds_wrapper.py +++ b/tools/hyphy/hyphy_dnds_wrapper.py @@ -4,8 +4,6 @@ import os, sys from galaxy import eggs from galaxy.tools.util import hyphy_util -# Directory to be used when creating temporary files -tmp_file_dir = sys.argv.pop() #Retrieve hyphy path, this will need to be the same across the cluster tool_data = sys.argv.pop() HYPHY_PATH = os.path.join( tool_data, "HYPHY" ) @@ -22,15 +20,15 @@ if tree_contents == "": print >> sys.stderr, "Please specify a valid tree definition." sys.exit() -tree_filename = hyphy_util.get_filled_temp_filename( tree_contents, directory=tmp_file_dir ) +tree_filename = hyphy_util.get_filled_temp_filename(tree_contents) if analysis == "local": - fitter_filename = hyphy_util.get_filled_temp_filename( hyphy_util.SimpleLocalFitter, directory=tmp_file_dir ) + fitter_filename = hyphy_util.get_filled_temp_filename(hyphy_util.SimpleLocalFitter) else: - fitter_filename = hyphy_util.get_filled_temp_filename( hyphy_util.SimpleGlobalFitter, directory=tmp_file_dir ) + fitter_filename = hyphy_util.get_filled_temp_filename(hyphy_util.SimpleGlobalFitter) -tabwriter_filename = hyphy_util.get_filled_temp_filename( hyphy_util.TabWriter, directory=tmp_file_dir ) -FastaReader_filename = hyphy_util.get_filled_temp_filename( hyphy_util.FastaReader, directory=tmp_file_dir ) +tabwriter_filename = hyphy_util.get_filled_temp_filename(hyphy_util.TabWriter) +FastaReader_filename = hyphy_util.get_filled_temp_filename(hyphy_util.FastaReader) #setup Config file config_filename = hyphy_util.get_dnds_config_filename(fitter_filename, tabwriter_filename, "Universal", tree_filename, input_filename, nuc_model, output_filename, FastaReader_filename) diff --git a/tools/hyphy/hyphy_dnds_wrapper.xml b/tools/hyphy/hyphy_dnds_wrapper.xml index 5412a992d4e..f9c537682cd 100644 --- a/tools/hyphy/hyphy_dnds_wrapper.xml +++ b/tools/hyphy/hyphy_dnds_wrapper.xml @@ -3,7 +3,7 @@ Estimation - hyphy_dnds_wrapper.py $input1 $out_file1 "$tree" "$model" $analysis ${GALAXY_DATA_INDEX_DIR} ${GALAXY_TMP_FILE_DIR} + hyphy_dnds_wrapper.py $input1 $out_file1 "$tree" "$model" $analysis ${GALAXY_DATA_INDEX_DIR} diff --git a/tools/hyphy/hyphy_nj_tree_wrapper.py b/tools/hyphy/hyphy_nj_tree_wrapper.py index 0bacc038972..7769066decb 100644 --- a/tools/hyphy/hyphy_nj_tree_wrapper.py +++ b/tools/hyphy/hyphy_nj_tree_wrapper.py @@ -4,8 +4,6 @@ import os, sys from galaxy import eggs from galaxy.tools.util import hyphy_util -# Directory to be used when creating temporary files -tmp_file_dir = sys.argv.pop() #Retrieve hyphy path, this will need to be the same across the cluster tool_data = sys.argv.pop() HYPHY_PATH = os.path.join( tool_data, "HYPHY" ) @@ -16,7 +14,7 @@ input_filename = os.path.abspath(sys.argv[1].strip()) output_filename1 = os.path.abspath(sys.argv[2].strip()) output_filename2 = os.path.abspath(sys.argv[3].strip()) distance_metric = sys.argv[4].strip() -temp_ps_filename = hyphy_util.get_filled_temp_filename( "", directory=tmp_file_dir ) +temp_ps_filename = hyphy_util.get_filled_temp_filename("") #Guess if this is a single or multiple FASTA input file found_blank = False @@ -29,16 +27,16 @@ for line in open(input_filename): break else: found_blank = False -NJ_tree_shared_ibf = hyphy_util.get_filled_temp_filename( hyphy_util.NJ_tree_shared_ibf, directory=tmp_file_dir ) +NJ_tree_shared_ibf = hyphy_util.get_filled_temp_filename(hyphy_util.NJ_tree_shared_ibf) #set up NJ_tree file -NJ_tree_filename = hyphy_util.get_filled_temp_filename( hyphy_util.get_NJ_tree( NJ_tree_shared_ibf ), directory=tmp_file_dir ) +NJ_tree_filename = hyphy_util.get_filled_temp_filename(hyphy_util.get_NJ_tree(NJ_tree_shared_ibf)) #setup Config file config_filename = hyphy_util.get_nj_tree_config_filename(input_filename, distance_metric, output_filename1, temp_ps_filename, NJ_tree_filename) if is_multiple: os.unlink(NJ_tree_filename) os.unlink(config_filename) - NJ_tree_filename = hyphy_util.get_filled_temp_filename( hyphy_util.get_NJ_treeMF( NJ_tree_shared_ibf ), directory=tmp_file_dir ) + NJ_tree_filename = hyphy_util.get_filled_temp_filename(hyphy_util.get_NJ_treeMF(NJ_tree_shared_ibf)) config_filename = hyphy_util.get_nj_treeMF_config_filename(input_filename, output_filename1, temp_ps_filename, distance_metric, NJ_tree_filename) print "Multiple Alignment Analyses" else: print "Single Alignment Analyses" diff --git a/tools/hyphy/hyphy_nj_tree_wrapper.xml b/tools/hyphy/hyphy_nj_tree_wrapper.xml index 7eeab284635..431e14e9d12 100644 --- a/tools/hyphy/hyphy_nj_tree_wrapper.xml +++ b/tools/hyphy/hyphy_nj_tree_wrapper.xml @@ -3,7 +3,7 @@ Builder - hyphy_nj_tree_wrapper.py $input1 $out_file1 $out_file2 $distance_metric ${GALAXY_DATA_INDEX_DIR} ${GALAXY_TMP_FILE_DIR} + hyphy_nj_tree_wrapper.py $input1 $out_file1 $out_file2 $distance_metric ${GALAXY_DATA_INDEX_DIR} diff --git a/tools/maf/genebed_maf_to_fasta.xml b/tools/maf/genebed_maf_to_fasta.xml index d23ed2c3671..22293b89ce9 100644 --- a/tools/maf/genebed_maf_to_fasta.xml +++ b/tools/maf/genebed_maf_to_fasta.xml @@ -1,7 +1,7 @@ given a set of coding exon intervals - #if $maf_source_type.maf_source == "user":#interval_maf_to_merged_fasta.py --dbkey=$dbkey --species=$maf_source_type.species --mafSource=$maf_source_type.maf_file --interval_file=$input1 --output_file=$out_file1 --mafSourceType=$maf_source_type.maf_source --geneBED --mafIndexFileDir=${GALAXY_DATA_INDEX_DIR} --mafTmpFileDir=${GALAXY_TMP_FILE_DIR} -#else:#interval_maf_to_merged_fasta.py --dbkey=$dbkey --species=$maf_source_type.species --mafSource=$maf_source_type.maf_identifier --interval_file=$input1 --output_file=$out_file1 --mafSourceType=$maf_source_type.maf_source --geneBED --mafIndexFileDir=${GALAXY_DATA_INDEX_DIR} --mafTmpFileDir=${GALAXY_TMP_FILE_DIR} + #if $maf_source_type.maf_source == "user":#interval_maf_to_merged_fasta.py --dbkey=$dbkey --species=$maf_source_type.species --mafSource=$maf_source_type.maf_file --interval_file=$input1 --output_file=$out_file1 --mafSourceType=$maf_source_type.maf_source --geneBED --mafIndexFileDir=${GALAXY_DATA_INDEX_DIR} +#else:#interval_maf_to_merged_fasta.py --dbkey=$dbkey --species=$maf_source_type.species --mafSource=$maf_source_type.maf_identifier --interval_file=$input1 --output_file=$out_file1 --mafSourceType=$maf_source_type.maf_source --geneBED --mafIndexFileDir=${GALAXY_DATA_INDEX_DIR} #end if diff --git a/tools/maf/interval2maf.py b/tools/maf/interval2maf.py index 969584c3f68..eaa7b15f0e2 100755 --- a/tools/maf/interval2maf.py +++ b/tools/maf/interval2maf.py @@ -20,8 +20,7 @@ usage: %prog maf_file [options] -o, --output_file=o: Output MAF file -p, --species=p: Species to include in output -l, --indexLocation=l: Override default maf_index.loc file - -y, --mafIndexFile=y: Directory of local maf index file ( maf_index.loc or maf_pairwise.loc ) - -z, --mafTmpFileDir=z: Directory to be used when creating temporary files + -z, --mafIndexFile=z: Directory of local maf index file ( maf_index.loc or maf_pairwise.loc ) """ #Dan Blankenberg @@ -94,7 +93,7 @@ def __main__(): print >> sys.stderr, "The MAF source specified (%s) appears to be invalid." % ( options.mafType ) sys.exit() elif options.mafFile: - index, index_filename = maf_utilities.build_maf_index( options.mafFile, species=[dbkey], directory=options.mafTmpFileDir ) + index, index_filename = maf_utilities.build_maf_index( options.mafFile, species = [dbkey] ) if index is None: print >> sys.stderr, "Your MAF file appears to be malformed." sys.exit() diff --git a/tools/maf/interval2maf.xml b/tools/maf/interval2maf.xml index bf025b0e294..a629d14b5aa 100644 --- a/tools/maf/interval2maf.xml +++ b/tools/maf/interval2maf.xml @@ -2,7 +2,7 @@ given a set of genomic intervals #if $maf_source_type.maf_source == "user":#interval2maf.py --dbkey=$input1_dbkey --chromCol=$input1_chromCol --startCol=$input1_startCol --endCol=$input1_endCol --strandCol=$input1_strandCol --mafFile=$maf_source_type.mafFile --interval_file=$input1 --output_file=$out_file1 --mafIndexFile=${GALAXY_DATA_INDEX_DIR}/maf_index.loc - #else:#interval2maf.py --dbkey=$input1_dbkey --chromCol=$input1_chromCol --startCol=$input1_startCol --endCol=$input1_endCol --strandCol=$input1_strandCol --mafType=$maf_source_type.mafType --interval_file=$input1 --output_file=$out_file1 --mafIndexFile=${GALAXY_DATA_INDEX_DIR}/maf_index.loc --mafTmpFileDir=${GALAXY_TMP_FILE_DIR} + #else:#interval2maf.py --dbkey=$input1_dbkey --chromCol=$input1_chromCol --startCol=$input1_startCol --endCol=$input1_endCol --strandCol=$input1_strandCol --mafType=$maf_source_type.mafType --interval_file=$input1 --output_file=$out_file1 --mafIndexFile=${GALAXY_DATA_INDEX_DIR}/maf_index.loc #end if diff --git a/tools/maf/interval2maf_pairwise.xml b/tools/maf/interval2maf_pairwise.xml index fee3988890b..5b00956afc6 100644 --- a/tools/maf/interval2maf_pairwise.xml +++ b/tools/maf/interval2maf_pairwise.xml @@ -1,6 +1,6 @@ given a set of genomic intervals - interval2maf.py --dbkey=$input1_dbkey --chromCol=$input1_chromCol --startCol=$input1_startCol --endCol=$input1_endCol --strandCol=$input1_strandCol --mafType=$mafType --interval_file=$input1 --output_file=$out_file1 --indexLocation=${GALAXY_DATA_INDEX_DIR}/maf_pairwise.loc --mafTmpFileDir=${GALAXY_TMP_FILE_DIR} + interval2maf.py --dbkey=$input1_dbkey --chromCol=$input1_chromCol --startCol=$input1_startCol --endCol=$input1_endCol --strandCol=$input1_strandCol --mafType=$mafType --interval_file=$input1 --output_file=$out_file1 --indexLocation=${GALAXY_DATA_INDEX_DIR}/maf_pairwise.loc diff --git a/tools/maf/interval_maf_to_merged_fasta.py b/tools/maf/interval_maf_to_merged_fasta.py index 5fce7f23a43..4f6621f4de4 100644 --- a/tools/maf/interval_maf_to_merged_fasta.py +++ b/tools/maf/interval_maf_to_merged_fasta.py @@ -18,10 +18,9 @@ usage: %prog maf_file [options] -i, --interval_file=i: Input interval file -o, --output_file=o: Output MAF file -p, --species=p: Species to include in output - -y, --mafIndexFileDir=y: Directory of local maf_index.loc file - -z, --mafTmpFileDir=z: Directory to be used when creating temporary files + -z, --mafIndexFileDir=z: Directory of local maf_index.loc file -usage: %prog dbkey_of_BED comma_separated_list_of_additional_dbkeys_to_extract comma_separated_list_of_indexed_maf_files input_gene_bed_file output_fasta_file cached|user GALAXY_DATA_INDEX_DIR GALAXY_TMP_FILE_DIR +usage: %prog dbkey_of_BED comma_separated_list_of_additional_dbkeys_to_extract comma_separated_list_of_indexed_maf_files input_gene_bed_file output_fasta_file cached|user GALAXY_DATA_INDEX_DIR """ #Dan Blankenberg @@ -88,7 +87,6 @@ def __main__(): print >>sys.stderr, "Strand column has not been specified." sys.exit() mafIndexFile = "%s/maf_index.loc" % options.mafIndexFileDir - tmpFileDir = options.mafTmpFileDir #Finish parsing command line #get index for mafs based on type @@ -101,7 +99,7 @@ def __main__(): sys.exit() elif options.mafSourceType.lower() in ["user"]: #index maf for use here, need to remove index_file when finished - index, index_filename = maf_utilities.build_maf_index( options.mafSource, species=[primary_species], directory=tmpFileDir ) + index, index_filename = maf_utilities.build_maf_index( options.mafSource, species = [primary_species] ) if index is None: print >> sys.stderr, "Your MAF file appears to be malformed." sys.exit() diff --git a/tools/maf/interval_maf_to_merged_fasta.xml b/tools/maf/interval_maf_to_merged_fasta.xml index 43e65aab8f4..4d10bc5de52 100644 --- a/tools/maf/interval_maf_to_merged_fasta.xml +++ b/tools/maf/interval_maf_to_merged_fasta.xml @@ -1,7 +1,7 @@ given a set of genomic intervals - #if $maf_source_type.maf_source == "user":#interval_maf_to_merged_fasta.py --dbkey=$dbkey --species=$maf_source_type.species --mafSource=$maf_source_type.maf_file --interval_file=$input1 --output_file=$out_file1 --chromCol=$input1_chromCol --startCol=$input1_startCol --endCol=$input1_endCol --strandCol=$input1_strandCol --mafSourceType=$maf_source_type.maf_source --mafIndexFileDir=${GALAXY_DATA_INDEX_DIR} --mafTmpFileDir=${GALAXY_TMP_FILE_DIR} -#else:#interval_maf_to_merged_fasta.py --dbkey=$dbkey --species=$maf_source_type.species --mafSource=$maf_source_type.maf_identifier --interval_file=$input1 --output_file=$out_file1 --chromCol=$input1_chromCol --startCol=$input1_startCol --endCol=$input1_endCol --strandCol=$input1_strandCol --mafSourceType=$maf_source_type.maf_source --mafIndexFileDir=${GALAXY_DATA_INDEX_DIR} --mafTmpFileDir=${GALAXY_TMP_FILE_DIR} + #if $maf_source_type.maf_source == "user":#interval_maf_to_merged_fasta.py --dbkey=$dbkey --species=$maf_source_type.species --mafSource=$maf_source_type.maf_file --interval_file=$input1 --output_file=$out_file1 --chromCol=$input1_chromCol --startCol=$input1_startCol --endCol=$input1_endCol --strandCol=$input1_strandCol --mafSourceType=$maf_source_type.maf_source --mafIndexFileDir=${GALAXY_DATA_INDEX_DIR} +#else:#interval_maf_to_merged_fasta.py --dbkey=$dbkey --species=$maf_source_type.species --mafSource=$maf_source_type.maf_identifier --interval_file=$input1 --output_file=$out_file1 --chromCol=$input1_chromCol --startCol=$input1_startCol --endCol=$input1_endCol --strandCol=$input1_strandCol --mafSourceType=$maf_source_type.maf_source --mafIndexFileDir=${GALAXY_DATA_INDEX_DIR} #end if diff --git a/tools/maf/maf_stats.py b/tools/maf/maf_stats.py index be8d4cf61fb..e9b9fb00207 100644 --- a/tools/maf/maf_stats.py +++ b/tools/maf/maf_stats.py @@ -31,11 +31,10 @@ def __main__(): else: summary = False mafIndexFile = "%s/maf_index.loc" % sys.argv[9] - tmpFileDir = sys.argv[10] index = index_filename = None if maf_source_type == "user": #index maf for use here - index, index_filename = maf_utilities.build_maf_index( input_maf_filename, species=[dbkey], directory=tmpFileDir ) + index, index_filename = maf_utilities.build_maf_index( input_maf_filename, species = [dbkey] ) if index is None: print >>sys.stderr, "Your MAF file appears to be malformed." sys.exit() diff --git a/tools/maf/maf_stats.xml b/tools/maf/maf_stats.xml index acc322ae946..1fadd8176de 100644 --- a/tools/maf/maf_stats.xml +++ b/tools/maf/maf_stats.xml @@ -8,7 +8,6 @@ $maf_source_type.maf_source $maf_source_type.mafType $input1 $out_file1 $dbkey $input1_chromCol $input1_startCol $input1_endCol $summary #end if ${GALAXY_DATA_INDEX_DIR} - ${GALAXY_TMP_FILE_DIR} diff --git a/tools/metag_tools/blat_wrapper.py b/tools/metag_tools/blat_wrapper.py index 6bee8dc12d8..4c430881280 100644 --- a/tools/metag_tools/blat_wrapper.py +++ b/tools/metag_tools/blat_wrapper.py @@ -67,7 +67,6 @@ def __main__(): stop_err('Invalid value for mismatch numbers in the word') GALAXY_DATA_INDEX_DIR = sys.argv[8] - GALAXY_TMP_FILE_DIR = sys.argv[9] all_files = [] if source_format == '0': @@ -96,7 +95,7 @@ def __main__(): all_files = [target_file] for detail_file_path in all_files: - output_tempfile = tempfile.NamedTemporaryFile( dir=GALAXY_TMP_FILE_DIR ).name + output_tempfile = tempfile.NamedTemporaryFile().name command = "blat %s %s %s -oneOff=%s -tileSize=%s -minIdentity=%s -mask=lower -noHead -out=pslx 2>&1" % ( detail_file_path, query_file, output_tempfile, one_off, tile_size, min_iden ) os.system( command ) os.system( 'cat %s >> %s' % ( output_tempfile, output_file ) ) diff --git a/tools/metag_tools/blat_wrapper.xml b/tools/metag_tools/blat_wrapper.xml index 171d868e54c..aa50b3b7bc0 100644 --- a/tools/metag_tools/blat_wrapper.xml +++ b/tools/metag_tools/blat_wrapper.xml @@ -5,7 +5,6 @@ #else:#blat_wrapper.py 1 $source.input_target $input_query $output1 $iden $tile_size $one_off #end if ${GALAXY_DATA_INDEX_DIR} - ${GALAXY_TMP_FILE_DIR} diff --git a/tools/metag_tools/megablast_wrapper.py b/tools/metag_tools/megablast_wrapper.py index f50f39a609a..3917d4f131e 100644 --- a/tools/metag_tools/megablast_wrapper.py +++ b/tools/metag_tools/megablast_wrapper.py @@ -19,11 +19,10 @@ def __main__(): mega_word_size = sys.argv[4] # -W mega_iden_cutoff = sys.argv[5] # -p mega_evalue_cutoff = sys.argv[6] # -e + mega_temp_output = tempfile.NamedTemporaryFile().name mega_filter = sys.argv[7] # -F GALAXY_DATA_INDEX_DIR = sys.argv[8] - GALAXY_TMP_FILE_DIR = sys.argv[9] DB_LOC = "%s/blastdb.loc" % GALAXY_DATA_INDEX_DIR - mega_temp_output = tempfile.NamedTemporaryFile( dir=GALAXY_TMP_FILE_DIR ).name # megablast parameters try: diff --git a/tools/metag_tools/megablast_wrapper.xml b/tools/metag_tools/megablast_wrapper.xml index 259f409da5e..6f94562af5f 100644 --- a/tools/metag_tools/megablast_wrapper.xml +++ b/tools/metag_tools/megablast_wrapper.xml @@ -1,6 +1,6 @@ - megablast_wrapper.py $source_select $input_query $output1 $word_size $iden_cutoff $evalue_cutoff $filter_query ${GALAXY_DATA_INDEX_DIR} ${GALAXY_TMP_FILE_DIR} + megablast_wrapper.py $source_select $input_query $output1 $word_size $iden_cutoff $evalue_cutoff $filter_query ${GALAXY_DATA_INDEX_DIR} diff --git a/tools/metag_tools/rmap_wrapper.py b/tools/metag_tools/rmap_wrapper.py index 3b20d6bc3ff..da0c6d04c0e 100644 --- a/tools/metag_tools/rmap_wrapper.py +++ b/tools/metag_tools/rmap_wrapper.py @@ -19,7 +19,6 @@ def __main__(): align_len = sys.argv[4] # -h mismatch = sys.argv[5] # -m output_file = sys.argv[6] - GALAXY_TMP_FILE_DIR = sys.argv[7] # first guess the read length guess_read_len = 0 @@ -67,7 +66,7 @@ def __main__(): stop_err("No sequences for %s are available for search, please report this error." %(target_path)) for detail_file_path in all_files: - output_tempfile = tempfile.NamedTemporaryFile( dir=GALAXY_TMP_FILE_DIR ).name + output_tempfile = tempfile.NamedTemporaryFile().name command = "rmap -h %s -w %s -m %s -c %s %s -o %s 2>&1" % ( align_len, read_len, mismatch, detail_file_path, infile, output_tempfile ) #print command try: diff --git a/tools/metag_tools/rmap_wrapper.xml b/tools/metag_tools/rmap_wrapper.xml index 027daa10d88..da2bf8044eb 100644 --- a/tools/metag_tools/rmap_wrapper.xml +++ b/tools/metag_tools/rmap_wrapper.xml @@ -1,8 +1,8 @@ for Solexa Short Reads Alignment - #if $trim.choice=="No": #rmap_wrapper.py $database $input_seq 0 $align_len $mismatch $output1 ${GALAXY_TMP_FILE_DIR} - #else: #rmap_wrapper.py $database $input_seq $trim.read_len $align_len $mismatch $output1 ${GALAXY_TMP_FILE_DIR} + #if $trim.choice=="No": #rmap_wrapper.py $database $input_seq 0 $align_len $mismatch $output1 + #else: #rmap_wrapper.py $database $input_seq $trim.read_len $align_len $mismatch $output1 #end if diff --git a/tools/metag_tools/rmapq_wrapper.py b/tools/metag_tools/rmapq_wrapper.py index 031b10b1d6f..e52035e0d7c 100644 --- a/tools/metag_tools/rmapq_wrapper.py +++ b/tools/metag_tools/rmapq_wrapper.py @@ -22,7 +22,6 @@ def __main__(): align_len = sys.argv[7] # -h mismatch = sys.argv[8] # -m output_file = sys.argv[9] - GALAXY_TMP_FILE_DIR = sys.argv[10] try: float(high_score) @@ -79,7 +78,7 @@ def __main__(): stop_err("No sequences for %s are available for search, please report this error." %(target_path)) for detail_file_path in all_files: - output_tempfile = tempfile.NamedTemporaryFile( dir=GALAXY_TMP_FILE_DIR ).name + output_tempfile = tempfile.NamedTemporaryFile().name command = "rmapq -q %s -M %s -h %s -w %s -m %s -Q %s -c %s %s -o %s 2>&1" % ( high_score, high_len, align_len, read_len, mismatch, scorefile, detail_file_path, infile, output_tempfile ) #print command try: diff --git a/tools/metag_tools/rmapq_wrapper.xml b/tools/metag_tools/rmapq_wrapper.xml index 3294dc88882..1447fa70259 100644 --- a/tools/metag_tools/rmapq_wrapper.xml +++ b/tools/metag_tools/rmapq_wrapper.xml @@ -1,8 +1,8 @@ for Solexa Short Reads Alignment with Quality Scores - #if $trim.choice=="No": #rmapq_wrapper.py $database $input_seq $input_score $high_score $high_len 0 $align_len $mismatch $output1 ${GALAXY_TMP_FILE_DIR} - #else: #rmapq_wrapper.py $database $input_seq $input_score $high_score $high_len $trim.read_len $align_len $mismatch $output1 ${GALAXY_TMP_FILE_DIR} + #if $trim.choice=="No": #rmapq_wrapper.py $database $input_seq $input_score $high_score $high_len 0 $align_len $mismatch $output1 + #else: #rmapq_wrapper.py $database $input_seq $input_score $high_score $high_len $trim.read_len $align_len $mismatch $output1 #end if diff --git a/tools/metag_tools/short_reads_figure_high_quality_length.py b/tools/metag_tools/short_reads_figure_high_quality_length.py index 57d13e87695..7791405ce07 100644 --- a/tools/metag_tools/short_reads_figure_high_quality_length.py +++ b/tools/metag_tools/short_reads_figure_high_quality_length.py @@ -9,9 +9,9 @@ def stop_err( msg ): sys.stderr.write( "%s\n" % msg ) sys.exit() -def unzip( filename, directory=None ): +def unzip( filename ): zip_file = zipfile.ZipFile( filename, 'r' ) - tmpfilename = tempfile.NamedTemporaryFile( dir=directory ).name + tmpfilename = tempfile.NamedTemporaryFile().name for name in zip_file.namelist(): file( tmpfilename, 'a' ).write( zip_file.read( name ) ) zip_file.close() @@ -20,7 +20,6 @@ def unzip( filename, directory=None ): def __main__(): infile_score_name = sys.argv[1].strip() outfile_R_name = sys.argv[2].strip() - GALAXY_TMP_FILE_DIR = sys.argv[3] try: score_threshold = int( sys.argv[3].strip() ) @@ -30,7 +29,7 @@ def __main__(): infile_is_zipped = False if zipfile.is_zipfile( infile_score_name ): infile_is_zipped = True - infile_name = unzip( infile_score_name, directory=GALAXY_TMP_FILE_DIR ) + infile_name = unzip( infile_score_name ) else: infile_name = infile_score_name diff --git a/tools/metag_tools/short_reads_figure_high_quality_length.xml b/tools/metag_tools/short_reads_figure_high_quality_length.xml index 133fe39e8c7..fba61acb112 100644 --- a/tools/metag_tools/short_reads_figure_high_quality_length.xml +++ b/tools/metag_tools/short_reads_figure_high_quality_length.xml @@ -1,7 +1,7 @@ of high quality score reads -short_reads_figure_high_quality_length.py $input1 $output1 $input2 ${GALAXY_TMP_FILE_DIR} +short_reads_figure_high_quality_length.py $input1 $output1 $input2 diff --git a/tools/metag_tools/short_reads_figure_score.py b/tools/metag_tools/short_reads_figure_score.py index baaff5675f5..2d7f43b6085 100644 --- a/tools/metag_tools/short_reads_figure_score.py +++ b/tools/metag_tools/short_reads_figure_score.py @@ -17,9 +17,9 @@ def stop_err( msg ): sys.stderr.write( "%s\n" % msg ) sys.exit() -def unzip( filename, directory=None ): +def unzip( filename ): zip_file = zipfile.ZipFile( filename, 'r' ) - tmpfilename = tempfile.NamedTemporaryFile( dir=directory ).name + tmpfilename = tempfile.NamedTemporaryFile().name for name in zip_file.namelist(): file( tmpfilename, 'a' ).write( zip_file.read( name ) ) zip_file.close() @@ -64,12 +64,11 @@ def merge_to_20_datapoints( score ): def __main__(): infile_score_name = sys.argv[1].strip() outfile_R_name = sys.argv[2].strip() - GALAXY_TMP_FILE_DIR = sys.argv[3] infile_is_zipped = False if zipfile.is_zipfile( infile_score_name ): infile_is_zipped = True - infile_name = unzip( infile_score_name, directory=GALAXY_TMP_FILE_DIR ) + infile_name = unzip( infile_score_name ) else: infile_name = infile_score_name diff --git a/tools/metag_tools/short_reads_figure_score.xml b/tools/metag_tools/short_reads_figure_score.xml index dd5af6b4246..3df38e0cf4d 100644 --- a/tools/metag_tools/short_reads_figure_score.xml +++ b/tools/metag_tools/short_reads_figure_score.xml @@ -1,7 +1,7 @@ values -short_reads_figure_score.py $input1 $output1 ${GALAXY_TMP_FILE_DIR} +short_reads_figure_score.py $input1 $output1 diff --git a/tools/metag_tools/short_reads_trim_seq.py b/tools/metag_tools/short_reads_trim_seq.py index 6a62ad5f63b..3cd52ed6bdd 100644 --- a/tools/metag_tools/short_reads_trim_seq.py +++ b/tools/metag_tools/short_reads_trim_seq.py @@ -13,9 +13,9 @@ def stop_err( msg ): sys.stderr.write( "%s\n" % msg ) sys.exit() -def unzip( filename, directory=None ): +def unzip( filename ): zip_file = zipfile.ZipFile( filename, 'r' ) - tmpfilename = tempfile.NamedTemporaryFile( dir=directory ).name + tmpfilename = tempfile.NamedTemporaryFile().name for name in zip_file.namelist(): file( tmpfilename, 'a' ).write( zip_file.read( name ) ) zip_file.close() @@ -90,17 +90,16 @@ def __main__(): infile_seq_name = sys.argv[4].strip() infile_score_name = sys.argv[5].strip() arg = sys.argv[6].strip() - GALAXY_TMP_FILE_DIR = sys.argv[7] infile_seq_is_zipped = False if zipfile.is_zipfile( infile_seq_name ): infile_seq_is_zipped = True - seq_infile_name = unzip( infile_seq_name, directory=GALAXY_TMP_FILE_DIR ) + seq_infile_name = unzip( infile_seq_name ) else: seq_infile_name = infile_seq_name infile_score_is_zipped = False if zipfile.is_zipfile( infile_score_name ): infile_score_is_zipped = True - score_infile_name = unzip( infile_score_name, directory=GALAXY_TMP_FILE_DIR ) + score_infile_name = unzip(infile_score_name) else: score_infile_name = infile_score_name diff --git a/tools/metag_tools/short_reads_trim_seq.xml b/tools/metag_tools/short_reads_trim_seq.xml index a5c68d83abf..2af57f6ba39 100644 --- a/tools/metag_tools/short_reads_trim_seq.xml +++ b/tools/metag_tools/short_reads_trim_seq.xml @@ -2,7 +2,7 @@ from short reads - short_reads_trim_seq.py $trim $length $output1 $input1 $input2 $sequencing_method_choice.input3 ${GALAXY_TMP_FILE_DIR} + short_reads_trim_seq.py $trim $length $output1 $input1 $input2 $sequencing_method_choice.input3 diff --git a/tools/plotting/bar_chart.py b/tools/plotting/bar_chart.py index 399225fab0e..9b533430391 100644 --- a/tools/plotting/bar_chart.py +++ b/tools/plotting/bar_chart.py @@ -139,7 +139,6 @@ def main(tmpFileName): if __name__ == "__main__": # The tempfile initialization is here because while inside the main() it seems to create a condition # when the file is removed before gnuplot has a chance of accessing it - GALAXY_TMP_FILE_DIR = sys.argv.pop() - gp_data_file = tempfile.NamedTemporaryFile( mode='w', dir=GALAXY_TMP_FILE_DIR ) + gp_data_file = tempfile.NamedTemporaryFile('w') main(gp_data_file.name) diff --git a/tools/plotting/bar_chart.xml b/tools/plotting/bar_chart.xml index a1c7c421ada..b758b8a91c2 100644 --- a/tools/plotting/bar_chart.xml +++ b/tools/plotting/bar_chart.xml @@ -1,57 +1,60 @@ for multiple columns - - #if $xtic.userSpecified == "Yes": #bar_chart.py $input $xtic.xticColumn $colList "$title" "$ylabel" $ymin $ymax $out_file1 "$pdf_size" ${GALAXY_TMP_FILE_DIR} - #else: #bar_chart.py $input 0 $colList "$title" "$ylabel" $ymin $ymax $out_file1 "$pdf_size" ${GALAXY_TMP_FILE_DIR} - #end if + + #if $xtic.userSpecified == "Yes": #bar_chart.py $input $xtic.xticColumn $colList "$title" "$ylabel" $ymin $ymax $out_file1 "$pdf_size" + #else: #bar_chart.py $input 0 $colList "$title" "$ylabel" $ymin $ymax $out_file1 "$pdf_size" + #end if - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - Gnuplot - Numeric - + + Gnuplot + Numeric + -**What it does** - -This tool builds a bar chart on one or more columns. Suppose you have dataset like this one:: - - Gene1 10 15 Gene2 20 14 Gene3 67 45 Gene4 55 12 - -Graphing columns 2 and 3 while using column 1 for X Tick Labels will produce the following plot: - -.. image:: ../static/images/bar_chart.png - :height: 324 - :width: 540 +**What it does** + +This tool builds a bar chart on one or more columns. Suppose you have dataset like this one:: + + Gene1 10 15 + Gene2 20 14 + Gene3 67 45 + Gene4 55 12 + +Graphing columns 2 and 3 while using column 1 for X Tick Labels will produce the following plot: + +.. image:: ../static/images/bar_chart.png + :height: 324 + :width: 540 diff --git a/tools/regVariation/getIndelRates_3way.py b/tools/regVariation/getIndelRates_3way.py index 61c6b845e81..3da5241283c 100755 --- a/tools/regVariation/getIndelRates_3way.py +++ b/tools/regVariation/getIndelRates_3way.py @@ -50,7 +50,6 @@ def rate_estimator(win, blk_lines, wstart, wend, wspecies): print >>fout, "%s\t%s\t%s\t%s\t%.2e\t%.2e" %(win, wspecies, wstart, wend, irate , drate) def main(): - GALAXY_TMP_FILE_DIR = sys.argv.pop() infile = sys.argv[1] for i, line in enumerate( file ( infile )): line = line.rstrip('\r\n') @@ -69,7 +68,7 @@ def main(): blk=0 win=0 linestr="" - sorted_infile = tempfile.NamedTemporaryFile( dir=GALAXY_TMP_FILE_DIR ) + sorted_infile = tempfile.NamedTemporaryFile() cmdline = "sort -n -k"+str(species_ind+2)+" -o "+sorted_infile.name+" "+infile try: os.system(cmdline) diff --git a/tools/regVariation/getIndelRates_3way.xml b/tools/regVariation/getIndelRates_3way.xml index 64e3d9470bc..d8e79d4434d 100644 --- a/tools/regVariation/getIndelRates_3way.xml +++ b/tools/regVariation/getIndelRates_3way.xml @@ -1,7 +1,7 @@ for 3-way alignments - getIndelRates_3way.py $input1 $out_file1 $winsize $species ${GALAXY_TMP_FILE_DIR} + getIndelRates_3way.py $input1 $out_file1 $winsize $species diff --git a/tools/stats/aggregate_binned_scores_in_intervals.xml b/tools/stats/aggregate_binned_scores_in_intervals.xml index d3a398e6e08..491cde1225d 100644 --- a/tools/stats/aggregate_binned_scores_in_intervals.xml +++ b/tools/stats/aggregate_binned_scores_in_intervals.xml @@ -1,8 +1,8 @@ Appends the average, min, max of datapoints per interval - #if $score_source_type.score_source == "user":#aggregate_scores_in_intervals.py $score_source_type.input2 $input1 $input1_chromCol $input1_startCol $input1_endCol $out_file1 ${GALAXY_TMP_FILE_DIR} --chrom_buffer=3 - #else:#aggregate_scores_in_intervals.py $score_source_type.datasets $input1 $input1_chromCol $input1_startCol $input1_endCol $out_file1 ${GALAXY_TMP_FILE_DIR} -b + #if $score_source_type.score_source == "user":#aggregate_scores_in_intervals.py $score_source_type.input2 $input1 $input1_chromCol $input1_startCol $input1_endCol $out_file1 --chrom_buffer=3 + #else:#aggregate_scores_in_intervals.py $score_source_type.datasets $input1 $input1_chromCol $input1_startCol $input1_endCol $out_file1 -b #end if diff --git a/tools/stats/aggregate_scores_in_intervals.py b/tools/stats/aggregate_scores_in_intervals.py index d5c66032689..34032abf572 100755 --- a/tools/stats/aggregate_scores_in_intervals.py +++ b/tools/stats/aggregate_scores_in_intervals.py @@ -37,8 +37,8 @@ class PositionalScoresOnDisk: fmt_size = struct.calcsize( fmt ) default_value = float( 'nan' ) - def __init__( self, directory=None ): - self.file = tempfile.TemporaryFile( mode='w+b', dir=directory ) + def __init__( self ): + self.file = tempfile.TemporaryFile( 'w+b' ) self.length = 0 def __getitem__( self, i ): if i < 0: i = self.length + i @@ -91,7 +91,7 @@ def stop_err(msg): sys.stderr.write(msg) sys.exit() -def load_scores_wiggle( fname, chrom_buffer_size=3, directory=None ): +def load_scores_wiggle( fname, chrom_buffer_size = 3 ): """ Read a wiggle file and return a dict of BinnedArray objects keyed by chromosome. @@ -104,7 +104,7 @@ def load_scores_wiggle( fname, chrom_buffer_size=3, directory=None ): scores_by_chrom[chrom] = BinnedArray() chrom_buffer_size -= 1 else: - scores_by_chrom[chrom] = PositionalScoresOnDisk( directory=directory ) + scores_by_chrom[chrom] = PositionalScoresOnDisk() scores_by_chrom[chrom][pos] = val except UCSCLimitException: # Wiggle data was truncated, at the very least need to warn the user. @@ -137,7 +137,6 @@ def main(): out_file = open( args[5], 'w' ) else: out_file = sys.stdout - GALAXY_TMP_FILE_DIR = sys.argv[6] binned = bool( options.binned ) mask_fname = options.mask except: @@ -163,7 +162,7 @@ def main(): chrom_buffer = int( options.chrom_buffer ) except: chrom_buffer = 3 - scores_by_chrom = load_scores_wiggle( score_fname, chrom_buffer_size=chrom_buffer, directory=GALAXY_TMP_FILE_DIR ) + scores_by_chrom = load_scores_wiggle( score_fname, chrom_buffer ) if mask_fname: masks = binned_bitsets_from_file( open( mask_fname ) ) diff --git a/tools/stats/grouping.py b/tools/stats/grouping.py index 7c77058a26a..267c37b90d9 100644 --- a/tools/stats/grouping.py +++ b/tools/stats/grouping.py @@ -11,15 +11,14 @@ def stop_err(msg): sys.exit() def main(): - GALAXY_TMP_FILE_DIR = sys.argv[1] - inputfile = sys.argv[3] + inputfile = sys.argv[2] ops = [] cols = [] rounds = [] elems = [] - for var in sys.argv[5:]: + for var in sys.argv[4:]: ops.append(var.split()[0]) cols.append(var.split()[1]) rounds.append(var.split()[2]) @@ -43,7 +42,7 @@ def main(): stop_err( "The data in your input dataset is either missing or not formatted properly." ) try: - group_col = int( sys.argv[4] )-1 + group_col = int( sys.argv[3] )-1 except: stop_err( "Group column not specified." ) @@ -61,7 +60,7 @@ def main(): msg = "Operation '%s' cannot be performed on non-numeric data." %ops[k] stop_err( msg ) - tmpfile = tempfile.NamedTemporaryFile( dir=GALAXY_TMP_FILE_DIR ) + tmpfile = tempfile.NamedTemporaryFile() try: """ @@ -87,7 +86,7 @@ def main(): invalid_line = '' invalid_value = '' invalid_column = 0 - fout = open(sys.argv[2], "w") + fout = open(sys.argv[1], "w") for ii, line in enumerate( file( tmpfile.name )): if line and not line.startswith( '#' ): diff --git a/tools/stats/grouping.xml b/tools/stats/grouping.xml index 6f19bfa4ea1..b2c0b1f8fb4 100644 --- a/tools/stats/grouping.xml +++ b/tools/stats/grouping.xml @@ -1,8 +1,7 @@ data by a column and perform aggregate operation on other columns. - grouping.py - ${GALAXY_TMP_FILE_DIR} + grouping.py $out_file1 $input1 $groupcol diff --git a/tools/stats/gsummary.py b/tools/stats/gsummary.py index 1fbe5762e1e..9455370c9fa 100755 --- a/tools/stats/gsummary.py +++ b/tools/stats/gsummary.py @@ -23,7 +23,6 @@ def main(): datafile = sys.argv[1] outfile_name = sys.argv[2] expression = sys.argv[3] - GALAXY_TMP_FILE_DIR = sys.argv[4] except: stop_err( 'Usage: python gsummary.py input_file ouput_file expression' ) @@ -52,7 +51,7 @@ def main(): except: pass - tmp_file = tempfile.NamedTemporaryFile( mode='w+b', dir=GALAXY_TMP_FILE_DIR ) + tmp_file = tempfile.NamedTemporaryFile( 'w+b' ) # Write the R header row to the temporary file hdr_str = "\t".join( "c%s" % str( col+1 ) for col in cols ) tmp_file.write( "%s\n" % hdr_str ) diff --git a/tools/stats/gsummary.xml b/tools/stats/gsummary.xml index 5aba301ba26..2ab33d39266 100644 --- a/tools/stats/gsummary.xml +++ b/tools/stats/gsummary.xml @@ -1,6 +1,6 @@ for any numerical column - gsummary.py $input $out_file1 "$cond" ${GALAXY_TMP_FILE_DIR} + gsummary.py $input $out_file1 "$cond" diff --git a/tools/taxonomy/find_diag_hits.py b/tools/taxonomy/find_diag_hits.py index a53da1a0a1c..a481cab65dd 100644 --- a/tools/taxonomy/find_diag_hits.py +++ b/tools/taxonomy/find_diag_hits.py @@ -78,6 +78,15 @@ taxRank = { def stop_err(msg): sys.stderr.write(msg) sys.exit() + + +db = tempfile.NamedTemporaryFile('w') + +try: + con = sqlite.connect(db.name) + cur = con.cursor() +except: + stop_err('Cannot connect to %s\n') % db.name try: tax_file = open(sys.argv[1], 'r') @@ -91,18 +100,10 @@ try: else: stop_err('Please specify "reads" or "counts" for output format\n') out_file = open(sys.argv[5], 'w') - GALAXY_TMP_FILE_DIR = sys.argv[6] + except: - stop_err('Check arguments') - -db = tempfile.NamedTemporaryFile( mode='w', dir=GALAXY_TMP_FILE_DIR ) - -try: - con = sqlite.connect(db.name) - cur = con.cursor() -except: - stop_err('Cannot connect to %s\n') % db.name - + stop_err('Check arguments\n') + if taxa[0] == 'None': stop_err('Please, use checkboxes to specify taxonomic ranks.\n') sql = "" diff --git a/tools/taxonomy/find_diag_hits.xml b/tools/taxonomy/find_diag_hits.xml index cf13a2c2980..c067bc614bf 100644 --- a/tools/taxonomy/find_diag_hits.xml +++ b/tools/taxonomy/find_diag_hits.xml @@ -1,6 +1,6 @@ - find_diag_hits.py $input1 $id_col $rank_list $out_format $out_file1 ${GALAXY_TMP_FILE_DIR} + find_diag_hits.py $input1 $id_col $rank_list $out_format $out_file1 @@ -58,7 +58,8 @@ When performing metagenomic analyses it is often necessary to identify sequence Suppose the *Taxonomy manipulation->Fetch Taxonomic Ranks* generated the following taxonomy representation:: - read1 2 root Eukaryota Metazoa n n Chordata Craniata Gnathostomata Mammalia n Laurasiatheria n Ruminantia n Bovidae Bovinae n n Bos n Bos taurus n read2 12585 root Eukaryota Metazoa n n Chordata Craniata Gnathostomata Mammalia n Euarchontoglires Primates Haplorrhini Hominoidea Hominidae n n n Homo n Homo sapiens n + read1 2 root Eukaryota Metazoa n n Chordata Craniata Gnathostomata Mammalia n Laurasiatheria n Ruminantia n Bovidae Bovinae n n Bos n Bos taurus n + read2 12585 root Eukaryota Metazoa n n Chordata Craniata Gnathostomata Mammalia n Euarchontoglires Primates Haplorrhini Hominoidea Hominidae n n n Homo n Homo sapiens n read1 58615 root Eukaryota Metazoa n n Arthropoda n Hexapoda Insecta Neoptera Amphiesmenoptera Lepidoptera Glossata Papilionoidea Nymphalidae Nymphalinae Melitaeini Phyciodina Anthanassa n Anthanassa otanes n read3 56785 root Eukaryota Metazoa n n Chordata Craniata Gnathostomata Mammalia n Euarchontoglires Primates Haplorrhini Hominoidea Hominidae n n n Homo n Homo sapiens n diff --git a/tools/taxonomy/gi2taxonomy.py b/tools/taxonomy/gi2taxonomy.py index 8872fa4bd57..de67a85dee8 100644 --- a/tools/taxonomy/gi2taxonomy.py +++ b/tools/taxonomy/gi2taxonomy.py @@ -137,7 +137,6 @@ try: name_col = int( sys.argv[3] ) - 1 # column containing sequence names out_f = sys.argv[4] # output file tool_data = sys.argv[5] - GALAXY_TMP_FILE_DIR = sys.argv[6] except: stop_err('Check arguments\n') @@ -162,7 +161,7 @@ g2n = gi_name_to_sorted_list(in_f, gi_col, name_col) if len(g2n) == 0: stop_err('No valid GI-containing fields. Please, check your column assignments.\n') -tb_F = tempfile.NamedTemporaryFile( mode='w', dir=GALAXY_TMP_FILE_DIR ) +tb_F = tempfile.NamedTemporaryFile('w') get_taxId( GI2TAX, collapse_repeating_gis( g2n ), tb_F.name ) diff --git a/tools/taxonomy/gi2taxonomy.xml b/tools/taxonomy/gi2taxonomy.xml index 7bc3a7d9e74..0985cd99cb0 100644 --- a/tools/taxonomy/gi2taxonomy.xml +++ b/tools/taxonomy/gi2taxonomy.xml @@ -1,6 +1,6 @@ - gi2taxonomy.py $input $giField $idField $out_file1 ${GALAXY_DATA_INDEX_DIR} ${GALAXY_TMP_FILE_DIR} + gi2taxonomy.py $input $giField $idField $out_file1 ${GALAXY_DATA_INDEX_DIR} diff --git a/tools/taxonomy/t2ps_wrapper.py b/tools/taxonomy/t2ps_wrapper.py index d5b5ac92d97..ec9c29cb5cf 100644 --- a/tools/taxonomy/t2ps_wrapper.py +++ b/tools/taxonomy/t2ps_wrapper.py @@ -29,27 +29,39 @@ try: font_size = sys.argv[4] max_leaves = sys.argv[5] dups = sys.argv[6] - GALAXY_TMP_FILE_DIR = sys.argv[7] except: stop_err('Check arguments\n') -newick_file = tempfile.NamedTemporaryFile( mode='w', dir=GALAXY_TMP_FILE_DIR ) -ps_file = tempfile.NamedTemporaryFile( mode='w', dir=GALAXY_TMP_FILE_DIR ) +newick_file = tempfile.NamedTemporaryFile('w') +ps_file = tempfile.NamedTemporaryFile('w') # Execute taxonomy2tree try: t2t_cmd = 'taxonomy2tree %s %s %s /dev/null 1 &> /dev/null' % ( tree_file, max_tree_level, newick_file.name ) - retcode = subprocess.call( t2t_cmd, shell=True ) if retcode < 0: print >>sys.stderr, "Execution of taxonomy2tree terminated by signal", -retcode except OSError, e: print >>sys.stderr, "Execution of taxonomy2tree failed:", e + retcode = subprocess.call( t2t_cmd, shell=True ) + if retcode < 0: + print >>sys.stderr, "Execution of taxonomy2tree terminated by signal", -retcode +except OSError, e: + print >>sys.stderr, "Execution of taxonomy2tree failed:", e # Execute tree2PS-fast try: t2ps_cmd = 'tree2PS-fast %s %s %s %s %s %s' % ( newick_file.name, ps_file.name, max_tree_level, font_size, max_leaves, dups ) - retcode = subprocess.call( t2ps_cmd, shell=True ) if retcode < 0: print >>sys.stderr, "Execution of tree2PS-fast terminated by signal", -retcode except OSError, e: print >>sys.stderr, "Execution of tree2PS-fast failed:", e + retcode = subprocess.call( t2ps_cmd, shell=True ) + if retcode < 0: + print >>sys.stderr, "Execution of tree2PS-fast terminated by signal", -retcode +except OSError, e: + print >>sys.stderr, "Execution of tree2PS-fast failed:", e # Convert PS to PDF try: - ps2pdf_cmd = 'ps2pdf %s %s' % ( ps_file.name, pdf_file ) retcode = subprocess.call( ps2pdf_cmd, shell=True ) if retcode < 0: print >>sys.stderr, "Execution of ps2pdf terminated by signal", -retcode except OSError, e: print >>sys.stderr, "Execution of ps2pdf failed:", e + ps2pdf_cmd = 'ps2pdf %s %s' % ( ps_file.name, pdf_file ) + retcode = subprocess.call( ps2pdf_cmd, shell=True ) + if retcode < 0: + print >>sys.stderr, "Execution of ps2pdf terminated by signal", -retcode +except OSError, e: + print >>sys.stderr, "Execution of ps2pdf failed:", e diff --git a/tools/taxonomy/t2ps_wrapper.xml b/tools/taxonomy/t2ps_wrapper.xml index 08b1fb1b1af..81b3c67c654 100644 --- a/tools/taxonomy/t2ps_wrapper.xml +++ b/tools/taxonomy/t2ps_wrapper.xml @@ -1,6 +1,6 @@ - t2ps_wrapper.py $input $out_file1 $max_tree_level $font_size $max_leaves 1 ${GALAXY_TMP_FILE_DIR} + t2ps_wrapper.py $input $out_file1 $max_tree_level $font_size $max_leaves 1 diff --git a/universe_wsgi.ini.sample b/universe_wsgi.ini.sample index 6b1cd4658ef..e76554e4337 100644 --- a/universe_wsgi.ini.sample +++ b/universe_wsgi.ini.sample @@ -44,8 +44,6 @@ database_file = database/universe.sqlite file_path = database/files # Temporary storage for additional datasets, this should be shared through the cluster new_file_path = database/tmp -# Directory to be used when creating temporary files ( generally from tools ) -tmp_file_path = /tmp # Tools tool_config_file = tool_conf.xml