2 |
26 Feb 07 |
jari |
1 |
/* |
2 |
26 Feb 07 |
jari |
Copyright @ 1999-2003, The Institute for Genomic Research (TIGR). |
2 |
26 Feb 07 |
jari |
All rights reserved. |
2 |
26 Feb 07 |
jari |
4 |
*/ |
2 |
26 Feb 07 |
jari |
5 |
/* |
2 |
26 Feb 07 |
jari |
* $RCSfile: InfoDisplay.java,v $ |
2 |
26 Feb 07 |
jari |
* $Revision: 1.12 $ |
2 |
26 Feb 07 |
jari |
* $Date: 2006/03/24 15:49:44 $ |
2 |
26 Feb 07 |
jari |
* $Author: eleanorahowe $ |
2 |
26 Feb 07 |
jari |
* $State: Exp $ |
2 |
26 Feb 07 |
jari |
11 |
*/ |
2 |
26 Feb 07 |
jari |
12 |
package org.tigr.microarray.mev; |
2 |
26 Feb 07 |
jari |
13 |
|
2 |
26 Feb 07 |
jari |
14 |
import java.awt.Color; |
2 |
26 Feb 07 |
jari |
15 |
import java.awt.Font; |
2 |
26 Feb 07 |
jari |
16 |
import java.awt.GridBagLayout; |
2 |
26 Feb 07 |
jari |
17 |
import java.awt.Insets; |
2 |
26 Feb 07 |
jari |
18 |
import java.awt.event.ActionEvent; |
2 |
26 Feb 07 |
jari |
19 |
import java.awt.event.ActionListener; |
2 |
26 Feb 07 |
jari |
20 |
import java.awt.event.KeyEvent; |
2 |
26 Feb 07 |
jari |
21 |
import java.awt.event.KeyListener; |
2 |
26 Feb 07 |
jari |
22 |
import java.util.Hashtable; |
2 |
26 Feb 07 |
jari |
23 |
import java.util.Vector; |
2 |
26 Feb 07 |
jari |
24 |
|
2 |
26 Feb 07 |
jari |
25 |
import javax.swing.ImageIcon; |
2 |
26 Feb 07 |
jari |
26 |
import javax.swing.JButton; |
2 |
26 Feb 07 |
jari |
27 |
import javax.swing.JEditorPane; |
2 |
26 Feb 07 |
jari |
28 |
import javax.swing.JFrame; |
2 |
26 Feb 07 |
jari |
29 |
import javax.swing.JLabel; |
2 |
26 Feb 07 |
jari |
30 |
import javax.swing.JScrollPane; |
2 |
26 Feb 07 |
jari |
31 |
import javax.swing.ScrollPaneConstants; |
2 |
26 Feb 07 |
jari |
32 |
|
2 |
26 Feb 07 |
jari |
33 |
import org.tigr.graph.GC; |
2 |
26 Feb 07 |
jari |
34 |
import org.tigr.graph.GraphLine; |
2 |
26 Feb 07 |
jari |
35 |
import org.tigr.graph.GraphPoint; |
2 |
26 Feb 07 |
jari |
36 |
import org.tigr.graph.GraphTick; |
2 |
26 Feb 07 |
jari |
37 |
import org.tigr.graph.GraphViewer; |
2 |
26 Feb 07 |
jari |
38 |
import org.tigr.microarray.mev.cluster.gui.IData; |
2 |
26 Feb 07 |
jari |
39 |
import org.tigr.util.Xcon; |
2 |
26 Feb 07 |
jari |
40 |
import org.tigr.util.awt.ActionInfoDialog; |
2 |
26 Feb 07 |
jari |
41 |
import org.tigr.util.awt.GBA; |
2 |
26 Feb 07 |
jari |
42 |
|
2 |
26 Feb 07 |
jari |
43 |
public class InfoDisplay extends ActionInfoDialog { |
2 |
26 Feb 07 |
jari |
44 |
|
2 |
26 Feb 07 |
jari |
45 |
private int feature; |
2 |
26 Feb 07 |
jari |
46 |
private int probe; |
2 |
26 Feb 07 |
jari |
47 |
private MultipleArrayData data; |
2 |
26 Feb 07 |
jari |
48 |
private ISlideData slideData; |
2 |
26 Feb 07 |
jari |
49 |
private ISlideDataElement element; |
2 |
26 Feb 07 |
jari |
50 |
private int dataType; |
2 |
26 Feb 07 |
jari |
51 |
|
2 |
26 Feb 07 |
jari |
52 |
private int LINEAR = 0; // to return just ratio |
2 |
26 Feb 07 |
jari |
53 |
private int LOG = 1; //for log2(ratio) |
2 |
26 Feb 07 |
jari |
54 |
|
2 |
26 Feb 07 |
jari |
// from single array wiewer |
2 |
26 Feb 07 |
jari |
56 |
public InfoDisplay(JFrame parent, ISlideData slideData, ISlideDataElement element, int probe) { |
2 |
26 Feb 07 |
jari |
57 |
super(parent, false); |
2 |
26 Feb 07 |
jari |
58 |
this.probe = probe; |
2 |
26 Feb 07 |
jari |
59 |
dataType = slideData.getDataType(); |
2 |
26 Feb 07 |
jari |
60 |
init(slideData, element); |
2 |
26 Feb 07 |
jari |
61 |
} |
2 |
26 Feb 07 |
jari |
62 |
|
2 |
26 Feb 07 |
jari |
// from multiple array wiewer |
2 |
26 Feb 07 |
jari |
64 |
public InfoDisplay(JFrame parent, MultipleArrayData data, int feature, int probe) { |
2 |
26 Feb 07 |
jari |
65 |
super(parent, false); |
2 |
26 Feb 07 |
jari |
66 |
this.data = data; |
2 |
26 Feb 07 |
jari |
67 |
this.feature = feature; |
2 |
26 Feb 07 |
jari |
68 |
this.probe = probe; |
2 |
26 Feb 07 |
jari |
69 |
this.dataType = data.getDataType(); |
2 |
26 Feb 07 |
jari |
70 |
init(data.getFeature(feature), data.getSlideDataElement(feature, probe)); |
2 |
26 Feb 07 |
jari |
71 |
} |
2 |
26 Feb 07 |
jari |
72 |
|
2 |
26 Feb 07 |
jari |
73 |
private void init(ISlideData slideData, ISlideDataElement element) { |
2 |
26 Feb 07 |
jari |
74 |
this.slideData = slideData; |
2 |
26 Feb 07 |
jari |
75 |
this.element = element; |
2 |
26 Feb 07 |
jari |
76 |
|
2 |
26 Feb 07 |
jari |
77 |
Font infoDisplayFont = new Font("Arial", Font.PLAIN, 10); //new Font("monospaced", Font.PLAIN, 10); |
2 |
26 Feb 07 |
jari |
78 |
JLabel spotImage = new JLabel(new ImageIcon(org.tigr.microarray.mev.InfoDisplay.class.getResource("/org/tigr/images/spot.gif"))); |
2 |
26 Feb 07 |
jari |
79 |
|
2 |
26 Feb 07 |
jari |
80 |
EventListener listener = new EventListener(); |
2 |
26 Feb 07 |
jari |
81 |
|
2 |
26 Feb 07 |
jari |
82 |
JEditorPane infoDisplayTextPane = new JEditorPane(); |
2 |
26 Feb 07 |
jari |
83 |
infoDisplayTextPane.setContentType("text/html"); |
2 |
26 Feb 07 |
jari |
84 |
|
2 |
26 Feb 07 |
jari |
85 |
infoDisplayTextPane.setFont(infoDisplayFont); |
2 |
26 Feb 07 |
jari |
86 |
infoDisplayTextPane.setBackground(new Color(Integer.parseInt("FFFFCC",16))); |
2 |
26 Feb 07 |
jari |
87 |
infoDisplayTextPane.setEditable(false); |
2 |
26 Feb 07 |
jari |
88 |
infoDisplayTextPane.setMargin(new Insets(10,15,10,10)); |
2 |
26 Feb 07 |
jari |
89 |
infoDisplayTextPane.setText(createMessage(element)); |
2 |
26 Feb 07 |
jari |
90 |
infoDisplayTextPane.setCaretPosition(0); |
2 |
26 Feb 07 |
jari |
91 |
|
2 |
26 Feb 07 |
jari |
92 |
infoDisplayTextPane.addKeyListener(listener); |
2 |
26 Feb 07 |
jari |
93 |
|
2 |
26 Feb 07 |
jari |
94 |
JButton viewGeneGraphButton = new JButton("Gene Graph"); |
2 |
26 Feb 07 |
jari |
95 |
viewGeneGraphButton.setActionCommand("view-gene-graph"); |
2 |
26 Feb 07 |
jari |
96 |
viewGeneGraphButton.addActionListener(listener); |
2 |
26 Feb 07 |
jari |
97 |
viewGeneGraphButton.setEnabled(false); |
2 |
26 Feb 07 |
jari |
98 |
if (data != null) |
2 |
26 Feb 07 |
jari |
99 |
viewGeneGraphButton.setEnabled(true); |
2 |
26 Feb 07 |
jari |
100 |
|
2 |
26 Feb 07 |
jari |
101 |
JButton viewExperimentButton = new JButton("Sample Detail"); |
2 |
26 Feb 07 |
jari |
//viewExperimentButton.setEnabled(false); |
2 |
26 Feb 07 |
jari |
//viewExperimentButton.setToolTipText("Temporarily Disabled -- visit www.tigr.org/software/TM4 for update."); |
2 |
26 Feb 07 |
jari |
104 |
viewExperimentButton.setActionCommand("view-experiment"); |
2 |
26 Feb 07 |
jari |
105 |
viewExperimentButton.addActionListener(listener); |
2 |
26 Feb 07 |
jari |
106 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim, Temporary Fix for CGH Data |
2 |
26 Feb 07 |
jari |
* All graph views from this option deals with log10 or log transformed data. |
2 |
26 Feb 07 |
jari |
* Need to figure out how to handle the scenario with CGH data |
2 |
26 Feb 07 |
jari |
110 |
*/ |
2 |
26 Feb 07 |
jari |
111 |
if(data.isCGHData()) viewExperimentButton.setEnabled(false); |
2 |
26 Feb 07 |
jari |
112 |
|
2 |
26 Feb 07 |
jari |
113 |
JButton setColorButton = new JButton("Set Gene Color"); |
2 |
26 Feb 07 |
jari |
114 |
setColorButton.setActionCommand("set-color"); |
2 |
26 Feb 07 |
jari |
115 |
setColorButton.addActionListener(listener); |
2 |
26 Feb 07 |
jari |
116 |
setColorButton.setEnabled(false); |
2 |
26 Feb 07 |
jari |
117 |
|
2 |
26 Feb 07 |
jari |
118 |
JButton closeButton = new JButton("Close Spot Information"); |
2 |
26 Feb 07 |
jari |
119 |
closeButton.setActionCommand("close"); |
2 |
26 Feb 07 |
jari |
120 |
closeButton.addActionListener(listener); |
2 |
26 Feb 07 |
jari |
121 |
|
2 |
26 Feb 07 |
jari |
122 |
contentPane.setLayout(new GridBagLayout()); |
2 |
26 Feb 07 |
jari |
123 |
JScrollPane scrollPane = new JScrollPane(infoDisplayTextPane, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); |
2 |
26 Feb 07 |
jari |
124 |
scrollPane.getViewport().setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
125 |
GBA gba = new GBA(); |
2 |
26 Feb 07 |
jari |
126 |
gba.add(contentPane, scrollPane, 0, 0, 3, 2, 1, 1, GBA.B, GBA.C, new Insets(5, 5, 5, 5), 0, 0); |
2 |
26 Feb 07 |
jari |
127 |
gba.add(contentPane, viewGeneGraphButton, 0, 2, 1, 1, 0, 0, GBA.NONE, GBA.W, new Insets(5, 5, 5, 5), 0, 0); |
2 |
26 Feb 07 |
jari |
128 |
gba.add(contentPane, viewExperimentButton, 1, 2, 1, 1, 0, 0, GBA.NONE, GBA.C, new Insets(5, 5, 5, 5), 0, 0); |
2 |
26 Feb 07 |
jari |
129 |
gba.add(contentPane, setColorButton, 2, 2, 1, 1, 0, 0, GBA.NONE, GBA.E, new Insets(5, 5, 5, 5), 0, 0); |
2 |
26 Feb 07 |
jari |
130 |
gba.add(contentPane, closeButton, 0, 3, 1, 1, 0, 0, GBA.NONE, GBA.C, new Insets(5, 5, 5, 5), 0, 0); |
2 |
26 Feb 07 |
jari |
131 |
gba.add(contentPane, spotImage, 2, 3, 1, 1, 0, 0, GBA.NONE, GBA.E, new Insets(5, 5, 5, 5), 0, 0); |
2 |
26 Feb 07 |
jari |
132 |
pack(); |
2 |
26 Feb 07 |
jari |
133 |
setSize(600, 500); |
2 |
26 Feb 07 |
jari |
134 |
setResizable(true); |
2 |
26 Feb 07 |
jari |
135 |
setTitle("Spot Information"); |
2 |
26 Feb 07 |
jari |
136 |
setLocation(300, 100); |
2 |
26 Feb 07 |
jari |
137 |
show(); |
2 |
26 Feb 07 |
jari |
138 |
} |
2 |
26 Feb 07 |
jari |
139 |
|
2 |
26 Feb 07 |
jari |
140 |
/* |
2 |
26 Feb 07 |
jari |
private String createMessage(ISlideDataElement element) { |
2 |
26 Feb 07 |
jari |
int stringLength = 0; |
2 |
26 Feb 07 |
jari |
int trueRow = element.getRow(ISlideDataElement.BASE); |
2 |
26 Feb 07 |
jari |
int trueColumn = element.getColumn(ISlideDataElement.BASE); |
2 |
26 Feb 07 |
jari |
float cy3 = this.slideData.getCY3(this.probe); |
2 |
26 Feb 07 |
jari |
float cy5 = this.slideData.getCY5(this.probe); |
2 |
26 Feb 07 |
jari |
147 |
|
2 |
26 Feb 07 |
jari |
// float cy3 = element.getTrueIntensity(ISlideDataElement.CY3); |
2 |
26 Feb 07 |
jari |
// float cy5 = element.getTrueIntensity(ISlideDataElement.CY5); |
2 |
26 Feb 07 |
jari |
// float ratio = element.getTrueRatio(ISlideDataElement.CY5, ISlideDataElement.CY3, LINEAR); |
2 |
26 Feb 07 |
jari |
// float logRatio = element.getTrueRatio(ISlideDataElement.CY5, ISlideDataElement.CY3, LOG); |
2 |
26 Feb 07 |
jari |
float ratio = cy5/cy3; |
2 |
26 Feb 07 |
jari |
153 |
|
2 |
26 Feb 07 |
jari |
float logRatio; |
2 |
26 Feb 07 |
jari |
155 |
|
2 |
26 Feb 07 |
jari |
if(cy3 < 0 || cy5 < 0) //for data input where neg. is posible. |
2 |
26 Feb 07 |
jari |
logRatio = Float.NaN; |
2 |
26 Feb 07 |
jari |
else |
2 |
26 Feb 07 |
jari |
logRatio = (float)(Math.log(ratio)/Math.log(2.0)); |
2 |
26 Feb 07 |
jari |
160 |
|
2 |
26 Feb 07 |
jari |
String message = "<html><body bgcolor = \"#FFFFCC\"><basefont face = \"Arial\"><table cellpadding=4 valign=top><th colspan=2>Location and Intensities</th>"; |
2 |
26 Feb 07 |
jari |
162 |
|
2 |
26 Feb 07 |
jari |
if(dataType == this.data.DATA_TYPE_TWO_INTENSITY){ |
2 |
26 Feb 07 |
jari |
message += "<tr><td>Row</td><td>" + trueRow + "</td></tr>"+ |
2 |
26 Feb 07 |
jari |
"<tr><td>Column</td><td>" + trueColumn + "</td></tr>"; |
2 |
26 Feb 07 |
jari |
message += "<tr><td>Cy3</td><td><b>" + cy3 + "</b></td></tr>"+ |
2 |
26 Feb 07 |
jari |
"<tr><td>Cy5</td><td><b>" + cy5 + "</b></td></tr>"; |
2 |
26 Feb 07 |
jari |
message += "<tr><td>Ratio</td><td>" + ratio + "</td></tr>"+ |
2 |
26 Feb 07 |
jari |
"<tr><td>log2(Ratio)</td><td><b>" + logRatio + "</b></td></tr>"; |
2 |
26 Feb 07 |
jari |
} else if(dataType == this.data.DATA_TYPE_AFFY_ABS){ |
2 |
26 Feb 07 |
jari |
message += "<tr><td>File Index</td><td>+" + trueRow + "</td></tr>"; |
2 |
26 Feb 07 |
jari |
message += "<tr><td>Affy Loading Mode</td><td>Absolute</td></tr>"; |
2 |
26 Feb 07 |
jari |
message += "<tr><td>Intensity</td><td><b>" + cy5 + "</b></td></tr>"; |
2 |
26 Feb 07 |
jari |
} else if(dataType == this.data.DATA_TYPE_AFFY_REF){ |
2 |
26 Feb 07 |
jari |
message += "<tr><td>File Index</td><td>" + trueRow + "</td></tr>"; |
2 |
26 Feb 07 |
jari |
message += "<tr><td>Affy Loading Mode</td><td>Reference</td></tr>"; |
2 |
26 Feb 07 |
jari |
message += "<tr><td>Sample Intensity</td><td><b>" + cy5 + "</b></td></tr>"; |
2 |
26 Feb 07 |
jari |
message += "<tr><td>Ref. Intensity</td><td><b>" + cy3 + "</b></td></tr>"; |
2 |
26 Feb 07 |
jari |
message += "<tr><td>Ratio (Sample/Ref.)</td><td>" + ratio + "</td></tr>"+ |
2 |
26 Feb 07 |
jari |
"<tr><td>log2(Ratio)</td><td><b>" + logRatio + "</b></td></tr>"; |
2 |
26 Feb 07 |
jari |
} else if(dataType == this.data.DATA_TYPE_AFFY_MEAN){ |
2 |
26 Feb 07 |
jari |
message += "<tr><td>File Index</td><td>" + trueRow + "</td></tr>"; |
2 |
26 Feb 07 |
jari |
message += "<tr><td>Affy Loading Mode</td><td>Array Set Mean Int. as Ref.</td></tr>"; |
2 |
26 Feb 07 |
jari |
message += "<tr><td>Sample Intensity</td><td><b>" + cy5 + "</b></td></tr>"; |
2 |
26 Feb 07 |
jari |
message += "<tr><td>Array Set Mean Int.</td><td><b>" + cy3 + "</b></td></tr>"; |
2 |
26 Feb 07 |
jari |
message += "<tr><td>Ratio (Sample/Mean)</td><td>" + ratio + "</td></tr>"+ |
2 |
26 Feb 07 |
jari |
"<tr><td>log2(Ratio)</td><td><b>" + logRatio + "</b></td></tr>"; |
2 |
26 Feb 07 |
jari |
} else if(dataType == this.data.DATA_TYPE_AFFY_MEDIAN){ |
2 |
26 Feb 07 |
jari |
message += "<tr><td>File Index</td><td>" + trueRow + "</td></tr>"; |
2 |
26 Feb 07 |
jari |
message += "<tr><td>Affy Loading Mode</td><td>Spot Median as Ref.</td></tr>"; |
2 |
26 Feb 07 |
jari |
message += "<tr><td>Sample Intensity</td><td><b>" + cy5 + "</b></td></tr>"; |
2 |
26 Feb 07 |
jari |
message += "<tr><td>Spot Median Intensity</td><td><b>" + cy3 + "</b></td></tr>"; |
2 |
26 Feb 07 |
jari |
message += "<tr><td>Ratio (Sample/Median)</td><td>" + ratio + "</td></tr>"+ |
2 |
26 Feb 07 |
jari |
"<tr><td>log2(Ratio)</td><td><b>" + logRatio + "</b></td></tr>"; |
2 |
26 Feb 07 |
jari |
} else { //ratio only, like stanford |
2 |
26 Feb 07 |
jari |
logRatio = cy5; |
2 |
26 Feb 07 |
jari |
message += "<tr><td>File Index</td><td>" + trueRow + "</td></tr>"; |
2 |
26 Feb 07 |
jari |
message += "<tr><td>Value</td><td><b>" + logRatio + "</b></td></tr>"; |
2 |
26 Feb 07 |
jari |
199 |
} |
2 |
26 Feb 07 |
jari |
// message += "</table>"; |
2 |
26 Feb 07 |
jari |
201 |
|
2 |
26 Feb 07 |
jari |
//experiment annotation |
2 |
26 Feb 07 |
jari |
Vector keys = slideData.getSlideDataKeys(); |
2 |
26 Feb 07 |
jari |
Hashtable expLabels = slideData.getSlideDataLabels(); |
2 |
26 Feb 07 |
jari |
message += "<th colspan=2>Experiment Annotation</th/>"; |
2 |
26 Feb 07 |
jari |
String key, value; |
2 |
26 Feb 07 |
jari |
for(int i = 0; i < keys.size(); i++){ |
2 |
26 Feb 07 |
jari |
key = (String)(keys.elementAt(i)); |
2 |
26 Feb 07 |
jari |
value = (String)(expLabels.get(key)); |
2 |
26 Feb 07 |
jari |
if(value == null) |
2 |
26 Feb 07 |
jari |
value = ""; |
2 |
26 Feb 07 |
jari |
message += "<tr valign=top><td>" + key + "</td><td>" + value + "</td></tr>"; |
2 |
26 Feb 07 |
jari |
213 |
} |
2 |
26 Feb 07 |
jari |
// message += "</table>"; |
2 |
26 Feb 07 |
jari |
215 |
|
2 |
26 Feb 07 |
jari |
//gene annotation |
2 |
26 Feb 07 |
jari |
String[] fieldNames = TMEV.getFieldNames(); |
2 |
26 Feb 07 |
jari |
if(fieldNames != null && fieldNames.length > 0){ |
2 |
26 Feb 07 |
jari |
message += "<th>Gene Annotation</th>"; |
2 |
26 Feb 07 |
jari |
for (int i = 0; i < fieldNames.length; i++) { |
2 |
26 Feb 07 |
jari |
message += "<tr valign=top><td>" + fieldNames[i] + "</td><td>" + element.getFieldAt(i) + "</td></tr>"; |
2 |
26 Feb 07 |
jari |
222 |
} |
2 |
26 Feb 07 |
jari |
// message += "</table>"; |
2 |
26 Feb 07 |
jari |
224 |
} |
2 |
26 Feb 07 |
jari |
225 |
|
2 |
26 Feb 07 |
jari |
//spot specific information |
2 |
26 Feb 07 |
jari |
SpotInformationData spotData = this.slideData.getSpotInformationData(); |
2 |
26 Feb 07 |
jari |
if(spotData != null){ |
2 |
26 Feb 07 |
jari |
String [] spotInfoLabels = spotData.getSpotInformationHeader(); |
2 |
26 Feb 07 |
jari |
String [] info = spotData.getSpotInformationArray(probe); |
2 |
26 Feb 07 |
jari |
message += "<th colspan=2>Spot Information</th>"; |
2 |
26 Feb 07 |
jari |
for (int i = 0; i < spotInfoLabels.length; i++) { |
2 |
26 Feb 07 |
jari |
message += "<tr valign=top><td>" + spotInfoLabels[i] + "</td><td>" + info[i] + "</td></tr>"; |
2 |
26 Feb 07 |
jari |
234 |
} |
2 |
26 Feb 07 |
jari |
// message += "</table>"; |
2 |
26 Feb 07 |
jari |
236 |
} |
2 |
26 Feb 07 |
jari |
message += "</table>"; |
2 |
26 Feb 07 |
jari |
message += "</basefont></body></html>"; |
2 |
26 Feb 07 |
jari |
return message; |
2 |
26 Feb 07 |
jari |
240 |
} |
2 |
26 Feb 07 |
jari |
241 |
*/ |
2 |
26 Feb 07 |
jari |
242 |
|
2 |
26 Feb 07 |
jari |
/* with italics |
2 |
26 Feb 07 |
jari |
private String createMessage(ISlideDataElement element) { |
2 |
26 Feb 07 |
jari |
int stringLength = 0; |
2 |
26 Feb 07 |
jari |
int trueRow = element.getRow(ISlideDataElement.BASE); |
2 |
26 Feb 07 |
jari |
int trueColumn = element.getColumn(ISlideDataElement.BASE); |
2 |
26 Feb 07 |
jari |
float cy3 = this.slideData.getCY3(this.probe); |
2 |
26 Feb 07 |
jari |
float cy5 = this.slideData.getCY5(this.probe); |
2 |
26 Feb 07 |
jari |
250 |
|
2 |
26 Feb 07 |
jari |
// float cy3 = element.getTrueIntensity(ISlideDataElement.CY3); |
2 |
26 Feb 07 |
jari |
// float cy5 = element.getTrueIntensity(ISlideDataElement.CY5); |
2 |
26 Feb 07 |
jari |
// float ratio = element.getTrueRatio(ISlideDataElement.CY5, ISlideDataElement.CY3, LINEAR); |
2 |
26 Feb 07 |
jari |
// float logRatio = element.getTrueRatio(ISlideDataElement.CY5, ISlideDataElement.CY3, LOG); |
2 |
26 Feb 07 |
jari |
float ratio = cy5/cy3; |
2 |
26 Feb 07 |
jari |
256 |
|
2 |
26 Feb 07 |
jari |
float logRatio; |
2 |
26 Feb 07 |
jari |
258 |
|
2 |
26 Feb 07 |
jari |
if(cy3 < 0 || cy5 < 0) //for data input where neg. is posible. |
2 |
26 Feb 07 |
jari |
logRatio = Float.NaN; |
2 |
26 Feb 07 |
jari |
else |
2 |
26 Feb 07 |
jari |
logRatio = (float)(Math.log(ratio)/Math.log(2.0)); |
2 |
26 Feb 07 |
jari |
263 |
|
2 |
26 Feb 07 |
jari |
String message = "<html><body bgcolor = \"#FFFFCC\"><basefont face = \"Arial\"><table cellpadding=4 valign=top><th colspan=2 halign=left>Location and Intensities</th>"; |
2 |
26 Feb 07 |
jari |
265 |
|
2 |
26 Feb 07 |
jari |
if(dataType == this.data.DATA_TYPE_TWO_INTENSITY){ |
2 |
26 Feb 07 |
jari |
message += "<tr><td><i>Row</i></td><td>" + trueRow + "</td></tr>"+ |
2 |
26 Feb 07 |
jari |
"<tr><td><i>Column</i></td><td>" + trueColumn + "</td></tr>"; |
2 |
26 Feb 07 |
jari |
message += "<tr><td>Cy3</td><td><b>" + cy3 + "</b></td></tr>"+ |
2 |
26 Feb 07 |
jari |
"<tr><td><i>Cy5</i></td><td><b>" + cy5 + "</b></td></tr>"; |
2 |
26 Feb 07 |
jari |
message += "<tr><td><i>Ratio</i></td><td>" + ratio + "</td></tr>"+ |
2 |
26 Feb 07 |
jari |
"<tr><td><i>log2(Ratio)</i></td><td><b>" + logRatio + "</b></td></tr>"; |
2 |
26 Feb 07 |
jari |
} else if(dataType == this.data.DATA_TYPE_AFFY_ABS){ |
2 |
26 Feb 07 |
jari |
message += "<tr><td><i>File Index</i></td><td>+" + trueRow + "</td></tr>"; |
2 |
26 Feb 07 |
jari |
message += "<tr><td><i>Affy Loading Mode</i></td><td>Absolute</td></tr>"; |
2 |
26 Feb 07 |
jari |
message += "<tr><td><i>Intensity<i>/</td><td><b>" + cy5 + "</b></td></tr>"; |
2 |
26 Feb 07 |
jari |
} else if(dataType == this.data.DATA_TYPE_AFFY_REF){ |
2 |
26 Feb 07 |
jari |
message += "<tr><td><i>File Index</i></td><td>" + trueRow + "</td></tr>"; |
2 |
26 Feb 07 |
jari |
message += "<tr><td><i>Affy Loading Mode</i></td><td>Reference</td></tr>"; |
2 |
26 Feb 07 |
jari |
message += "<tr><td><i>Sample Intensity</i></td><td><b>" + cy5 + "</b></td></tr>"; |
2 |
26 Feb 07 |
jari |
message += "<tr><td><i>Ref. Intensity</i></td><td><b>" + cy3 + "</b></td></tr>"; |
2 |
26 Feb 07 |
jari |
message += "<tr><td><i>Ratio (Sample/Ref.)</i></td><td>" + ratio + "</td></tr>"+ |
2 |
26 Feb 07 |
jari |
"<tr><td><i>log2(Ratio)</i></td><td><b>" + logRatio + "</b></td></tr>"; |
2 |
26 Feb 07 |
jari |
} else if(dataType == this.data.DATA_TYPE_AFFY_MEAN){ |
2 |
26 Feb 07 |
jari |
message += "<tr><td><i>File Index</i></td><td>" + trueRow + "</td></tr>"; |
2 |
26 Feb 07 |
jari |
message += "<tr><td><i>Affy Loading Mode</i></td><td>Array Set Mean Int. as Ref.</td></tr>"; |
2 |
26 Feb 07 |
jari |
message += "<tr><td><i>Sample Intensity</i></td><td><b>" + cy5 + "</b></td></tr>"; |
2 |
26 Feb 07 |
jari |
message += "<tr><td><i>Array Set Mean Int.</i></td><td><b>" + cy3 + "</b></td></tr>"; |
2 |
26 Feb 07 |
jari |
message += "<tr><td><i>Ratio (Sample/Mean)</i></td><td>" + ratio + "</td></tr>"+ |
2 |
26 Feb 07 |
jari |
"<tr><td><i>log2(Ratio)</i></td><td><b>" + logRatio + "</b></td></tr>"; |
2 |
26 Feb 07 |
jari |
} else if(dataType == this.data.DATA_TYPE_AFFY_MEDIAN){ |
2 |
26 Feb 07 |
jari |
message += "<tr><td><i>File Index</i></td><td>" + trueRow + "</td></tr>"; |
2 |
26 Feb 07 |
jari |
message += "<tr><td><i>Affy Loading Mode</i></td><td>Spot Median as Ref.</td></tr>"; |
2 |
26 Feb 07 |
jari |
message += "<tr><td><i>Sample Intensity</i></td><td><b>" + cy5 + "</b></td></tr>"; |
2 |
26 Feb 07 |
jari |
message += "<tr><td><i>Spot Median Intensity</i></td><td><b>" + cy3 + "</b></td></tr>"; |
2 |
26 Feb 07 |
jari |
message += "<tr><td><i>Ratio (Sample/Median)</i></td><td>" + ratio + "</td></tr>"+ |
2 |
26 Feb 07 |
jari |
"<tr><td><i>log2(Ratio)</i></td><td><b>" + logRatio + "</b></td></tr>"; |
2 |
26 Feb 07 |
jari |
} else { //ratio only, like stanford |
2 |
26 Feb 07 |
jari |
logRatio = cy5; |
2 |
26 Feb 07 |
jari |
message += "<tr><td><i>File Index</i></td><td>" + trueRow + "</td></tr>"; |
2 |
26 Feb 07 |
jari |
message += "<tr><td><i>Value</i></td><td><b>" + logRatio + "</b></td></tr>"; |
2 |
26 Feb 07 |
jari |
302 |
} |
2 |
26 Feb 07 |
jari |
// message += "</table>"; |
2 |
26 Feb 07 |
jari |
304 |
|
2 |
26 Feb 07 |
jari |
//experiment annotation |
2 |
26 Feb 07 |
jari |
Vector keys = slideData.getSlideDataKeys(); |
2 |
26 Feb 07 |
jari |
Hashtable expLabels = slideData.getSlideDataLabels(); |
2 |
26 Feb 07 |
jari |
message += "<th colspan=2 halign=left>Experiment Annotation</th/>"; |
2 |
26 Feb 07 |
jari |
String key, value; |
2 |
26 Feb 07 |
jari |
for(int i = 0; i < keys.size(); i++){ |
2 |
26 Feb 07 |
jari |
key = (String)(keys.elementAt(i)); |
2 |
26 Feb 07 |
jari |
value = (String)(expLabels.get(key)); |
2 |
26 Feb 07 |
jari |
if(value == null) |
2 |
26 Feb 07 |
jari |
value = ""; |
2 |
26 Feb 07 |
jari |
message += "<tr valign=top><td><i>" + key + "</i></td><td>" + value + "</td></tr>"; |
2 |
26 Feb 07 |
jari |
316 |
} |
2 |
26 Feb 07 |
jari |
// message += "</table>"; |
2 |
26 Feb 07 |
jari |
318 |
|
2 |
26 Feb 07 |
jari |
//gene annotation |
2 |
26 Feb 07 |
jari |
String[] fieldNames = TMEV.getFieldNames(); |
2 |
26 Feb 07 |
jari |
if(fieldNames != null && fieldNames.length > 0){ |
2 |
26 Feb 07 |
jari |
message += "<th colspan=2 halign=left>Gene Annotation</th>"; |
2 |
26 Feb 07 |
jari |
for (int i = 0; i < fieldNames.length; i++) { |
2 |
26 Feb 07 |
jari |
message += "<tr valign=top><td><i>" + fieldNames[i] + "</i></td><td>" + element.getFieldAt(i) + "</td></tr>"; |
2 |
26 Feb 07 |
jari |
325 |
} |
2 |
26 Feb 07 |
jari |
// message += "</table>"; |
2 |
26 Feb 07 |
jari |
327 |
} |
2 |
26 Feb 07 |
jari |
328 |
|
2 |
26 Feb 07 |
jari |
//spot specific information |
2 |
26 Feb 07 |
jari |
SpotInformationData spotData = this.slideData.getSpotInformationData(); |
2 |
26 Feb 07 |
jari |
if(spotData != null){ |
2 |
26 Feb 07 |
jari |
String [] spotInfoLabels = spotData.getSpotInformationHeader(); |
2 |
26 Feb 07 |
jari |
String [] info = spotData.getSpotInformationArray(probe); |
2 |
26 Feb 07 |
jari |
message += "<th colspan=2 halign=left>Spot Information</th>"; |
2 |
26 Feb 07 |
jari |
for (int i = 0; i < spotInfoLabels.length; i++) { |
2 |
26 Feb 07 |
jari |
message += "<tr valign=top><td><i>" + spotInfoLabels[i] + "</i></td><td>" + info[i] + "</td></tr>"; |
2 |
26 Feb 07 |
jari |
337 |
} |
2 |
26 Feb 07 |
jari |
// message += "</table>"; |
2 |
26 Feb 07 |
jari |
339 |
} |
2 |
26 Feb 07 |
jari |
message += "</table>"; |
2 |
26 Feb 07 |
jari |
message += "</basefont></body></html>"; |
2 |
26 Feb 07 |
jari |
return message; |
2 |
26 Feb 07 |
jari |
343 |
} |
2 |
26 Feb 07 |
jari |
344 |
**/ |
2 |
26 Feb 07 |
jari |
345 |
|
2 |
26 Feb 07 |
jari |
346 |
private String createMessage(ISlideDataElement element) { |
2 |
26 Feb 07 |
jari |
347 |
int stringLength = 0; |
2 |
26 Feb 07 |
jari |
348 |
int trueRow = element.getRow(ISlideDataElement.BASE); |
2 |
26 Feb 07 |
jari |
349 |
int trueColumn = element.getColumn(ISlideDataElement.BASE); |
2 |
26 Feb 07 |
jari |
350 |
float cy3 = this.slideData.getCY3(this.probe); |
2 |
26 Feb 07 |
jari |
351 |
float cy5 = this.slideData.getCY5(this.probe); |
2 |
26 Feb 07 |
jari |
352 |
|
2 |
26 Feb 07 |
jari |
// float cy3 = element.getTrueIntensity(ISlideDataElement.CY3); |
2 |
26 Feb 07 |
jari |
// float cy5 = element.getTrueIntensity(ISlideDataElement.CY5); |
2 |
26 Feb 07 |
jari |
// float ratio = element.getTrueRatio(ISlideDataElement.CY5, ISlideDataElement.CY3, LINEAR); |
2 |
26 Feb 07 |
jari |
// float logRatio = element.getTrueRatio(ISlideDataElement.CY5, ISlideDataElement.CY3, LOG); |
2 |
26 Feb 07 |
jari |
357 |
float ratio = cy5/cy3; |
2 |
26 Feb 07 |
jari |
358 |
|
2 |
26 Feb 07 |
jari |
359 |
float logRatio; |
2 |
26 Feb 07 |
jari |
360 |
|
2 |
26 Feb 07 |
jari |
361 |
if(cy3 < 0 || cy5 < 0) //for data input where neg. is posible. |
2 |
26 Feb 07 |
jari |
362 |
logRatio = Float.NaN; |
2 |
26 Feb 07 |
jari |
363 |
else |
2 |
26 Feb 07 |
jari |
364 |
logRatio = (float)(Math.log(ratio)/Math.log(2.0)); |
2 |
26 Feb 07 |
jari |
365 |
|
2 |
26 Feb 07 |
jari |
366 |
String message = "<html><body bgcolor = \"#FFFFCC\"><basefont face = \"Arial\"><table cellpadding=4 valign=top><th colspan=2 align=left valign=center><font size=6>Location and Intensities</font></th>"; |
2 |
26 Feb 07 |
jari |
367 |
|
2 |
26 Feb 07 |
jari |
368 |
if(dataType == IData.DATA_TYPE_TWO_INTENSITY){ |
2 |
26 Feb 07 |
jari |
369 |
message += "<tr><td><i>Row</i></td><td>" + trueRow + "</td></tr>"+ |
2 |
26 Feb 07 |
jari |
370 |
"<tr><td><i>Column</i></td><td>" + trueColumn + "</td></tr>"; |
2 |
26 Feb 07 |
jari |
371 |
message += "<tr><td>Cy3</td><td><b>" + cy3 + "</b></td></tr>"+ |
2 |
26 Feb 07 |
jari |
372 |
"<tr><td><i>Cy5</i></td><td><b>" + cy5 + "</b></td></tr>"; |
2 |
26 Feb 07 |
jari |
373 |
message += "<tr><td><i>Ratio</i></td><td>" + ratio + "</td></tr>"+ |
2 |
26 Feb 07 |
jari |
374 |
"<tr><td><i>log2(Ratio)</i></td><td><b>" + logRatio + "</b></td></tr>"; |
2 |
26 Feb 07 |
jari |
375 |
} else if(dataType == IData.DATA_TYPE_AFFY_ABS){ |
2 |
26 Feb 07 |
jari |
376 |
message += "<tr><td><i>File Index</i></td><td>+" + trueRow + "</td></tr>"; |
2 |
26 Feb 07 |
jari |
377 |
message += "<tr><td><i>Affy Loading Mode</i></td><td>Absolute</td></tr>"; |
2 |
26 Feb 07 |
jari |
378 |
message += "<tr><td><i>Intensity<i>/</td><td><b>" + cy5 + "</b></td></tr>"; |
2 |
26 Feb 07 |
jari |
379 |
} else if(dataType == IData.DATA_TYPE_AFFY_REF){ |
2 |
26 Feb 07 |
jari |
380 |
message += "<tr><td><i>File Index</i></td><td>" + trueRow + "</td></tr>"; |
2 |
26 Feb 07 |
jari |
381 |
message += "<tr><td><i>Affy Loading Mode</i></td><td>Reference</td></tr>"; |
2 |
26 Feb 07 |
jari |
382 |
message += "<tr><td><i>Sample Intensity</i></td><td><b>" + cy5 + "</b></td></tr>"; |
2 |
26 Feb 07 |
jari |
383 |
message += "<tr><td><i>Ref. Intensity</i></td><td><b>" + cy3 + "</b></td></tr>"; |
2 |
26 Feb 07 |
jari |
384 |
message += "<tr><td><i>Ratio (Sample/Ref.)</i></td><td>" + ratio + "</td></tr>"+ |
2 |
26 Feb 07 |
jari |
385 |
"<tr><td><i>log2(Ratio)</i></td><td><b>" + logRatio + "</b></td></tr>"; |
2 |
26 Feb 07 |
jari |
386 |
} else if(dataType == IData.DATA_TYPE_AFFY_MEAN){ |
2 |
26 Feb 07 |
jari |
387 |
message += "<tr><td><i>File Index</i></td><td>" + trueRow + "</td></tr>"; |
2 |
26 Feb 07 |
jari |
388 |
message += "<tr><td><i>Affy Loading Mode</i></td><td>Array Set Mean Int. as Ref.</td></tr>"; |
2 |
26 Feb 07 |
jari |
389 |
message += "<tr><td><i>Sample Intensity</i></td><td><b>" + cy5 + "</b></td></tr>"; |
2 |
26 Feb 07 |
jari |
390 |
message += "<tr><td><i>Array Set Mean Int.</i></td><td><b>" + cy3 + "</b></td></tr>"; |
2 |
26 Feb 07 |
jari |
391 |
message += "<tr><td><i>Ratio (Sample/Mean)</i></td><td>" + ratio + "</td></tr>"+ |
2 |
26 Feb 07 |
jari |
392 |
"<tr><td><i>log2(Ratio)</i></td><td><b>" + logRatio + "</b></td></tr>"; |
2 |
26 Feb 07 |
jari |
393 |
} else if(dataType == IData.DATA_TYPE_AFFY_MEDIAN){ |
2 |
26 Feb 07 |
jari |
394 |
message += "<tr><td><i>File Index</i></td><td>" + trueRow + "</td></tr>"; |
2 |
26 Feb 07 |
jari |
395 |
message += "<tr><td><i>Affy Loading Mode</i></td><td>Spot Median as Ref.</td></tr>"; |
2 |
26 Feb 07 |
jari |
396 |
message += "<tr><td><i>Sample Intensity</i></td><td><b>" + cy5 + "</b></td></tr>"; |
2 |
26 Feb 07 |
jari |
397 |
message += "<tr><td><i>Spot Median Intensity</i></td><td><b>" + cy3 + "</b></td></tr>"; |
2 |
26 Feb 07 |
jari |
398 |
message += "<tr><td><i>Ratio (Sample/Median)</i></td><td>" + ratio + "</td></tr>"+ |
2 |
26 Feb 07 |
jari |
399 |
"<tr><td><i>log2(Ratio)</i></td><td><b>" + logRatio + "</b></td></tr>"; |
2 |
26 Feb 07 |
jari |
400 |
} else { //ratio only, like stanford |
2 |
26 Feb 07 |
jari |
401 |
logRatio = cy5; |
2 |
26 Feb 07 |
jari |
402 |
message += "<tr><td><i>File Index</i></td><td>" + trueRow + "</td></tr>"; |
2 |
26 Feb 07 |
jari |
403 |
message += "<tr><td><i>Value</i></td><td><b>" + logRatio + "</b></td></tr>"; |
2 |
26 Feb 07 |
jari |
404 |
} |
2 |
26 Feb 07 |
jari |
// message += "</table>"; |
2 |
26 Feb 07 |
jari |
406 |
|
2 |
26 Feb 07 |
jari |
//experiment annotation |
2 |
26 Feb 07 |
jari |
408 |
Vector keys = slideData.getSlideDataKeys(); |
2 |
26 Feb 07 |
jari |
409 |
Hashtable expLabels = slideData.getSlideDataLabels(); |
2 |
26 Feb 07 |
jari |
410 |
message += "<th colspan=2 align=left valign=center><font size=6>Sample Annotation</font></header></th/>"; |
2 |
26 Feb 07 |
jari |
411 |
String key, value; |
2 |
26 Feb 07 |
jari |
412 |
for(int i = 0; i < keys.size(); i++){ |
2 |
26 Feb 07 |
jari |
413 |
key = (String)(keys.elementAt(i)); |
2 |
26 Feb 07 |
jari |
414 |
value = (String)(expLabels.get(key)); |
2 |
26 Feb 07 |
jari |
415 |
if(value == null) |
2 |
26 Feb 07 |
jari |
416 |
value = ""; |
2 |
26 Feb 07 |
jari |
417 |
message += "<tr valign=top><td><i>" + key + "</i></td><td>" + value + "</td></tr>"; |
2 |
26 Feb 07 |
jari |
418 |
} |
2 |
26 Feb 07 |
jari |
// message += "</table>"; |
2 |
26 Feb 07 |
jari |
420 |
|
2 |
26 Feb 07 |
jari |
//gene annotation |
2 |
26 Feb 07 |
jari |
//EH fieldnames are loaded into SlideData instead of TMEV |
2 |
26 Feb 07 |
jari |
// String[] fieldNames = TMEV.getFieldNames(); |
2 |
26 Feb 07 |
jari |
424 |
String[] fieldNames = slideData.getSlideMetaData().getFieldNames(); |
2 |
26 Feb 07 |
jari |
425 |
if(fieldNames != null && fieldNames.length > 0){ |
2 |
26 Feb 07 |
jari |
426 |
message += "<th colspan=2 align=left valign=center><font size=6>Gene Annotation</font></th>"; |
2 |
26 Feb 07 |
jari |
427 |
for (int i = 0; i < fieldNames.length; i++) { |
2 |
26 Feb 07 |
jari |
428 |
|
2 |
26 Feb 07 |
jari |
//pcahan change to call getDetection on the element rather than the field |
2 |
26 Feb 07 |
jari |
430 |
if(fieldNames[i].equals("Detection")){ |
2 |
26 Feb 07 |
jari |
431 |
message += "<tr valign=top><td><i>" + fieldNames[i] + "</i></td><td>" + element.getDetection() + "</td></tr>"; |
2 |
26 Feb 07 |
jari |
432 |
} |
2 |
26 Feb 07 |
jari |
433 |
else if(fieldNames[i].equals("P-value")){ |
2 |
26 Feb 07 |
jari |
434 |
message += "<tr valign=top><td><i>" + fieldNames[i] + "</i></td><td>" + element.getPvalue() + "</td></tr>";; |
2 |
26 Feb 07 |
jari |
435 |
}else{ |
2 |
26 Feb 07 |
jari |
436 |
message += "<tr valign=top><td><i>" + fieldNames[i] + "</i></td><td>" + element.getFieldAt(i) + "</td></tr>"; |
2 |
26 Feb 07 |
jari |
437 |
} |
2 |
26 Feb 07 |
jari |
438 |
} |
2 |
26 Feb 07 |
jari |
// message += "</table>"; |
2 |
26 Feb 07 |
jari |
440 |
} |
2 |
26 Feb 07 |
jari |
441 |
|
2 |
26 Feb 07 |
jari |
//spot specific information |
2 |
26 Feb 07 |
jari |
443 |
SpotInformationData spotData = this.slideData.getSpotInformationData(); |
2 |
26 Feb 07 |
jari |
444 |
if(spotData != null){ |
2 |
26 Feb 07 |
jari |
445 |
String [] spotInfoLabels = spotData.getSpotInformationHeader(); |
2 |
26 Feb 07 |
jari |
446 |
String [] info = spotData.getSpotInformationArray(probe); |
2 |
26 Feb 07 |
jari |
447 |
message += "<th colspan=2 align=left valign=center><font size=6>Spot Information</font></th>"; |
2 |
26 Feb 07 |
jari |
448 |
for (int i = 0; i < spotInfoLabels.length; i++) { |
2 |
26 Feb 07 |
jari |
449 |
message += "<tr valign=top><td><i>" + spotInfoLabels[i] + "</i></td><td>" + info[i] + "</td></tr>"; |
2 |
26 Feb 07 |
jari |
450 |
} |
2 |
26 Feb 07 |
jari |
// message += "</table>"; |
2 |
26 Feb 07 |
jari |
452 |
} |
2 |
26 Feb 07 |
jari |
453 |
message += "</table>"; |
2 |
26 Feb 07 |
jari |
454 |
message += "</basefont></body></html>"; |
2 |
26 Feb 07 |
jari |
455 |
return message; |
2 |
26 Feb 07 |
jari |
456 |
} |
2 |
26 Feb 07 |
jari |
457 |
|
2 |
26 Feb 07 |
jari |
458 |
|
2 |
26 Feb 07 |
jari |
459 |
public void createGeneGraph() { |
2 |
26 Feb 07 |
jari |
460 |
JFrame graphFrame; |
2 |
26 Feb 07 |
jari |
461 |
GraphViewer graph; |
2 |
26 Feb 07 |
jari |
462 |
GraphPoint gp; |
2 |
26 Feb 07 |
jari |
463 |
GraphLine gl; |
2 |
26 Feb 07 |
jari |
464 |
GraphTick gt; |
2 |
26 Feb 07 |
jari |
465 |
ISlideData sde; |
2 |
26 Feb 07 |
jari |
466 |
|
2 |
26 Feb 07 |
jari |
467 |
ISlideData[] targets; |
2 |
26 Feb 07 |
jari |
468 |
|
2 |
26 Feb 07 |
jari |
469 |
targets = new ISlideData[data.getFeaturesCount()]; |
2 |
26 Feb 07 |
jari |
470 |
int columnsInExperiments = data.getFeature(0).getSlideMetaData().getColumns(); |
2 |
26 Feb 07 |
jari |
471 |
|
2 |
26 Feb 07 |
jari |
472 |
for (int i = 0; i < targets.length; i++) { |
2 |
26 Feb 07 |
jari |
473 |
targets[i] = data.getFeature(i);//.getSlideDataElement(element.getLocation(ISlideDataElement.BASE, columnsInExperiments) - 1); |
2 |
26 Feb 07 |
jari |
474 |
} |
2 |
26 Feb 07 |
jari |
475 |
|
2 |
26 Feb 07 |
jari |
476 |
int minCy3 = 0; |
2 |
26 Feb 07 |
jari |
477 |
int maxCy3 = targets.length; |
2 |
26 Feb 07 |
jari |
478 |
int minCy5 = Integer.MAX_VALUE; |
2 |
26 Feb 07 |
jari |
479 |
int maxCy5 = Integer.MIN_VALUE; |
2 |
26 Feb 07 |
jari |
480 |
|
2 |
26 Feb 07 |
jari |
481 |
int workingRatio = 0; |
2 |
26 Feb 07 |
jari |
482 |
|
2 |
26 Feb 07 |
jari |
483 |
for (int i = 0; i < targets.length; i++) { |
2 |
26 Feb 07 |
jari |
484 |
sde = targets[i]; |
2 |
26 Feb 07 |
jari |
485 |
|
2 |
26 Feb 07 |
jari |
486 |
workingRatio = (int)sde.getRatio(this.probe, LOG); //Xcon.log2(sde.getRatio(ISlideDataElement.CY5, ISlideDataElement.CY3, AC.LINEAR)); |
2 |
26 Feb 07 |
jari |
487 |
|
2 |
26 Feb 07 |
jari |
488 |
if (workingRatio < minCy5) minCy5 = workingRatio; |
2 |
26 Feb 07 |
jari |
489 |
if (workingRatio > maxCy5) maxCy5 = workingRatio; |
2 |
26 Feb 07 |
jari |
490 |
} |
2 |
26 Feb 07 |
jari |
491 |
|
2 |
26 Feb 07 |
jari |
492 |
minCy5--; |
2 |
26 Feb 07 |
jari |
493 |
maxCy5++; |
2 |
26 Feb 07 |
jari |
494 |
|
2 |
26 Feb 07 |
jari |
495 |
int xGap = (int)(maxCy3 - minCy3); |
2 |
26 Feb 07 |
jari |
496 |
int yGap = (int)(maxCy5 - minCy5); |
2 |
26 Feb 07 |
jari |
497 |
|
2 |
26 Feb 07 |
jari |
498 |
graphFrame = new JFrame("Sample vs. Log Ratio"); |
2 |
26 Feb 07 |
jari |
499 |
graph = new GraphViewer(graphFrame, 0, 500, 0, 500, minCy3, maxCy3, minCy5, maxCy5, 100, 100, 100, 100, "Sample vs. Log Ratio", "Sample Name", "Log2 (Cy5 / Cy3)"); |
2 |
26 Feb 07 |
jari |
500 |
|
2 |
26 Feb 07 |
jari |
501 |
graph.setXAxisValue(0); |
2 |
26 Feb 07 |
jari |
502 |
graph.setYAxisValue(minCy3); |
2 |
26 Feb 07 |
jari |
503 |
|
2 |
26 Feb 07 |
jari |
504 |
for (int i = minCy3 + 1; i <= maxCy3; i++) { |
2 |
26 Feb 07 |
jari |
505 |
gl = new GraphLine(i, minCy5, i, maxCy5, Color.yellow); |
2 |
26 Feb 07 |
jari |
506 |
graph.addGraphElement(gl); |
2 |
26 Feb 07 |
jari |
507 |
} |
2 |
26 Feb 07 |
jari |
508 |
|
2 |
26 Feb 07 |
jari |
509 |
for (int i = minCy5; i <= maxCy5; i++) { |
2 |
26 Feb 07 |
jari |
510 |
if (i != 0) { |
2 |
26 Feb 07 |
jari |
511 |
gl = new GraphLine(minCy3, i, maxCy3, i, Color.yellow); |
2 |
26 Feb 07 |
jari |
512 |
graph.addGraphElement(gl); |
2 |
26 Feb 07 |
jari |
513 |
} |
2 |
26 Feb 07 |
jari |
514 |
} |
2 |
26 Feb 07 |
jari |
515 |
|
2 |
26 Feb 07 |
jari |
516 |
float cy3, cy5, cy3b, cy5b; |
2 |
26 Feb 07 |
jari |
517 |
double logCy3, logCy5, logCy3b, logCy5b; |
2 |
26 Feb 07 |
jari |
518 |
for (int i = 0; i < targets.length - 1; i++) { |
2 |
26 Feb 07 |
jari |
519 |
sde = targets[i]; |
2 |
26 Feb 07 |
jari |
520 |
|
2 |
26 Feb 07 |
jari |
521 |
cy3 = sde.getCY3(this.probe); |
2 |
26 Feb 07 |
jari |
522 |
cy5 = sde.getCY5(this.probe); |
2 |
26 Feb 07 |
jari |
523 |
logCy3 = i + 1; |
2 |
26 Feb 07 |
jari |
524 |
|
2 |
26 Feb 07 |
jari |
525 |
if(dataType == IData.DATA_TYPE_RATIO_ONLY) |
2 |
26 Feb 07 |
jari |
526 |
logCy5 = cy5; |
2 |
26 Feb 07 |
jari |
527 |
else |
2 |
26 Feb 07 |
jari |
528 |
logCy5 = Xcon.log2((double) cy5 / (double) cy3); |
2 |
26 Feb 07 |
jari |
529 |
|
2 |
26 Feb 07 |
jari |
530 |
sde = targets[i + 1]; |
2 |
26 Feb 07 |
jari |
531 |
|
2 |
26 Feb 07 |
jari |
532 |
cy3b = sde.getCY3(this.probe); |
2 |
26 Feb 07 |
jari |
533 |
cy5b = sde.getCY5(this.probe); |
2 |
26 Feb 07 |
jari |
534 |
logCy3b = i + 2; |
2 |
26 Feb 07 |
jari |
535 |
if(dataType == IData.DATA_TYPE_RATIO_ONLY) |
2 |
26 Feb 07 |
jari |
536 |
logCy5b = cy5b; |
2 |
26 Feb 07 |
jari |
537 |
else |
2 |
26 Feb 07 |
jari |
538 |
logCy5b = Xcon.log2((double) cy5b / (double) cy3b); |
2 |
26 Feb 07 |
jari |
539 |
if(!Double.isNaN(logCy5) && !Double.isNaN(logCy5b)){ |
2 |
26 Feb 07 |
jari |
540 |
gl = new GraphLine(logCy3, logCy5, logCy3b, logCy5b, Color.blue); |
2 |
26 Feb 07 |
jari |
541 |
graph.addGraphElement(gl); |
2 |
26 Feb 07 |
jari |
542 |
} |
2 |
26 Feb 07 |
jari |
543 |
} |
2 |
26 Feb 07 |
jari |
544 |
for (int i = 0; i < targets.length; i++) { |
2 |
26 Feb 07 |
jari |
545 |
sde = targets[i]; |
2 |
26 Feb 07 |
jari |
546 |
|
2 |
26 Feb 07 |
jari |
547 |
cy3 = sde.getCY3(this.probe); |
2 |
26 Feb 07 |
jari |
548 |
cy5 = sde.getCY5(this.probe); |
2 |
26 Feb 07 |
jari |
549 |
logCy3 = i + 1; |
2 |
26 Feb 07 |
jari |
550 |
if(dataType == IData.DATA_TYPE_RATIO_ONLY) |
2 |
26 Feb 07 |
jari |
551 |
logCy5 = cy5; |
2 |
26 Feb 07 |
jari |
552 |
else |
2 |
26 Feb 07 |
jari |
553 |
logCy5 = Xcon.log2((double) cy5 / (double) cy3); |
2 |
26 Feb 07 |
jari |
554 |
if(!Double.isNaN(logCy5)){ |
2 |
26 Feb 07 |
jari |
555 |
gp = new GraphPoint(logCy3, logCy5, Color.blue, 3); |
2 |
26 Feb 07 |
jari |
556 |
graph.addGraphElement(gp); |
2 |
26 Feb 07 |
jari |
557 |
} |
2 |
26 Feb 07 |
jari |
558 |
} |
2 |
26 Feb 07 |
jari |
559 |
|
2 |
26 Feb 07 |
jari |
560 |
for (int i = minCy5; i <= maxCy5; i++) { |
2 |
26 Feb 07 |
jari |
561 |
if (i == 0) gt = new GraphTick(i, 8, Color.black, GC.VERTICAL, GC.C, "0", Color.black); |
2 |
26 Feb 07 |
jari |
//else gt = new GraphTick(i, 8, Color.black, GC.VERTICAL, GC.C, "2.0E" + i, Color.black); |
2 |
26 Feb 07 |
jari |
563 |
else gt = new GraphTick(i, 8, Color.black, GC.VERTICAL, GC.C, "" + i, Color.black); |
2 |
26 Feb 07 |
jari |
564 |
graph.addGraphElement(gt); |
2 |
26 Feb 07 |
jari |
565 |
} |
2 |
26 Feb 07 |
jari |
566 |
|
2 |
26 Feb 07 |
jari |
567 |
for (int i = minCy3 + 1; i <= maxCy3; i++) { |
2 |
26 Feb 07 |
jari |
568 |
gt = new GraphTick(i, 8, Color.black, GC.HORIZONTAL, GC.C, data.getSampleName(i - 1), Color.black); |
2 |
26 Feb 07 |
jari |
569 |
graph.addGraphElement(gt); |
2 |
26 Feb 07 |
jari |
570 |
} |
2 |
26 Feb 07 |
jari |
571 |
|
2 |
26 Feb 07 |
jari |
572 |
graphFrame.setSize(500, 500); |
2 |
26 Feb 07 |
jari |
573 |
graph.setVisible(true); |
2 |
26 Feb 07 |
jari |
574 |
} |
2 |
26 Feb 07 |
jari |
575 |
|
2 |
26 Feb 07 |
jari |
576 |
class EventListener implements ActionListener, KeyListener { |
2 |
26 Feb 07 |
jari |
577 |
public void actionPerformed(ActionEvent event) { |
2 |
26 Feb 07 |
jari |
578 |
String command = event.getActionCommand(); |
2 |
26 Feb 07 |
jari |
579 |
if (command.equals("close")) |
2 |
26 Feb 07 |
jari |
580 |
dispose(); |
2 |
26 Feb 07 |
jari |
581 |
else if (command.equals("view-gene-graph")) { |
2 |
26 Feb 07 |
jari |
582 |
hide(); |
2 |
26 Feb 07 |
jari |
583 |
createGeneGraph(); |
2 |
26 Feb 07 |
jari |
584 |
dispose(); |
2 |
26 Feb 07 |
jari |
585 |
} else if (command.equals("view-experiment")) { |
2 |
26 Feb 07 |
jari |
586 |
hide(); |
2 |
26 Feb 07 |
jari |
587 |
Manager.createNewSingleArrayViewer(slideData); |
2 |
26 Feb 07 |
jari |
588 |
dispose(); |
2 |
26 Feb 07 |
jari |
589 |
} else if (command.equals("set-color")) { |
2 |
26 Feb 07 |
jari |
590 |
} |
2 |
26 Feb 07 |
jari |
591 |
} |
2 |
26 Feb 07 |
jari |
592 |
|
2 |
26 Feb 07 |
jari |
593 |
public void keyPressed(KeyEvent event) { |
2 |
26 Feb 07 |
jari |
594 |
if (event.getKeyCode() == KeyEvent.VK_ENTER) { |
2 |
26 Feb 07 |
jari |
595 |
dispose(); |
2 |
26 Feb 07 |
jari |
596 |
} |
2 |
26 Feb 07 |
jari |
597 |
} |
2 |
26 Feb 07 |
jari |
598 |
|
2 |
26 Feb 07 |
jari |
599 |
public void keyReleased(KeyEvent event) {} |
2 |
26 Feb 07 |
jari |
600 |
public void keyTyped(KeyEvent event) {} |
2 |
26 Feb 07 |
jari |
601 |
} |
2 |
26 Feb 07 |
jari |
602 |
} |