Class SetupLayouts

java.lang.Object
  |
  +--SetupLayouts

public class SetupLayouts
extends java.lang.Object

This class sets upthe array layouts from either preloads or files. Cvt2Mae stores array layouts in /ArrayLayouts as *.alo files. When the user presses "Done" after Editing an array layout (make sure it has a unique name) it should then copy that layout to an .alo file and also move it to the top of the sul.alList[i].layoutName[] list and then update the GUI by redoing the cvt.gui.chipsetChoice Choice widget and refresh the screen.

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.

Version:
$Date: 2002/10/14 19:22:31 $ $Revision: 1.19 $
Author:
P. Lemkin (NCI), G. Thornwall (SAIC), B. Stephens(SAIC), NCI-Frederick, Frederick, MD
See Also:
MAExplorer Home

Field Summary
 ArrayLayout[] alList
          [0:maxAL-1] array layouts to choose from max of MAX_ARRAY_LAYOUTS
private  boolean alo_allowNegQuantDataFlag
          ALO variable: allow negative quant dat
private  long alo_bitProps
          ALO variable: bit mcd.PROP_xxxx properties
private  boolean alo_chkAndEditFieldNamesFlag
          flag: check and edit Samples and Field names data before use.
private  int alo_colsPerGrid
          ALO variable: # of columns/grid
private  java.lang.String alo_commentToken
          ALO variable: optional comment token
private  java.lang.String[] alo_desiredFields
          ALO variable: list of FieldMaps for the layout
private  int alo_expectedNbrTokens
          ALO variable: # of expected tokens
private  java.lang.String alo_geoPlatformID
          Optional GEO Platform ID
 boolean alo_hasBkgrdDataFlag
          ALO variable: has background intensity data
private  boolean alo_hasMultDatasetsFlag
          ALO variable: input file has multiple samples
 boolean alo_hasQuantXYcoordsFlag
          ALO variable: has actual quant XY coordinates data
private  java.lang.String alo_initialKeyword
          ALO variable: optional initial keyword in leftmost field
private  java.lang.String alo_layoutName
          ALO variable: name of the layout
private  int alo_maxFields
          ALO variable: number of duplicate Fields of Grids/array
private  int alo_maxRowsExpected
          ALO variable: maximum number of spots (elements or rows)/sample
private  int alo_nGridsPerField
          ALO variable: # of grids/field
private  boolean alo_pseudoArrayFlag
          ALO variable: use generated PseudoArray image
private  java.lang.String alo_quantTool
          ALO variable: name of the quantification program
private  int alo_rowsPerGrid
          ALO variable: # of rows/grid
private  int alo_rowWithData
          ALO variable: # of row of FieldQ input file that contains data
private  int alo_rowWithFields
          ALO variable: # of row of FieldQ input file that contains Field names
private  int alo_rowWithSamples
          ALO variable: # of row of FieldQ input file that contains sample names
private  int alo_rowWithSepGIPOData
          ALO variable: # of row of FieldG separate GIPO input file that contains data
private  int alo_rowWithSepGIPOFields
          ALO variable: # of row of FieldG separate GIPO input file that contains Field names
private  java.lang.String alo_species
          ALO variable: species of sample
private  boolean alo_specifyGeometryByNbrSpotsFlag
          ALO variable: specify (F,G,R,C) from # of spots in PseudoArray
private  java.lang.String alo_UniGeneSpeciesPrefix
          ALO variable: UniGene 2 letter prefix (eg.
private  boolean alo_useRatioDataFlag
          ALO variable: data is ratio data (eg.
private  java.lang.String alo_vendor
          ALO variable: vendor making the array
 java.lang.String[] aloFile
          [0:nALOfilesFound-1] *.alo ALO files found the the ArrayLayout/ directory
private  java.lang.String aloFileName
          ALO variable: variables for parsed .alo file
private  java.lang.String aloFileVersion
          ALO variable: Version # of .alo file
 Cvt2Mae cvt
          Global link to Cvt2Mae instance
private  Element[] datum
          data elements from the input table
private  java.lang.String[] defDesiredFields
          Default desired fields table with no data.
private  int expectedNbrTokens
          expected # of tokens for this layout if not 0.
 int firstAL
          index of first default array layout in the ALO list
 int firstUserALO
          the index of the first user defined ALO.
private  java.lang.String fullPathAloFile
          full path of AL file trying to read
 ImageAnalysisMethod[] iam
          [0:nIAused-1] image analysis methods to choose from max of MAX_IMG_ANALY_METHODS
 int lastAL
          index of last default array layout in the ALO list
 int maxAL
          max # of array layouts in the ALO list
 int maxIAM
          max # of image analysis methods
 MaeConfigData mcd
          Global link to MaeConfigData instance
 int nALOfilesFound
          # of all *.alo files found in the ArrayLayout/ directory
 boolean readALOflag
          set to true if read .alo files
static int REMAP_GIPO
          REMAP codes - remapping GIPO.
static int REMAP_QUANT
          REMAP codes - remapping QUANT.
static int REMAP_SAMPLE
          REMAP codes - remapping SAMPLE.
static FieldMap specialFM
          Special Field Map for mapping our symbols see getMinReqFieldList()
 int useAL
          array layout to use, -1 means failed
 int useIAM
          method to use, -1 means failed
 UtilCM util
          Global link to UtilCM instance
 
Constructor Summary
SetupLayouts(Cvt2Mae cvt)
          SetupLayouts() - Constructor
 
Method Summary
private  boolean checkAndMakeALOdir(java.lang.String aloDir)
          checkAndMakeALOdir()- check for ArrayLayout/ directory tree.
private  boolean chkUniqueLayoutName(java.lang.String layoutName)
          chkUniqueLayoutName() - return TRUE if layout name is unique.
 void copyALOtoMCDstate()
          copyALOtoMCDstate() - Copy al[useAL].XXX state to mcd.XXX state.
 void copyMCDtoALOstate()
          copyMCDtoALOstate() - Copy mcd.XXX state to al[useAL].XXX state.
private  java.lang.String cvArrayLayoutToTableDataStr(ArrayLayout al)
          cvArrayLayoutToTableDataStr() - make prettyprint (N,V) string for writing to .alo file.
private  void deleteOldStyleAffyALOnamesatV70()
          deleteOldStyleAffyALOnamesatV70() - hack to remove bogus .alo names from the ArrayLayout directory so they don't appear in the list with the new names.
 boolean getMaeToUserFields(java.lang.String fileName, FieldMap fm, int row, int remapMode, boolean useMaxFieldsFlag)
          getMaeToUserFields() - extract desired fields from row of tokens by reading them from the fileName.
private  java.lang.String[] getMinReqFieldList(int remapMode)
          getMinReqFieldList() - get minimal required list of fields based on current mcd state.
 java.lang.String getPrintStringFieldRow(java.lang.String dirName, java.lang.String srcFileName, int row, java.lang.String msg)
          getPrintStringFieldRow() - get print string of specified row of file
private  java.lang.String getValueByName(FileTable ft, java.lang.String name)
          getValueByName() - get Value by Name for Table with Fields[0:1] = {Name","Value"}.
private  boolean getValueByNameBool(FileTable ft, java.lang.String name)
          getValueByNameBool() - get int Value by Name for Table with Fields[0:1] = {Name","Value"}.
private  int getValueByNameInt(FileTable ft, java.lang.String name)
          getValueByNameInt() - get int Value by Name for Table with Fields[0:1] = {Name","Value"}.
private  long getValueByNameLong(FileTable ft, java.lang.String name)
          getValueByNameLong() - get long Value by Name for Table with Fields[0:1] = {Name","Value"}.
private  boolean parseArrayLayoutToTableData(FileTable ft)
          parseArrayLayoutToTableData() - parse (N,V) table data to alo_XXXX vars.
private  boolean readArrayLayouts()
          readArrayLayouts() - read list of known array layouts from disk layout database directory.
 boolean removeALOfileFromALOlist(java.lang.String aloFName)
          removeALOfileFromALOlist() - remove ALO entry if match file name
 boolean setPseudoArrayToCurALO()
          setPseudoArrayToCurALO() - set PseudoArray values to al[useAL].XXX state.
 boolean setPseudoArrayToCurMCD()
          setPseudoArrayToCurMCD() - set PseudoArray values to mcd.XXX state.
 boolean setupArrayLayouts()
          setupArrayLayouts() - setup list of known array layouts.
private  void setupDefaultArrayLayouts()
          setupDefaultArrayLayouts() - setup list of default array layouts These are hardwired values.
 boolean setupImageAnalysisMethods()
          setupImageAnalysisMethods() - setup list of image analysis methods [DEPRICATED FOR NOW].
 boolean writeArrayLayout(ArrayLayout a, boolean logMsgFlag)
          writeArrayLayout() - write edited ArrayLayout 'a' else no-op.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

REMAP_GIPO

public static final int REMAP_GIPO
REMAP codes - remapping GIPO. Code of 0 means no remap in progress

REMAP_QUANT

public static final int REMAP_QUANT
REMAP codes - remapping QUANT. Code of 0 means no remap in progress

REMAP_SAMPLE

public static final int REMAP_SAMPLE
REMAP codes - remapping SAMPLE. Code of 0 means no remap in progress

cvt

public Cvt2Mae cvt
Global link to Cvt2Mae instance

mcd

public MaeConfigData mcd
Global link to MaeConfigData instance

util

public UtilCM util
Global link to UtilCM instance

alList

public ArrayLayout[] alList
[0:maxAL-1] array layouts to choose from max of MAX_ARRAY_LAYOUTS

maxAL

public int maxAL
max # of array layouts in the ALO list

firstAL

public int firstAL
index of first default array layout in the ALO list

lastAL

public int lastAL
index of last default array layout in the ALO list

useAL

public int useAL
array layout to use, -1 means failed

readALOflag

public boolean readALOflag
set to true if read .alo files

iam

public ImageAnalysisMethod[] iam
[0:nIAused-1] image analysis methods to choose from max of MAX_IMG_ANALY_METHODS

maxIAM

public int maxIAM
max # of image analysis methods

useIAM

public int useIAM
method to use, -1 means failed

firstUserALO

public int firstUserALO
the index of the first user defined ALO. This is so we dont' delete internally defined ALOs.

nALOfilesFound

public int nALOfilesFound
# of all *.alo files found in the ArrayLayout/ directory

aloFile

public java.lang.String[] aloFile
[0:nALOfilesFound-1] *.alo ALO files found the the ArrayLayout/ directory

fullPathAloFile

private java.lang.String fullPathAloFile
full path of AL file trying to read

datum

private Element[] datum
data elements from the input table

expectedNbrTokens

private int expectedNbrTokens
expected # of tokens for this layout if not 0.

specialFM

public static FieldMap specialFM
Special Field Map for mapping our symbols see getMinReqFieldList()

aloFileVersion

private java.lang.String aloFileVersion
ALO variable: Version # of .alo file

aloFileName

private java.lang.String aloFileName
ALO variable: variables for parsed .alo file

alo_vendor

private java.lang.String alo_vendor
ALO variable: vendor making the array

alo_layoutName

private java.lang.String alo_layoutName
ALO variable: name of the layout

alo_species

private java.lang.String alo_species
ALO variable: species of sample

alo_quantTool

private java.lang.String alo_quantTool
ALO variable: name of the quantification program

alo_UniGeneSpeciesPrefix

private java.lang.String alo_UniGeneSpeciesPrefix
ALO variable: UniGene 2 letter prefix (eg. "Hs" for human)

alo_commentToken

private java.lang.String alo_commentToken
ALO variable: optional comment token

alo_initialKeyword

private java.lang.String alo_initialKeyword
ALO variable: optional initial keyword in leftmost field

alo_hasMultDatasetsFlag

private boolean alo_hasMultDatasetsFlag
ALO variable: input file has multiple samples

alo_specifyGeometryByNbrSpotsFlag

private boolean alo_specifyGeometryByNbrSpotsFlag
ALO variable: specify (F,G,R,C) from # of spots in PseudoArray

alo_allowNegQuantDataFlag

private boolean alo_allowNegQuantDataFlag
ALO variable: allow negative quant dat

alo_hasBkgrdDataFlag

public boolean alo_hasBkgrdDataFlag
ALO variable: has background intensity data

alo_hasQuantXYcoordsFlag

public boolean alo_hasQuantXYcoordsFlag
ALO variable: has actual quant XY coordinates data

alo_maxFields

private int alo_maxFields
ALO variable: number of duplicate Fields of Grids/array

alo_nGridsPerField

private int alo_nGridsPerField
ALO variable: # of grids/field

alo_rowsPerGrid

private int alo_rowsPerGrid
ALO variable: # of rows/grid

alo_colsPerGrid

private int alo_colsPerGrid
ALO variable: # of columns/grid

alo_maxRowsExpected

private int alo_maxRowsExpected
ALO variable: maximum number of spots (elements or rows)/sample

alo_expectedNbrTokens

private int alo_expectedNbrTokens
ALO variable: # of expected tokens

alo_rowWithSamples

private int alo_rowWithSamples
ALO variable: # of row of FieldQ input file that contains sample names

alo_rowWithFields

private int alo_rowWithFields
ALO variable: # of row of FieldQ input file that contains Field names

alo_rowWithData

private int alo_rowWithData
ALO variable: # of row of FieldQ input file that contains data

alo_rowWithSepGIPOFields

private int alo_rowWithSepGIPOFields
ALO variable: # of row of FieldG separate GIPO input file that contains Field names

alo_rowWithSepGIPOData

private int alo_rowWithSepGIPOData
ALO variable: # of row of FieldG separate GIPO input file that contains data

alo_pseudoArrayFlag

private boolean alo_pseudoArrayFlag
ALO variable: use generated PseudoArray image

alo_useRatioDataFlag

private boolean alo_useRatioDataFlag
ALO variable: data is ratio data (eg. Cy3/Cy5) vs. single sample intensity data.

alo_chkAndEditFieldNamesFlag

private boolean alo_chkAndEditFieldNamesFlag
flag: check and edit Samples and Field names data before use. This is for handling the bad Affy fields data generated by the old Affy software.

alo_desiredFields

private java.lang.String[] alo_desiredFields
ALO variable: list of FieldMaps for the layout

alo_bitProps

private long alo_bitProps
ALO variable: bit mcd.PROP_xxxx properties

alo_geoPlatformID

private java.lang.String alo_geoPlatformID
Optional GEO Platform ID

defDesiredFields

private final java.lang.String[] defDesiredFields
Default desired fields table with no data. This may be added later.
Constructor Detail

SetupLayouts

public SetupLayouts(Cvt2Mae cvt)
SetupLayouts() - Constructor
Parameters:
cvt - is instance of Cvt2Mae
Method Detail

removeALOfileFromALOlist

public boolean removeALOfileFromALOlist(java.lang.String aloFName)
removeALOfileFromALOlist() - remove ALO entry if match file name
Parameters:
aloFName - is name of .alo file

deleteOldStyleAffyALOnamesatV70

private void deleteOldStyleAffyALOnamesatV70()
deleteOldStyleAffyALOnamesatV70() - hack to remove bogus .alo names from the ArrayLayout directory so they don't appear in the list with the new names. If the name is found, it removes it from the list & deletes the file.

readArrayLayouts

private boolean readArrayLayouts()
readArrayLayouts() - read list of known array layouts from disk layout database directory. Note: new types could be added. by just adding them to the directory.
 1. read directory contents
 2. read the layouts into alList[1:maxAL-1]. Note: slot [0] is for
  entry that is pushed before we get here so maxAL
 starts at 1.
Returns:
return true if you can set up at least ONE ALO, else return false if can't find or setup ANY of the layouts.
See Also:
ArrayLayout, FileTable.readFileAsTable(java.lang.String), FileTable, getValueByName(FileTable, java.lang.String), parseArrayLayoutToTableData(FileTable)

parseArrayLayoutToTableData

private boolean parseArrayLayoutToTableData(FileTable ft)
parseArrayLayoutToTableData() - parse (N,V) table data to alo_XXXX vars.
Parameters:
ft - is FileTable of array layouts
Returns:
false if problem...
See Also:
getValueByName(FileTable, java.lang.String), getValueByNameBool(FileTable, java.lang.String), getValueByNameInt(FileTable, java.lang.String)

getValueByName

private java.lang.String getValueByName(FileTable ft,
                                        java.lang.String name)
getValueByName() - get Value by Name for Table with Fields[0:1] = {Name","Value"}.
Parameters:
ft - is FileTable
name - to lookup
Returns:
value if found, else null if failed.

getValueByNameLong

private long getValueByNameLong(FileTable ft,
                                java.lang.String name)
getValueByNameLong() - get long Value by Name for Table with Fields[0:1] = {Name","Value"}.
Parameters:
ft - is FileTable
name - to lookup
Returns:
value if found, else 0 if failed.
See Also:
UtilCM.cvs2l(java.lang.String, long), getValueByName(FileTable, java.lang.String)

getValueByNameInt

private int getValueByNameInt(FileTable ft,
                              java.lang.String name)
getValueByNameInt() - get int Value by Name for Table with Fields[0:1] = {Name","Value"}.
Parameters:
ft - is FileTable
name - to lookup
Returns:
value if found, else 0 if failed.
See Also:
UtilCM.cvs2i(java.lang.String, int), getValueByName(FileTable, java.lang.String)

getValueByNameBool

private boolean getValueByNameBool(FileTable ft,
                                   java.lang.String name)
getValueByNameBool() - get int Value by Name for Table with Fields[0:1] = {Name","Value"}.
Parameters:
ft - is FileTable
name - to lookup
Returns:
value if found, else false if failed.
See Also:
UtilCM.cvs2b(java.lang.String, boolean), getValueByName(FileTable, java.lang.String)

cvArrayLayoutToTableDataStr

private java.lang.String cvArrayLayoutToTableDataStr(ArrayLayout al)
cvArrayLayoutToTableDataStr() - make prettyprint (N,V) string for writing to .alo file. Note: no final CRLF.
Parameters:
al - is array layout to use
Returns:
String table for this array layout else null if not found
See Also:
FieldMap

checkAndMakeALOdir

private boolean checkAndMakeALOdir(java.lang.String aloDir)
checkAndMakeALOdir()- check for ArrayLayout/ directory tree. If not found, make the directory
Parameters:
aloDir - is location of ArrayLayout/ directory
Returns:
true if successful.

writeArrayLayout

public boolean writeArrayLayout(ArrayLayout a,
                                boolean logMsgFlag)
writeArrayLayout() - write edited ArrayLayout 'a' else no-op. Save file in the disk layout database directory. Note: new types could be added. by just adding them to the directory.
Parameters:
a - is array layout to write
logMsgFlag - to log this transaction
Returns:
true if write the array layout.
See Also:
UtilCM.logMsg(java.lang.String, java.awt.Color), UtilCM.logMsg2(java.lang.String, java.awt.Color), UtilCM.logMsg3(java.lang.String, java.awt.Color), cvArrayLayoutToTableDataStr(ArrayLayout)

chkUniqueLayoutName

private boolean chkUniqueLayoutName(java.lang.String layoutName)
chkUniqueLayoutName() - return TRUE if layout name is unique.
Parameters:
layoutName - to check
Returns:
true if name is unique

setupArrayLayouts

public boolean setupArrayLayouts()
setupArrayLayouts() - setup list of known array layouts. Read from configuration file where new types could be added.
Returns:
true if find or setup the layouts.
See Also:
ArrayLayout, UtilCM.logMsg(java.lang.String, java.awt.Color), UtilCM.logMsg2(java.lang.String, java.awt.Color), UtilCM.logMsg3(java.lang.String, java.awt.Color), readArrayLayouts(), setupDefaultArrayLayouts(), writeArrayLayout(ArrayLayout, boolean)

setupDefaultArrayLayouts

private void setupDefaultArrayLayouts()
setupDefaultArrayLayouts() - setup list of default array layouts These are hardwired values. Note: put generic types FIRST - then add special instances that may contain other options such as species specific or in the case of the Affy data, getting the genomic IDs from the Description, etc..
See Also:
ArrayLayout, chkUniqueLayoutName(java.lang.String)

setupImageAnalysisMethods

public boolean setupImageAnalysisMethods()
setupImageAnalysisMethods() - setup list of image analysis methods [DEPRICATED FOR NOW]. [TODO] read from configuration file where new types could be added.
Returns:
false if can't find or setup the image analysis methods.
See Also:
ImageAnalysisMethod

setPseudoArrayToCurMCD

public boolean setPseudoArrayToCurMCD()
setPseudoArrayToCurMCD() - set PseudoArray values to mcd.XXX state. But only if mcd.specifyGeometryByNbrSpotsFlag is true.
Returns:
true if generated pseudo array data in ALO.
See Also:
PseudoArray, UtilCM.logMsg(java.lang.String, java.awt.Color)

setPseudoArrayToCurALO

public boolean setPseudoArrayToCurALO()
setPseudoArrayToCurALO() - set PseudoArray values to al[useAL].XXX state. But only if al.specifyGeometryByNbrSpotsFlag is true.
Returns:
true if generated pseudo array data in ALO.
See Also:
PseudoArray, UtilCM.logMsg(java.lang.String, java.awt.Color)

copyMCDtoALOstate

public void copyMCDtoALOstate()
copyMCDtoALOstate() - Copy mcd.XXX state to al[useAL].XXX state.

copyALOtoMCDstate

public void copyALOtoMCDstate()
copyALOtoMCDstate() - Copy al[useAL].XXX state to mcd.XXX state.
See Also:
MaeConfigData.setMCDstateFromBitProp(long), ArrayLayout

getMinReqFieldList

private java.lang.String[] getMinReqFieldList(int remapMode)
getMinReqFieldList() - get minimal required list of fields based on current mcd state. Based on the semantics of the current state that is set by "Edit Layout", we may not want to require particular fields or we may want to rename them (eg. use Cy3, Cy5 instead of RawIntensity1, RawIntensity2 if if mcd.useRatioDataFlag is set, etc.
Parameters:
remapMode - to enable remaping of field names
Returns:
list of minimum required fields else null if error
See Also:
FieldMap.addEntry(java.lang.String, java.lang.String, java.lang.String, java.lang.String), FieldMap

getMaeToUserFields

public boolean getMaeToUserFields(java.lang.String fileName,
                                  FieldMap fm,
                                  int row,
                                  int remapMode,
                                  boolean useMaxFieldsFlag)
getMaeToUserFields() - extract desired fields from row of tokens by reading them from the fileName. This is used in the Assign GIPO/QUANT fields operations.
Parameters:
fileName - to read
fm - is field map to use
row - to use
remapMode -  
useMaxFieldsFlag -  
Returns:
true if successful.
See Also:
FieldMapGUI, FileTable, FileTable.readTableFieldsFromFile(java.lang.String, int), UtilCM.logMsg(java.lang.String, java.awt.Color), UtilCM.logMsg2(java.lang.String, java.awt.Color), getMinReqFieldList(int)

getPrintStringFieldRow

public java.lang.String getPrintStringFieldRow(java.lang.String dirName,
                                               java.lang.String srcFileName,
                                               int row,
                                               java.lang.String msg)
getPrintStringFieldRow() - get print string of specified row of file
Parameters:
dirName - is directory name of file
srcFileName - file name
row - to read
msg - to display while reading file
Returns:
print string of the row else "" if failed
See Also:
FileTable, FileTable.readTableFieldsFromFile(java.lang.String, int)