edu.iastate.metnet.metaomgraph.chart
Class DataSorter

java.lang.Object
  extended by edu.iastate.metnet.metaomgraph.chart.DataSorter

public class DataSorter
extends java.lang.Object

Constructs sort-order arrays for MetaOmChartPanels.

Author:
Nick Ransom

Constructor Summary
DataSorter(MetaOmChartPanel mcp)
           
 
Method Summary
 int[] defaultOrder()
          Sorts the data as it appeared in the original data file.
 java.util.Vector<RangeMarker> getRangeMarkers()
          Gets a Vector of RangeMarkers from the last sort operation.
 void setRangeMarkers(java.util.Vector<RangeMarker> rangeMarkers)
           
 int[] sortByColumnName()
          Sorts the data alphabetically by column name.
 int[] sortByExtendedInfo()
          Displays a frame that allows the user to construct a query, then searches the active project's extended info tree for hits.
 int[] sortByPOs()
          Sorts data by Plant Ontology information.
 int[] sortByYValue(double[] yvalues)
          Sorts the data according to a second array of values, such that the index of the highest value in the passed array appears in the first cell of the result array.
 int[] sortCustom()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataSorter

public DataSorter(MetaOmChartPanel mcp)
Method Detail

sortByColumnName

public int[] sortByColumnName()
Sorts the data alphabetically by column name.

Returns:
An array whose length is the same as the number of data columns in the active project. [0] contains the index of the alphabetically first data column, [1] contains the index of the second, and so on.

defaultOrder

public int[] defaultOrder()
Sorts the data as it appeared in the original data file.

Returns:
An array whose length is the same as the number of data columns in the active project. [0] contains the value 0, [1] contains 1, and so on.

sortByYValue

public int[] sortByYValue(double[] yvalues)
Sorts the data according to a second array of values, such that the index of the highest value in the passed array appears in the first cell of the result array.

Parameters:
yvalues - The array to sort by. Its length must be the same as the number of data columns in the active project.
Returns:
An array in which [0] contains the index of the largest value in yvalue, [1] contains the index of the second largest, and so on.

sortByExtendedInfo

public int[] sortByExtendedInfo()
Displays a frame that allows the user to construct a query, then searches the active project's extended info tree for hits. After this method is run, getLastSortObject() will return a SortResultObject with start value 0 and end value equal to the number of hits.

Returns:
An array in which [0]...[getLastSortResultObject().getEnd()] contain the indices of the "hits" in the order they orignally appeared. The remaining cells contain the indices of the "misses" in their original order. Returns null if the user cancels the query dialog.

sortByPOs

public int[] sortByPOs()
Sorts data by Plant Ontology information. When this method is called, a prompt appears to ask what type of sort (by number or by tissue) the user wants to perform. After the sort is complete, getLastSortObject will return a Vector of SortResultObjects whose getStart() and getEnd() methods mark the start and end of each PO section, and whose getLabel() method returns the matched string (PO number+name for number sort, just PO name for tissue sort). The vector is ordered such that the second SortResultObject starts where the first ends, and so on.

Returns:
An array with indices of indentical PO strings clumped together. Returns null if the user cancels the prompt, or if there is no PO information loaded.

sortCustom

public int[] sortCustom()

getRangeMarkers

public java.util.Vector<RangeMarker> getRangeMarkers()
Gets a Vector of RangeMarkers from the last sort operation.

Returns:
a Vector of RangeMarkers from the last sort operation.

setRangeMarkers

public void setRangeMarkers(java.util.Vector<RangeMarker> rangeMarkers)