Fixed scatterplot tool to use ColumnList parameter and deleted some unused files.

This commit is contained in:
Greg Von Kuster
2007-09-07 13:58:08 +00:00
parent 166893ef9d
commit 6ebc7a706e
5 changed files with 9 additions and 116 deletions
+3
View File
@@ -62,6 +62,7 @@ def main():
r.hist( a, probability=True, main=title, xlab=xlab, breaks=breaks )
if density:
r.lines( r.density( a ) )
r.dev_off()
except exc:
stop_err("Building histogram resulted in error: %s." %str( exc ))
else:
@@ -70,5 +71,7 @@ def main():
if skipped_lines > 0:
print "..skipped %d invalid lines starting with line #%d. Value '%s' is not numeric." % ( skipped_lines, first_invalid_line, invalid_value )
r.quit( save="no" )
if __name__ == "__main__":
main()
-31
View File
@@ -1,31 +0,0 @@
<tool id="Histogram1" name="Histogram">
<description>for any numeric column</description>
<command interpreter="python">plotter.py $input $col $bins $out_file1 hist</command>
<inputs>
<!-- <display>on column $col of $input with $bins bins</display> -->
<param format="text" name="input" type="data" label="Select Query" />
<param name="col" size="4" type="integer" value="5" label="Column to plot" />
<param name="bins" size="4" type="integer" value="10" label="Number of bins" />
</inputs>
<outputs>
<data format="png" name="out_file1" />
</outputs>
<code file="plot_filter.py"/>
<help>
This tool builds a simple histogram for a given data column using a specified number of bins:
-----
**Syntax**
- **Column to plot** is an integer. The first column is **1**
- **Number of bins** is an integer between 1 and 99
-----
**Example**
.. image:: ../static/images/histogram.png
</help>
</tool>
-32
View File
@@ -1,32 +0,0 @@
<tool id="Scatterplot1" name="Scatterplot">
<description>for any numeric column</description>
<command interpreter="python">plotter.py $input $col $style $out_file1 scatter</command>
<inputs>
<!-- <display>on column $col of $input show $style</display> -->
<param format="text" name="input" type="data" label="Select Query"/>
<param name="col" size="4" type="integer" value="5" label="Column to plot"/>
<param name="style" type="select" label="Plot style">
<option value="L">Lines</option>
<option value="P">Points</option>
<option value="LP">Lines&amp;Points</option>
</param>
</inputs>
<outputs>
<data format="png" name="out_file1" />
</outputs>
<help>This tool creates a simple scatterplot for a selected Query
-----
**Syntax**
- **Column to plot** is an integer. The first column is **1**
-----
**Example**
.. image:: ../static/images/scatter.png
</help>
</tool>
+6 -11
View File
@@ -2,16 +2,12 @@
<description>of two numeric columns</description>
<command interpreter="python">scatterplot.py $input $out_file1 $col1 $col2 "$title" "$xlab" "$ylab"</command>
<inputs>
<page>
<param name="input" format="tabular" type="data" label="Dataset" help="Query missing? See TIP below"/>
</page>
<page>
<param name="col1" type="select" label="Column for x axis" dynamic_options="get_columns( input )" />
<param name="col2" type="select" label="Column for y axis" dynamic_options="get_columns( input )" />
<param name="title" size="30" type="text" value="Scatterplot" label="Plot title"/>
<param name="xlab" size="30" type="text" value="V1" label="Label for x axis"/>
<param name="ylab" size="30" type="text" value="V2" label="Label for y axis"/>
</page>
<param name="input" type="data" format="tabular" label="Dataset" refresh_on_change="True" help="Query missing? See TIP below"/>
<param name="col1" type="columnlist" assoc_dataset="input" numerical="True" label="Numerical column for x axis" />
<param name="col2" type="columnlist" assoc_dataset="input" numerical="True" label="Numerical column for y axis" />
<param name="title" size="30" type="text" value="Scatterplot" label="Plot title"/>
<param name="xlab" size="30" type="text" value="V1" label="Label for x axis"/>
<param name="ylab" size="30" type="text" value="V2" label="Label for y axis"/>
</inputs>
<outputs>
<data format="pdf" name="out_file1" />
@@ -55,5 +51,4 @@ This tool creates a simple scatter plot between two variables containing numeric
.. image:: ../static/images/scatterplot.png
</help>
<code file="scatterplot_code.py" />
</tool>
-42
View File
@@ -1,42 +0,0 @@
def get_columns( input ):
columns = []
elems = []
for i, line in enumerate( file ( input.file_name ) ):
valid = True
if line and not line.startswith( '#' ):
line = line.rstrip('\r\n')
elems = line.split( '\t' )
"""
Since this tool requires users to select only those columns
that contain numerical values, we'll restrict the column select
list appropriately.
"""
if len(elems) > 0:
for col in range(1, input.metadata.columns+1):
try:
val = float(elems[col-1])
valid = True
except:
val = elems[col-1]
if val:
if val.strip().lower() == "na":
valid = True
else:
valid = False
else:
valid = False
if valid:
option = "c" + str(col)
columns.append((option,str(col),False))
if len(columns) > 0:
"""
We have our select list built, so we can break out of the outer most for loop
"""
break
if i == 30:
break # Hopefully we never get here...
return columns