mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-21 13:50:20 +08:00
Functional tests will now properly handle output datasets in pdf format. Added functional tests for histogram and scatterplot. Fixed a bug where temporary files was not removed if functional test failed.
This commit is contained in:
@@ -15,7 +15,7 @@ def main():
|
||||
try:
|
||||
columns = int( sys.argv[3] ) - 1, int( sys.argv[4] ) - 1
|
||||
except:
|
||||
stop_err( "..Columns not specified, your query does not contain a column of numerical data." )
|
||||
stop_err( "Columns not specified, your query does not contain a column of numerical data." )
|
||||
title = sys.argv[5]
|
||||
xlab = sys.argv[6]
|
||||
ylab = sys.argv[7]
|
||||
@@ -26,31 +26,27 @@ def main():
|
||||
invalid_value = ''
|
||||
invalid_column = 0
|
||||
|
||||
for i, line in enumerate( file ( sys.argv[1] ) ):
|
||||
for i, line in enumerate( file( in_fname ) ):
|
||||
valid = True
|
||||
line = line.rstrip('\r\n')
|
||||
line = line.rstrip( '\r\n' )
|
||||
if line and not line.startswith( '#' ):
|
||||
# Extract values and convert to floats
|
||||
row = []
|
||||
fields = line.split( "\t" )
|
||||
for column in columns:
|
||||
if not valid:
|
||||
break
|
||||
fields = line.split( "\t" )
|
||||
if len( fields ) <= column:
|
||||
stop_err( "Column %d on line %d missing, line: %s" % ( column+1, i, line ) )
|
||||
val = fields[column]
|
||||
if val.lower() == "na":
|
||||
row.append( float( "nan" ) )
|
||||
else:
|
||||
try:
|
||||
try:
|
||||
val = fields[column]
|
||||
if val.lower() == "na":
|
||||
row.append( float( "nan" ) )
|
||||
else:
|
||||
row.append( float( fields[column] ) )
|
||||
except:
|
||||
valid = False
|
||||
skipped_lines += 1
|
||||
if not first_invalid_line:
|
||||
first_invalid_line = i+1
|
||||
invalid_value = fields[column]
|
||||
invalid_column = column+1
|
||||
except:
|
||||
valid = False
|
||||
skipped_lines += 1
|
||||
if not first_invalid_line:
|
||||
first_invalid_line = i + 1
|
||||
invalid_value = fields[column]
|
||||
invalid_column = column + 1
|
||||
break
|
||||
else:
|
||||
valid = False
|
||||
skipped_lines += 1
|
||||
@@ -59,19 +55,20 @@ def main():
|
||||
|
||||
if valid:
|
||||
matrix.append( row )
|
||||
|
||||
r.pdf( out_fname, 8, 8 )
|
||||
r.plot( array( matrix ), type="p", main=title, xlab=xlab, ylab=ylab, col="blue", pch=19 )
|
||||
r.dev_off()
|
||||
|
||||
msg = "--Scatter plot on "
|
||||
for i,col in enumerate(columns):
|
||||
col += 1
|
||||
msg += "c%d, " %col
|
||||
if skipped_lines < i:
|
||||
try:
|
||||
r.pdf( out_fname, 8, 8 )
|
||||
r.plot( array( matrix ), type="p", main=title, xlab=xlab, ylab=ylab, col="blue", pch=19 )
|
||||
r.dev_off()
|
||||
except Exception, exc:
|
||||
stop_err( "%s" %str( exc ) )
|
||||
else:
|
||||
stop_err( "All values in both columns %s and %s are non-numeric." % ( sys.argv[3], sys.argv[4] ) )
|
||||
|
||||
print "Scatter plot on columns %s, %s. " % ( sys.argv[3], sys.argv[4] )
|
||||
if skipped_lines > 0:
|
||||
msg += " skipped %d lines starting with line #%d. Value '%s' in column %d is not numeric." % ( skipped_lines, first_invalid_line, invalid_value, invalid_column )
|
||||
|
||||
print msg
|
||||
print "Skipped %d lines starting with line #%d, value '%s' in column %d is not numeric." % ( skipped_lines, first_invalid_line, invalid_value, invalid_column )
|
||||
|
||||
r.quit( save="no" )
|
||||
|
||||
|
||||
Reference in New Issue
Block a user