|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.peace_tools.data.OverlapModel
public class OverlapModel
A custom data model to provide pre-alignment information using MST and clustering data.
This class servers as a light weight wrapper to adapt the in-memory MST and clustering representation to be displayed in a custom view. The term "model" is being used in the context of the Model-View-Controller (MVC) pattern. The custom view provides a high-level summary information about the type of alignment that is to be expected from the clustering data. The MST and clustering data are used in the following manner:
The MST data contains information as to where the maximum overlap between a parent-and-child was detected. This information is used to layout the fragments in a FASTA file in a tabular form with related fragments organized next to each other illustrating the overlap.
Note that not all MST files contain the relative location information. This information is vital for this data model to work. Consequently, when MST data does not have the positional information, this model generates an error.
Field Summary | |
---|---|
private ClusterFile |
clusterFile
Reference to the cluster file that contains the cluster information that was used to generate this pre-alignment model. |
private java.util.ArrayList<ClusterNode> |
clusterList
This list contains the list of clusters (that may be sorted) being displayed to the user. |
private java.util.ArrayList<ESTEntry> |
estEntryList
The list of EST entry objects encapsulated by this data model. |
private java.util.ArrayList<java.util.ArrayList<ESTEntry>> |
estEntryTable
A table (A sparse 2-dimensional array) of ESTEntries. |
private ESTList |
estList
Reference to the EST file that contains the fragment data that is to be adapted and presented by this model. |
private java.util.ArrayList<javax.swing.event.ListDataListener> |
listListeners
The set of list model listeners that were added to this model. |
private int |
maxCol
The widest row in the estEntryTable. |
private int |
selectedCluster
Instance variable to track the currently selected/visible cluster entry in a combo box. |
private MSTClusterData |
wsEntry
A handy reference to the workspace entry from which the data for this overlap model was partially obtained. |
Constructor Summary | |
---|---|
OverlapModel(ClusterFile clusters,
ESTList ests,
MSTClusterData wsEntry)
The constructor. |
Method Summary | |
---|---|
void |
addListDataListener(javax.swing.event.ListDataListener ldl)
Adds a listener to be notified when the data associated with the model changes. |
private void |
addToESTEntryTable(int row,
ESTEntry entry)
Add an entry to the specified row in the estEntryTable. |
private void |
buildClusterList(ClusterFile clusterFile)
Helper method to populate local list of clusters from a cluster file. |
static OverlapModel |
create(ClusterFile clusters,
ESTList ests,
MST mst,
MSTClusterData wsEntry)
The constructor. |
protected void |
fireDataChanged()
Helper method to notify listeners whenever data changes. |
private static void |
generateClusterLookupTable(int parentClusterID,
ClusterNode node,
int[] clusterIDList)
Helper method to build a table (simple array) that provides clusterID for each fragment. |
private void |
generateESTEntries(MSTNode parent,
int startPos,
int[] clusterIDList,
int prevClusterID,
int lastRow,
java.util.ArrayList<java.lang.Long> rowUsage)
Recursive method to generate ESTEntry objects with alignment information. |
ClusterFile |
getClusterFile()
Obtain the cluster file information from where this pre-alignment model was built. |
ClusterNode |
getElementAt(int index)
Obtain the cluster node in the combo box list at a given index. |
ESTList |
getESTList()
Obtain the list of ESTs associated with this model. |
private int |
getFarthestPos(MSTNode parent)
Helper method to determine how far-left the pre-alignment extends given the root is at logical position zero. |
int |
getMaxCol()
Obtain the last column where a nucleotide is present. |
int |
getMaxRow()
Determine the maximum number of rows in this overlap model. |
java.util.ArrayList<ESTEntry> |
getRow(int row)
Obtain the list of EST entries on a given row in the model. |
private static int |
getRow(int start,
int end,
int startRow,
java.util.ArrayList<java.lang.Long> rowUsage)
This is a helper method that is used to determine the row on which a fragment can be accommodated. |
ClusterNode |
getSelectedItem()
Obtain the currently displayed cluster in the combo box. |
int |
getSize()
Obtain the number of entries to be displayed in the combo box. |
MSTClusterData |
getWsEntry()
Obtain the actual workspace entry whose data is contained in this model. |
void |
removeListDataListener(javax.swing.event.ListDataListener ldl)
Removes a listener from the list of listeners maintained by this class. |
void |
setSelectedItem(java.lang.Object anItem)
Set the selected (item being displayed) item in a combo box. |
void |
sort(int order)
Method to change the order in which clusters are ordered. |
private static long |
toLong(int hiInt,
int lowInt)
A simple helper method to combine two integers into a long. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final ESTList estList
private final ClusterFile clusterFile
private final MSTClusterData wsEntry
private java.util.ArrayList<java.util.ArrayList<ESTEntry>> estEntryTable
generateESTEntries(MSTNode, int, int[], int, int, ArrayList)
method.
Note The ESTEntry objects in each row of this table are sorted
based on the starting column of each entry. This information is used by
the view to optimize rendering.
private int maxCol
private java.util.ArrayList<ESTEntry> estEntryList
generateESTEntries(MSTNode, int, int[], int, int, ArrayList)
private java.util.ArrayList<ClusterNode> clusterList
private java.util.ArrayList<javax.swing.event.ListDataListener> listListeners
private int selectedCluster
Constructor Detail |
---|
public OverlapModel(ClusterFile clusters, ESTList ests, MSTClusterData wsEntry)
clusters
- The set of clusters to be displayed by this class.ests
- The set of ESTs that contain information about each
EST in the clusters.wsEntry
- The clustering data work space entry from where the
overlap view was launched.Method Detail |
---|
public static OverlapModel create(ClusterFile clusters, ESTList ests, MST mst, MSTClusterData wsEntry)
clusters
- The set of clusters to be displayed by this class.ests
- The set of ESTs that contain information about each
EST in the clusters.wsEntry
- The clustering data work space entry from where the
overlap view was launched.public ClusterNode getSelectedItem()
getSelectedItem
in interface javax.swing.ComboBoxModel
public void setSelectedItem(java.lang.Object anItem)
setSelectedItem
in interface javax.swing.ComboBoxModel
anItem
- The item to be displayed in the combo box.public void addListDataListener(javax.swing.event.ListDataListener ldl)
addListDataListener
in interface javax.swing.ListModel
ldl
- The listener to be added to the list of listeners to
be notified when the data associated with the workspace changes.ListModel
public void removeListDataListener(javax.swing.event.ListDataListener ldl)
removeListDataListener
in interface javax.swing.ListModel
ldl
- The listener to be removed from the list of listeners
to receive updates.ListModel
public ClusterNode getElementAt(int index)
getElementAt
in interface javax.swing.ListModel
index
- The index of the entry whose element is to be returned
by this method. This value must be in the range 0 ≤ index < getSize()
public int getSize()
getSize
in interface javax.swing.ListModel
public ESTList getESTList()
public ClusterFile getClusterFile()
public int getMaxCol()
public int getMaxRow()
public java.util.ArrayList<ESTEntry> getRow(int row)
row
- The row for which the list of fragments are to be returned.
public MSTClusterData getWsEntry()
protected void fireDataChanged()
public void sort(int order)
order
- The order in which the clusters are to be sorted. The
following values are valid for this parameter: 0: no sorting,
1: smaller clusters first, 2: smaller clusters last.private int getFarthestPos(MSTNode parent)
parent
- The parent node whose farthest child position is to be
determined. This method is typically invoked with the root of the MST
tree.
private void buildClusterList(ClusterFile clusterFile)
clusterFile
- The cluster file to be processed by this method to
extract the list of clusters to be managed by this class.private void addToESTEntryTable(int row, ESTEntry entry)
maxCol
instance variable
to reflect the farthest nucleotide in the table (across all rows).
row
- The row in the estEntryTable to which the given entry is
to be added.entry
- The newly created entry to be added to the estEntryTable
at the specified row.private void generateESTEntries(MSTNode parent, int startPos, int[] clusterIDList, int prevClusterID, int lastRow, java.util.ArrayList<java.lang.Long> rowUsage)
parent
- The MST node (and its children) that must be aligned
by this method. This method is initially invoked on the root of the MST.startPos
- The starting base pair position relative to which the
parent and its child nodes are to be positioned.clusterIDList
- The lookup table that has been populated by the
generateClusterLookupTable(int, ClusterNode, int[])
method. This method uses the look up table to determine the cluster ID when
generating ESTEntry objects for each fragment.prevClusterID
- This parameter is used to track the ID of the
previous cluster to which an entry was added. When moving from one cluster
to another, the lastRow value is reset to 0.lastRow
- The last row in the rowUsage list where the previous entry was
placed.rowUsage
- The array of row usage information that is used to determine
when a row is available to accommodate a given entry.private static void generateClusterLookupTable(int parentClusterID, ClusterNode node, int[] clusterIDList)
parentClusterID
- The logical cluster ID of the parent cluster to which the
given child node logically belongs.node
- The child node in the cluster hierarchy whose leaf fragment entries
are to be cataloged in the lookup table.clusterIDList
- The lookup table being populated by this method. The array must
be exactly the same size as the number of fragments in the FASTA file.generateESTEntries(MSTNode, int, int[], int, int, ArrayList)
private static long toLong(int hiInt, int lowInt)
hiInt
- The high 32-bit value to be stored in the long.lowInt
- The low 32-bit value to be stored in the long.
private static int getRow(int start, int end, int startRow, java.util.ArrayList<java.lang.Long> rowUsage)
start
- The starting column where the fragment is to be placed.end
- The ending column where the fragment will end.startRow
- The starting row from where the search is to be done.
This value must be 0.rowUsage
- The row
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |