Class Spot

java.lang.Object
  extended by Spot
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.WindowListener, java.util.EventListener

public class Spot
extends java.lang.Object
implements java.awt.event.ActionListener, java.awt.event.WindowListener

Class Spot contains the spot structure for measured spots.

This work was produced by Peter Lemkin of the National Cancer Institute, an agency of the United States Government. As a work of the United States Government there is no associated copyright. It is offered as open source software under the Mozilla Public License (version 1.1) subject to the limitations noted in the accompanying LEGAL file. This notice must be included with the code. The Flicker Mozilla and Legal files are available on http://open2dprot.sourceforge.net/Flicker

Version:
$Date$ $Revision$
Author:
P. Lemkin (LECB/NCI), G. Thornwall (SAIC), Frederick, MD
See Also:
Flicker Home

Field Summary
(package private)  float area
          spot area in pixels
(package private)  float bkgrd
          total spot mean background density
private  boolean changedFlag
          edited the spot flag
(package private)  int circleRadius
          he radius of the circlular mask
(package private)  float density
          total density uncorrected for background computed as the sum of the gray value or calibrated gray value (i.e.
(package private)  float densPrime
          total density corrected for background by computed as: densPrime = (density - mnBkgrd*area)
(package private)  float dMax
          spot MAX OD
(package private)  float dMaxBkgrd
          background for spot MAX OD or gray value
(package private)  float dMin
          spot MIN OD
(package private)  float dMinBkgrd
          background for spot MIN OD or gray value
private static java.awt.Frame fBoth
          Frame to create and popup when you edit
static FileIO fio
          FileIO utilities
private static Flicker flk
          instance of Flicker
static java.lang.String[] fNames
          names of the spot fields
private static java.awt.Frame fOne
          Frame to create and popup when you edit
(package private)  java.lang.String id
          Optional associated identifier string if not null.
static int idxID
          index of "id" field in fNames table.
(package private)  boolean isCalibFlag
          measurements are in calibrated OD rather than grayscale
(package private)  float mnBkgrd
          mean spot mean background density
(package private)  float mnDens
          mean density
(package private)  float mnDensPrime
          mean density corrected for background (mnDensPrime - mnBkgrd)
(package private)  java.lang.String name
          Optional associated protein string if not null.
(package private)  int nbr
          measurement number of spot unique to the associated gel
(package private)  int nCirMask
          circular mask diameter = 2*circleRadius+1
(package private)  int nGel
          Gel# (1 or 2) for "left" or "right" image.
static int nRows
          # of names for the spot fields
(package private) static int POPUP_HEIGHT
          default frame size height of popup
(package private) static int POPUP_WIDTH
          default frame size width of popup
 int preferredHeight
          preferred canvas height
 int preferredWidth
          preferred canvas width
private  Spot s1
          Left Spot 1 if editing both spots
private  Spot s2
          Right Spot 2 if editing both spots
private static java.awt.TextField[][] spotTable
          spot Editable table [nRows][2]
private static java.awt.TextField[][] spotTableBoth
          spot Editable table [nRows][3] that handles spots in s1 [1] and spots in s2 [2].
private  java.awt.Label statusLabel
          status Label
(package private)  float totDens
          total density over the measurement area
(package private)  boolean useTotDensityFlag
          measurements total density else mean values
private static Util util
          misc utility methods
(package private)  int xB
          background x centroid
(package private)  int xC
          spot X centroid
(package private)  int yB
          background Y centroid
(package private)  int yC
          spot Y centroid
 
Constructor Summary
Spot()
          Spot() - Constructor for new Spot
Spot(Flicker flkS)
          Spot() - setup Spot part of the database
Spot(int nGel, int nbr, java.lang.String id, java.lang.String name, int nCirMask, int circleRadius, int xC, int yC, int xB, int yB, float area, boolean isCalibFlag, boolean useTotDensityFlag, float density, float densPrime, float bkgrd, float mnDens, float totDens, float mnDensPrime, float mnBkgrd, float dMax, float dMin, float dMaxBkgrd, float dMinBkgrd)
          Spot() - Constructor for new Spot with data
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          actionPerformed() - Handle Control panel button clicks
 void close()
          close() - close this popup and reset flags if needed [TODO] If they edited the calibration and peak calibration table, and they did not save the calibration (i.e.
 java.lang.String cvSpot2Str(java.lang.String imageName, java.lang.String unitsAbbrev)
          cvSpot2Str() - convert spot to printable string
 java.lang.String getID()
          getID() - get the spot ID
 java.awt.Dimension getMinimumSize()
          getMinimumSize() - get the minimum preferred size
 java.awt.Dimension getPreferredSize()
          getPreferredSize() - get the preferred size
 java.lang.String getValBySpotFieldName(java.lang.String sName)
          getValBySpotFieldName() - get spot value string by spot field name
static java.lang.String listPairedSpotListDataTabDelim(boolean normByMeanSpotListFlag)
          listPairedSpotListDataTabDelim() - generate a tab-delimited string table of the paired spots (by matching spot id's) in the spot list.
static java.lang.String listSpotListData(java.lang.String imageName, java.lang.String units, Spot[] spotList, int nSpots)
          listSpotListData() - generate a string list of the spots in the spot list
static java.lang.String listSpotListDataTabDelim(java.lang.String imageName, java.lang.String unitsAbbrev, Spot[] spotList, int nSpots)
          listSpotListDataTabDelim() - generate a tab-delimited string table of of the spots in the spot list.
 boolean popupSpotEdit(boolean editOnlyIDflag)
          popupSpotEdit() - popup a spot editing function to change the spot.
 boolean popupSpotEditBoth(Spot s1, Spot s2, boolean editOnlyIDflag)
          popupSpotEditBoth() - popup a spot editing function to let you edit two selected (putatively paired) spots together Edit the data in 3 columns with the field name on the left column the left image data in the middle column and the right image data in the right column.
 void positionWindow(java.awt.Frame f)
          positionWindow() - position window on the screen
(package private) static Spot[] readState(java.lang.String gelFile, java.lang.String iName)
          readState() - Read spotList[] "spt/.spt" file
static boolean rmvSpotListFile(java.lang.String gelFile, java.lang.String iName)
          rmvSpotListFile() - clear the .spt file from the spt/ directory by moving the spt/.spt file into spt/.spt.bkup andclearing the .bkup file if it previously existed first.
 void set(int nGel, int nbr, java.lang.String id, java.lang.String name, int nCirMask, int circleRadius, int xC, int yC, int xB, int yB, float area, boolean isCalibFlag, boolean useTotDensityFlag, float density, float densPrime, float bkgrd, float mnDens, float totDens, float mnDensPrime, float mnBkgrd, float dMax, float dMin, float dMaxBkgrd, float dMinBkgrd)
          set() - set the data for a spot with new data
 void setID(java.lang.String id)
          setID() - set the spot ID
 void setStatusMsg(java.lang.String msg)
          setStatusMsg() - set the status msg
 void setStatusMsg(java.lang.String msg, java.awt.Color color)
          setStatusMsg() - set the status msg
private  boolean updateBothSpotsFromEditedSpotTable()
          updateBothSpotsFromEditedSpotTable() - set both spots from the spotTableBoth table data
private  boolean updateSpotFromEditedSpotTable()
          updateSpotFromEditedSpotTable() - set the spot from the table data
 void windowActivated(java.awt.event.WindowEvent e)
           
 void windowClosed(java.awt.event.WindowEvent e)
           
 void windowClosing(java.awt.event.WindowEvent e)
          windowClosing() - close down the window.
 void windowDeactivated(java.awt.event.WindowEvent e)
           
 void windowDeiconified(java.awt.event.WindowEvent e)
           
 void windowIconified(java.awt.event.WindowEvent e)
           
 void windowOpened(java.awt.event.WindowEvent e)
           
(package private) static boolean writeState(java.lang.String gelFile, java.lang.String iName, Spot[] spotList, int nSpots)
          writeState() - Write the spotlist[] to "spt/.spt" file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

flk

private static Flicker flk
instance of Flicker


fio

public static FileIO fio
FileIO utilities


util

private static Util util
misc utility methods


POPUP_WIDTH

static final int POPUP_WIDTH
default frame size width of popup

See Also:
Constant Field Values

POPUP_HEIGHT

static final int POPUP_HEIGHT
default frame size height of popup

See Also:
Constant Field Values

preferredHeight

public int preferredHeight
preferred canvas height


preferredWidth

public int preferredWidth
preferred canvas width


nGel

int nGel
Gel# (1 or 2) for "left" or "right" image.


nbr

int nbr
measurement number of spot unique to the associated gel


id

java.lang.String id
Optional associated identifier string if not null.


name

java.lang.String name
Optional associated protein string if not null.


nCirMask

int nCirMask
circular mask diameter = 2*circleRadius+1


circleRadius

int circleRadius
he radius of the circlular mask


xC

int xC
spot X centroid


yC

int yC
spot Y centroid


xB

int xB
background x centroid


yB

int yB
background Y centroid


area

float area
spot area in pixels


isCalibFlag

boolean isCalibFlag
measurements are in calibrated OD rather than grayscale


useTotDensityFlag

boolean useTotDensityFlag
measurements total density else mean values


density

float density
total density uncorrected for background computed as the sum of the gray value or calibrated gray value (i.e. OD?)


densPrime

float densPrime
total density corrected for background by computed as: densPrime = (density - mnBkgrd*area)


bkgrd

float bkgrd
total spot mean background density


mnDens

float mnDens
mean density


totDens

float totDens
total density over the measurement area


mnDensPrime

float mnDensPrime
mean density corrected for background (mnDensPrime - mnBkgrd)


mnBkgrd

float mnBkgrd
mean spot mean background density


dMax

float dMax
spot MAX OD


dMin

float dMin
spot MIN OD


dMaxBkgrd

float dMaxBkgrd
background for spot MAX OD or gray value


dMinBkgrd

float dMinBkgrd
background for spot MIN OD or gray value


fOne

private static java.awt.Frame fOne
Frame to create and popup when you edit


fBoth

private static java.awt.Frame fBoth
Frame to create and popup when you edit


fNames

public static java.lang.String[] fNames
names of the spot fields


idxID

public static int idxID
index of "id" field in fNames table. Edit if fName[] list changes


nRows

public static int nRows
# of names for the spot fields


spotTable

private static java.awt.TextField[][] spotTable
spot Editable table [nRows][2]


spotTableBoth

private static java.awt.TextField[][] spotTableBoth
spot Editable table [nRows][3] that handles spots in s1 [1] and spots in s2 [2].


s1

private Spot s1
Left Spot 1 if editing both spots


s2

private Spot s2
Right Spot 2 if editing both spots


statusLabel

private java.awt.Label statusLabel
status Label


changedFlag

private boolean changedFlag
edited the spot flag

Constructor Detail

Spot

public Spot(Flicker flkS)
Spot() - setup Spot part of the database


Spot

public Spot()
Spot() - Constructor for new Spot


Spot

public Spot(int nGel,
            int nbr,
            java.lang.String id,
            java.lang.String name,
            int nCirMask,
            int circleRadius,
            int xC,
            int yC,
            int xB,
            int yB,
            float area,
            boolean isCalibFlag,
            boolean useTotDensityFlag,
            float density,
            float densPrime,
            float bkgrd,
            float mnDens,
            float totDens,
            float mnDensPrime,
            float mnBkgrd,
            float dMax,
            float dMin,
            float dMaxBkgrd,
            float dMinBkgrd)
Spot() - Constructor for new Spot with data

Parameters:
nGel - is the Gel# (1 or 2) rof "left" or "right" image.
nbr - is measurement number of spot unique to the associated gel
id - is the optional associated identifier string if not null.
name - is the optional associated protein name string if not null.
nCirMask - is the circular mask diameter
circleRadius - is the radius of the circlular mask
xC - is the spot X centroid
yC - is the spot Y centroid
xB - is background x centroid
yB - is background Y centroid
area - is spot area in pixels (float so possibly scaled)
isCalibFlag - is measurements are in calibrated OD rather than grayscale
useTotDensityFlag - measurements total density else mean values
density - is the total density uncorrected for background computed as the sum of the gray value or calibrated gray value (i.e. OD?)
densPrime - is the total density corrected for background by computed as: densPrime = (density - mnBkgrd*area)
bkgrd - is the total spot mean background density
mnDens - is the mean density
totDens - is the total density over the measurement area
mnDensPrime - is mean density corrected for background computed as (mnDensPrime - mnBkgrd)
mnBkgrd - is the mean spot mean background density
dMax - is spot MAX OD
dMin - is spot MIN OD
dMaxBkgrd - background for spot MAX OD or gray value
dMinBkgrd - background for spot MIN OD or gray value
Method Detail

set

public void set(int nGel,
                int nbr,
                java.lang.String id,
                java.lang.String name,
                int nCirMask,
                int circleRadius,
                int xC,
                int yC,
                int xB,
                int yB,
                float area,
                boolean isCalibFlag,
                boolean useTotDensityFlag,
                float density,
                float densPrime,
                float bkgrd,
                float mnDens,
                float totDens,
                float mnDensPrime,
                float mnBkgrd,
                float dMax,
                float dMin,
                float dMaxBkgrd,
                float dMinBkgrd)
set() - set the data for a spot with new data

Parameters:
nGel - is the Gel# (1 or 2) rof "left" or "right" image.
nbr - is measurement number of spot unique to the associated gel
id - is the optional associated identifier string if not null.
name - is the optional associated protein name string if not null.
nCirMask - is the circular mask diameter
circleRadius - is the radius of the circlular mask
xC - is the spot X centroid
yC - is the spot Y centroid
xB - is background x centroid
yB - is background Y centroid
area - is spot area in pixels (float so possibly scaled)
isCalibFlag - is measurements are in calibrated OD rather than grayscale
useTotDensityFlag - measurements total density else mean values
density - is the total density uncorrected for background computed as the sum of the gray value or calibrated gray value (i.e. OD?)
densPrime - is the total density corrected for background by computed as: densPrime = (density - mnBkgrd*area)
bkgrd - is the total spot mean background density
mnDens - is the mean density
totDens - is the total density over the measurement area
mnDensPrime - is mean density corrected for background computed as (mnDensPrime - mnBkgrd)
mnBkgrd - is the mean spot mean background density
dMax - is spot MAX OD
dMin - is spot MIN OD
dMaxBkgrd - background for spot MAX OD or gray value
dMinBkgrd - background for spot MIN OD or gray value

getID

public java.lang.String getID()
getID() - get the spot ID

Returns:
the spot id

setID

public void setID(java.lang.String id)
setID() - set the spot ID

Parameters:
the - spot id

readState

static Spot[] readState(java.lang.String gelFile,
                        java.lang.String iName)
readState() - Read spotList[] "spt/.spt" file

Parameters:
gelFile - is the file base name. We strip off the image type and add ".spt"
iName - of the image to read (e.g., "I1", or "I2")
Returns:
spot list array if succeed, else null

writeState

static boolean writeState(java.lang.String gelFile,
                          java.lang.String iName,
                          Spot[] spotList,
                          int nSpots)
writeState() - Write the spotlist[] to "spt/.spt" file

Parameters:
gelFile - is the file base name. We strip off the image type and add ".spt"
iName - of the image to read (e.g., "I1", or "I2")
spotList - is list of spots to write out
sBuf - is the string buffer to write to.
Returns:
true if succeed

rmvSpotListFile

public static boolean rmvSpotListFile(java.lang.String gelFile,
                                      java.lang.String iName)
rmvSpotListFile() - clear the .spt file from the spt/ directory by moving the spt/.spt file into spt/.spt.bkup andclearing the .bkup file if it previously existed first.

Parameters:
gelFile - is the file base name. We strip off the image type and add ".spt"
iName - of the image to remove (e.g., "I1", or "I2")
Returns:
true if succeed

cvSpot2Str

public java.lang.String cvSpot2Str(java.lang.String imageName,
                                   java.lang.String unitsAbbrev)
cvSpot2Str() - convert spot to printable string

Parameters:
imageName - is image name
unitsAbbrev - is name of units abbreviation else "gray-scale"
Returns:
spot as string

listSpotListData

public static java.lang.String listSpotListData(java.lang.String imageName,
                                                java.lang.String units,
                                                Spot[] spotList,
                                                int nSpots)
listSpotListData() - generate a string list of the spots in the spot list

Parameters:
imageName - is image name
units - is name of units else "gray-scale"
spotList - is list of spots to convert
nspots - to convert
Returns:
spot as string

listSpotListDataTabDelim

public static java.lang.String listSpotListDataTabDelim(java.lang.String imageName,
                                                        java.lang.String unitsAbbrev,
                                                        Spot[] spotList,
                                                        int nSpots)
listSpotListDataTabDelim() - generate a tab-delimited string table of of the spots in the spot list. This could be imported into Excel

Parameters:
imageName - is image name
unitsAbbrev - is name of units abbreviation else "gray-scale"
spotList - is list of spots to convert
nspots - to convert
Returns:
spot as string

listPairedSpotListDataTabDelim

public static java.lang.String listPairedSpotListDataTabDelim(boolean normByMeanSpotListFlag)
listPairedSpotListDataTabDelim() - generate a tab-delimited string table of the paired spots (by matching spot id's) in the spot list. Note:
  1. Both spot list must be measured with either Total or Mean densities,
  2. Both spot lists must have the same calibration abbreviation units
  3. Both spots that are paired must have the same annotation id spelling
     including case.
This could be imported into Excel

Parameters:
normByMeanSpotListFlag - normalize by the mean spot value of spots in each of the corresponding spot lists.
Returns:
the table as string, else null if no data

getPreferredSize

public java.awt.Dimension getPreferredSize()
getPreferredSize() - get the preferred size

Returns:
window size

getMinimumSize

public java.awt.Dimension getMinimumSize()
getMinimumSize() - get the minimum preferred size

Returns:
window size

positionWindow

public void positionWindow(java.awt.Frame f)
positionWindow() - position window on the screen


popupSpotEdit

public boolean popupSpotEdit(boolean editOnlyIDflag)
popupSpotEdit() - popup a spot editing function to change the spot.

Parameters:
editOnlyIDflag - if only want to edit/assign the spot id
Returns:
true if any fields changed.

popupSpotEditBoth

public boolean popupSpotEditBoth(Spot s1,
                                 Spot s2,
                                 boolean editOnlyIDflag)
popupSpotEditBoth() - popup a spot editing function to let you edit two selected (putatively paired) spots together Edit the data in 3 columns with the field name on the left column the left image data in the middle column and the right image data in the right column.

Parameters:
s1 - is first spot
s2 - is second spot
editOnlyIDflag - if only want to edit/assign the spot id
Returns:
true if any fields changed.

setStatusMsg

public void setStatusMsg(java.lang.String msg)
setStatusMsg() - set the status msg

Parameters:
msg - is the status window msg

setStatusMsg

public void setStatusMsg(java.lang.String msg,
                         java.awt.Color color)
setStatusMsg() - set the status msg

Parameters:
msg - is the status window msg
color - to draw it

getValBySpotFieldName

public java.lang.String getValBySpotFieldName(java.lang.String sName)
getValBySpotFieldName() - get spot value string by spot field name

Parameters:
name - of spot field
Returns:
null if not found, else string value

updateSpotFromEditedSpotTable

private boolean updateSpotFromEditedSpotTable()
updateSpotFromEditedSpotTable() - set the spot from the table data


updateBothSpotsFromEditedSpotTable

private boolean updateBothSpotsFromEditedSpotTable()
updateBothSpotsFromEditedSpotTable() - set both spots from the spotTableBoth table data


actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed() - Handle Control panel button clicks

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
e - is ActionEvent for buttons in control panel

close

public void close()
close() - close this popup and reset flags if needed [TODO] If they edited the calibration and peak calibration table, and they did not save the calibration (i.e. calibChangedFlag is true), then ask them here and save it if they say yes. If not, then restore the previous calibration.


windowClosing

public void windowClosing(java.awt.event.WindowEvent e)
windowClosing() - close down the window.

Specified by:
windowClosing in interface java.awt.event.WindowListener
Parameters:
e - is window closing event
See Also:
close()

windowOpened

public void windowOpened(java.awt.event.WindowEvent e)
Specified by:
windowOpened in interface java.awt.event.WindowListener

windowActivated

public void windowActivated(java.awt.event.WindowEvent e)
Specified by:
windowActivated in interface java.awt.event.WindowListener

windowClosed

public void windowClosed(java.awt.event.WindowEvent e)
Specified by:
windowClosed in interface java.awt.event.WindowListener

windowDeactivated

public void windowDeactivated(java.awt.event.WindowEvent e)
Specified by:
windowDeactivated in interface java.awt.event.WindowListener

windowDeiconified

public void windowDeiconified(java.awt.event.WindowEvent e)
Specified by:
windowDeiconified in interface java.awt.event.WindowListener

windowIconified

public void windowIconified(java.awt.event.WindowEvent e)
Specified by:
windowIconified in interface java.awt.event.WindowListener