[Jtreeview-cvs] jtreeview commit notification
Brought to you by:
alokito
|
From: Alex S. <av...@us...> - 2004-07-01 20:36:29
|
Update of /cvsroot/jtreeview/LinkedView/src/edu/stanford/genetics/treeview/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12946/src/edu/stanford/genetics/treeview/model Modified Files: Tag: SpellmanBeta TVModelLoader.java TVModel.java KnnModel.java FlatFileParser.java ProgressTrackable.java LoadProgress.java LoadProgress2.java FlatFileStreamTokenizer.java Added Files: Tag: SpellmanBeta AtrTVModelLoader.java AtrTVModel.java Log Message: --- NEW FILE: AtrTVModelLoader.java --- /* BEGIN_HEADER Java TreeView * * $Author: avsegal * $RCSfile: AtrTVModelLoader.java * $Revision: * $Date: Jun 25, 2004 * $Name: * * This file is part of Java TreeView * Copyright (C) 2001-2003 Alok Saldanha, All Rights Reserved. * * This software is provided under the GNU GPL Version 2. In particular, * * 1) If you modify a source file, make a comment in it containing your name and the date. * 2) If you distribute a modified version, you must do it under the GPL 2. * 3) Developers are encouraged but not required to notify the Java TreeView maintainers at al...@ge... when they make a useful addition. It would be nice if significant contributions could be merged into the main distribution. * * A full copy of the license can be found in gpl.txt or online at * http://www.gnu.org/licenses/gpl.txt * * END_HEADER */ package edu.stanford.genetics.treeview.model; import edu.stanford.genetics.treeview.LoadException; import java.awt.Frame; import java.util.Vector; import java.io.*; /** * @author avsegal * * To change the template for this generated type comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ public class AtrTVModelLoader extends TVModelLoader { /** * @param targetModel */ public AtrTVModelLoader(AtrTVModel targetModel) { super(targetModel); } protected void parseCDT(Vector tempVector) throws LoadException { super.findCdtDimensions(tempVector); super.loadArrayAnnotation(tempVector); super.loadGeneAnnotation(tempVector); } } Index: TVModelLoader.java =================================================================== RCS file: /cvsroot/jtreeview/LinkedView/src/edu/stanford/genetics/treeview/model/TVModelLoader.java,v retrieving revision 1.13 retrieving revision 1.13.2.1 diff -C2 -d -r1.13 -r1.13.2.1 *** TVModelLoader.java 5 Apr 2004 17:50:31 -0000 1.13 --- TVModelLoader.java 1 Jul 2004 20:36:19 -0000 1.13.2.1 *************** *** 336,340 **** // finds ngene, nexpr, nArrayPrefix, nGenePrefix // ! private void findCdtDimensions(Vector tempVector) { println("Finding Cdt Dimensions"); int ngene, nexpr, nArrayPrefix, nGenePrefix; --- 336,340 ---- // finds ngene, nexpr, nArrayPrefix, nGenePrefix // ! protected void findCdtDimensions(Vector tempVector) { println("Finding Cdt Dimensions"); int ngene, nexpr, nArrayPrefix, nGenePrefix; *************** *** 393,397 **** } ! private void loadArrayAnnotation(Vector tempVector) { // cols to skip over before arrays begin... int nGenePrefix = targetModel.getNGenePrefix(); --- 393,397 ---- } ! protected void loadArrayAnnotation(Vector tempVector) { // cols to skip over before arrays begin... int nGenePrefix = targetModel.getNGenePrefix(); *************** *** 415,419 **** } ! private void loadGeneAnnotation(Vector tempVector) { // how many cols of annotation? int nGenePrefix = targetModel.getNGenePrefix(); --- 415,419 ---- } ! protected void loadGeneAnnotation(Vector tempVector) { // how many cols of annotation? int nGenePrefix = targetModel.getNGenePrefix(); --- NEW FILE: AtrTVModel.java --- /* BEGIN_HEADER Java TreeView * * $Author: avsegal * $RCSfile: AtrTVModel.java * $Revision: * $Date: Jun 25, 2004 * $Name: * * This file is part of Java TreeView * Copyright (C) 2001-2003 Alok Saldanha, All Rights Reserved. * * This software is provided under the GNU GPL Version 2. In particular, * * 1) If you modify a source file, make a comment in it containing your name and the date. * 2) If you distribute a modified version, you must do it under the GPL 2. * 3) Developers are encouraged but not required to notify the Java TreeView maintainers at al...@ge... when they make a useful addition. It would be nice if significant contributions could be merged into the main distribution. * * A full copy of the license can be found in gpl.txt or online at * http://www.gnu.org/licenses/gpl.txt * * END_HEADER */ package edu.stanford.genetics.treeview.model; /** * @author avsegal * * To change the template for this generated type comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ import edu.stanford.genetics.treeview.*; import java.util.*; import java.awt.*; import java.io.*; import java.awt.event.*; import javax.swing.*; public class AtrTVModel extends TVModel { /** * */ public AtrTVModel() { super(); } public double getValue(int x, int y) { return -1; } public void setExprData(double [] newData) { } public XmlConfig getDocumentConfig() { return null; } public void setDocumentConfig(XmlConfig newVal) { } public void setFrame(Frame f) { } public Frame getFrame() { return null; } public MenuItem getStatMenuItem() { return null; } public void loadNew(FileSet fileSet) throws LoadException { resetState(); setSource(fileSet); final AtrTVModelLoader loader = new AtrTVModelLoader(this); loader.loadInto(); } } Index: TVModel.java =================================================================== RCS file: /cvsroot/jtreeview/LinkedView/src/edu/stanford/genetics/treeview/model/TVModel.java,v retrieving revision 1.11 retrieving revision 1.11.2.1 diff -C2 -d -r1.11 -r1.11.2.1 *** TVModel.java 18 May 2004 18:17:16 -0000 1.11 --- TVModel.java 1 Jul 2004 20:36:19 -0000 1.11.2.1 *************** *** 159,162 **** --- 159,277 ---- return target; } + /** + * Reorders all the arrays in the new ordering. + * @param ordering the new ordering of arrays, must have size equal to number of arrays + */ + public void reorderArrays(int [] ordering) + { + if(ordering == null || ordering.length != aHeaders.length) // make sure input to function makes sense + { + return; + } + + + DataMatrix data = getDataMatrix(); + + for(int j = 0; j < data.getNumRow(); j++) + { + double [] temp = new double[data.getNumCol()]; + for(int i = 0; i < data.getNumCol(); i++) + { + temp[i] = data.getValue(ordering[i], j); + } + for(int i = 0; i < data.getNumCol(); i++) + { + data.setValue(temp[i], i, j); + } + } + + String [][] temp2 = new String[aHeaders.length][]; + + for(int i = 0; i < aHeaders.length; i++) + { + temp2[i] = aHeaders[ordering[i]]; + } + setArrayHeaders(temp2); + hashAIDs(); + + + setChanged(); + } + + /** + * Reset order in config file to the identity ordering. + */ + public void clearOrder() + { + ConfigNode order = documentConfig.getNode("ArrayOrder"); + + for(int i = 0; i < aHeaders.length; i++) + { + order.setAttribute("Position" + i, i, i); + } + } + + + /** + * Save a reordering to the config node. + * @param ordering the ordering to save + */ + public void saveOrder(int [] ordering) + { + ConfigNode order = documentConfig.getNode("ArrayOrder"); + + int prevVal = 0; + int [] temp = new int[aHeaders.length]; + + for(int i = 0; i < aHeaders.length; i++) + { + prevVal = order.getAttribute("Position" + ordering[i], -1); + if(prevVal == -1) + { + temp[i] = ordering[i]; + } + else + { + temp[i] = prevVal; + } + } + + //System.out.print("Saved ordering: "); + for(int i = 0; i < aHeaders.length; i++) + { + order.setAttribute("Position" + i, temp[i], -1); + // System.out.print(order.getAttribute("Position" + i, -1) + " "); + } + //System.out.println(); + + } + + /** + * Load array order from the config node. + */ + public void loadOrder() + { + if(documentConfig == null) + { + return; + } + + ConfigNode order = documentConfig.getNode("ArrayOrder"); + + int [] ordering = new int[aHeaders.length]; + + int prevVal = 0; + + + //System.out.print("Loaded ordering: "); + for(int i = 0; i < ordering.length; i++) + { + ordering[i] = order.getAttribute("Position" + i, i); + // System.out.print(ordering[i] + " "); + } + //System.out.println(); + + reorderArrays(ordering); + } public void resetState () { *************** *** 324,327 **** --- 439,447 ---- } } + public void setValue(double value, int x, int y) + { + exprData[x + y*nexpr] = value; + setChanged(); + } public int getNumRow() { return ngene; |