# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User fubar: ross Lazarus at gmail period com
# Date 1283235958 14400
# Node ID 6b2dffb999d8595d410dc299fb512b76c35be39e
# Parent b7e13932acf9e58dee2bb3f2799e7e27402ffc63
Fix for temporary name generation - now use mkstemp for the name and keep the filename
at the end of the temporary name for tools where the extension matters
in tests
--- a/test/base/twilltestcase.py
+++ b/test/base/twilltestcase.py
@@ -616,6 +616,16 @@ class TwillTestCase( unittest.TestCase )
hid = elem.get('hid')
hids.append(hid)
return hids
+
+ def makeTfname(self, fname=None):
+ """
+ safe temp name - preserve the file extension for tools that interpret it
+ """
+ suffix = os.path.split(fname)[-1] # ignore full path
+ fd,temp_prefix = tempfile.mkstemp(prefix='tmp',suffix=suffix)
+ return temp_prefix
+
+
def verify_dataset_correctness( self, filename, hid=None, wait=True, maxseconds=120, attributes=None ):
"""Verifies that the attributes and contents of a history item meet expectations"""
if wait:
@@ -645,7 +655,7 @@ class TwillTestCase( unittest.TestCase )
raise AssertionError( errmsg )
else:
local_name = self.get_filename( filename )
- temp_name = self.get_filename( '%s_temp' % filename ) #This is a terrible way to generate a temp name
+ temp_name = self.makeTfname(fname = filename)
self.home()
self.visit_page( "display?hid=" + hid )
data = self.last_page()
@@ -691,7 +701,7 @@ class TwillTestCase( unittest.TestCase )
local_name = self.get_filename( file_name )
if base_name is None:
base_name = os.path.split(file_name)[-1]
- temp_name = self.get_filename( '%s_temp' % file_name ) #This is a terrible way to generate a temp name
+ temp_name = self.makeTfname(fname = base_name)
self.visit_url( "%s/datasets/%s/display/%s" % ( self.url, self.security.encode_id( hda_id ), base_name ) )
data = self.last_page()
file( temp_name, 'wb' ).write( data )
@@ -720,7 +730,7 @@ class TwillTestCase( unittest.TestCase )
errmsg += str( err )
raise AssertionError( errmsg )
finally:
- os.remove( temp_name )
+ os.remove( temp_name )
def is_zipped( self, filename ):
if not zipfile.is_zipfile( filename ):
@@ -728,7 +738,7 @@ class TwillTestCase( unittest.TestCase )
return True
def is_binary( self, filename ):
- temp = open( temp_name, "U" )
+ temp = open( filename, "U" ) # why is this not filename? Where did temp_name come from
lineno = 0
for line in temp:
lineno += 1
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Kelly Vincent <kpvincent(a)bx.psu.edu>
# Date 1283231072 14400
# Node ID b7e13932acf9e58dee2bb3f2799e7e27402ffc63
# Parent 1cd9009036f729c8d36fe40db6cbfd6508c3a635
Issue #380: Properly handle -n and -v options in Bowtie
--- a/tools/sr_mapping/bowtie_wrapper.py
+++ b/tools/sr_mapping/bowtie_wrapper.py
@@ -120,6 +120,7 @@ def __main__():
parser.add_option( '-H', '--suppressHeader', dest='suppressHeader', help='Suppress header' )
(options, args) = parser.parse_args()
stdout = ''
+
# make temp directory for placement of indices and copy reference file there if necessary
tmp_index_dir = tempfile.mkdtemp()
# get type of data (solid or solexa)
@@ -190,7 +191,7 @@ def __main__():
# clean up temp dir
if os.path.exists( tmp_index_dir ):
shutil.rmtree( tmp_index_dir )
- stop_err( 'Something is wrong with the indexing parameters and the indexing and alignment could not be run\n' + str( e ) )
+ stop_err( "Something is wrong with the indexing parameters and the indexing and alignment could not be run. Make sure you don't have any non-numeric values where they should be numeric.\n" + str( e ) )
ref_file = tempfile.NamedTemporaryFile( dir=tmp_index_dir )
ref_file_name = ref_file.name
ref_file.close()
@@ -259,7 +260,7 @@ def __main__():
trimL = '-3 %s' % options.trimL
else:
trimL = ''
- if options. mismatchSeed != 'None' and (options.mismatchSeed == '0' or options.mismatchSeed == '1' \
+ if options.mismatchSeed != 'None' and (options.mismatchSeed == '0' or options.mismatchSeed == '1' \
or options.mismatchSeed == '2' or options.mismatchSeed == '3'):
mismatchSeed = '-n %s' % options.mismatchSeed
else:
@@ -276,7 +277,7 @@ def __main__():
rounding = '--nomaqround'
else:
rounding = ''
- if options.maqSoapAlign != '-1':
+ if options.maqSoapAlign != '-1' and int( options.maqSoapAlign ) >= 0:
maqSoapAlign = '-v %s' % options.maqSoapAlign
else:
maqSoapAlign = ''