Class ClusterGenes

java.lang.Object
  |
  +--ClusterGenes

class ClusterGenes
extends java.lang.Object

Class to generate gene clusters from working data Filtered gene list. This class represents an individual ClusterGenes entry. The data structure is shared between the different clustering methods. Only one cluster method may be active at any one time.

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 MAExplorer Mozilla and Legal files are available on http://maexplorer.sourceforge.net/.

Version:
$Date: 2003/07/07 21:40:41 $ $Revision: 1.8 $
Author:
P. Lemkin (NCI), G. Thornwall (SAIC), NCI-Frederick, Frederick, MD
See Also:
MAExplorer Home, Gene, GeneList, HierClustNode

Inner Class Summary
(package private)  class ClusterGenes.Cluster
          [FUTURE] Class Cluster holds an ordered list of genes for a particular cluster.
 
Field Summary
(package private) static boolean activeClusterMethod
          active instance, GC others
(package private)  int[] bestKmeansForGene
          [0:nClist-1] best Kmeans node cluster in [1:maxKmeansNodes] for all genes in complexClusterCL
(package private) static GeneGeneDist ccd
          link to global GeneGeneDist instance
(package private)  float[] ccDist1D
           Gene-Gene distance matrix is a lower-diagonal ccDist[i][j] that is equivalent to ccDist1D[addr1D(i,j)]
private static Config cfg
          link to global Config instance
(package private) static GeneList complexClusterCL
          ARG: list of genes to be clustered
(package private) static GeneList curClusterCL
          ARG: current genes being clustered
(package private) static Gene curGene
          current gene being clustered
(package private) static float curGeneDistThr
          Threshold distance for current gene cluster
private static float[] cv1Tmp
          EP vector for CV1 computations
private static float[] cv1TmpEP
          EP vector for CV1 computations
private static float[] cv2Tmp
          EP vector for CV2 computations
private static float[] cv2TmpEP
          EP vector for CV2 computations
(package private) static int DEF_NBR_RESAMPLE_RUNS
          Default number of resampling runs
(package private) static int DEFAULT_N_KMEANS_NODES
          Default # of K-means nodes
(package private) static int DEFAULT_N_SOM_NODES1
          Default # of SOM map nodes
(package private) static int DEFAULT_N_SOM_NODES2
          Default # of SOM map nodes
private static Filter fc
          link to global Filter instance
private static FileIO fio
          link to global FileIO instance
private static GeneClass gct
          link to global GeneClass instance
(package private) static ShowStringPopup geneClustersPopup
          for updateable String Cluster Report if used
(package private)  float[][] geneEPvector
          normalized quantitation vector for all genes of size [0:nClist-1][0:nEPmsList-1] and also [0:nObj-1][0:nDataVect-1]
(package private) static HierClustNode hcn
          hierarchical clustering tree
(package private) static ShowPlotPopup hierClusterGramPopup
          plot popup for ClusterGram display for hierarchical clustering
(package private)  float[][] hpDataMnA
          opt Mean HP-E quant data [nKmeansNodes][nEPmsList]
(package private)  int[] hpDataNbrA
          opt # genes/K-means-cluster for nEPmsList HP-Es [nKmeansNodes]
(package private)  float[][] hpDataSDA
          opt S.D.
(package private)  Gene initialSeedGene
          initial seed gene - either 1st or current Obj gene
(package private) static ShowExprProfilesPopup KmeansClustersExprProfPopup
           
(package private) static ShowStringPopup KmeansClustersPopup
          string report exists if not null
(package private)  float[] kMeansDist
          [1:maxKmeansNodes] distance between K-means primary clusters
(package private)  int[] kMeansList
          [1:maxKmeansNodes] index of gene as K-means cluster node
(package private)  float[] kMeansMaxDist
          [1:maxKmeansNodes] max distance within each K-means primary clusters
private static MAExplorer mae
          link to global MAExplorer instance
(package private) static int maxGenesForKmeansClustering
          max # filtered genes to do K-means clustering
(package private) static int maxGenesInCurCluster
          max # filtered genes to do curClusterCL clustering
(package private)  float maxGlobalDist
          maximum global distance seen for all distances
(package private)  int maxKmeansNodes
          max # of K-means primary nodes will be set by thresholding slider
(package private) static int maxNgeneClusterCnt
          max # of clusters found
(package private)  float[][] meanClusterVector
          mean normalized quantitation vector for K-means nodes [1:nKmeansNodes][0:nMSList-1]
(package private)  int method
          Current clustering method.
(package private) static int METHOD_CLUSTER_KMEANS
          Method: find most orthogonal clusters and then subset rest of genes to those.
(package private) static int METHOD_HIERARCHICAL_CLUSTERING
          Method: Numerical Taxonomy, Sneath&Sokol, 1973, W.H.
(package private) static int METHOD_SIMILAR_GENE_COUNTS_CLUSTERING
          Method: Numerical Taxonomy, Sneath&Sokol, 1973, W.H.
(package private) static int METHOD_SIMILAR_GENES_CLUSTERING
          Method: Numerical Taxonomy, Sneath&Sokol, 1973, W.H.
(package private) static int METHOD_SOM_CLUSTERING
          Method: SOM - Self-Organizing-Maps, Tamayo (1999) PNAS USA 96:2907-2912
(package private)  GeneList mnClustersCL
          artificial mean K-means gene list
(package private)  float[] mnWithinClusterDist
          [1:maxKmeansNodes] mean within-cluster distance between K-means clusters
(package private)  MaHybridSample[] msEPlist
          list of expression profile samples [1:nEPmsList] where genes are to be checked normally this is mae.msListE[1:mae.nHP_E].
(package private)  int nClist
          i.e size of complexClusterCL.length
(package private)  int[][] nearestGenesIdx
          [0:nClist-1] [0:nClist-1] sorted index of nearest genes
(package private)  int nEPmsList
          size of geneEPvector[][0:nMSList-1]
(package private)  int nKmeansNodes
          # of unique K-means nodes found
(package private) static int prevMethod
          previous clustering method.
(package private)  float[] sdWithinClusterDist
          [1:maxKmeansNodes] StdDev within-cluster distance between K-means clusters
(package private) static int UPDATE
          bit property: cause PopupRegistry to force a update of a cluster window
 
Constructor Summary
(package private) ClusterGenes(GeneList complexClusterCL, MaHybridSample[] msEPlist, int nEPmsList)
          ClusterGenes() - constructor to create instance of new cluster method
(package private) ClusterGenes(MAExplorer mae)
          ClusterGenes() - constructor to create instance of new cluster method
 
Method Summary
private  int addr1D(int x, int y)
          addr1D() - lookup lower-diagonal addr1D(x,y) [y' + x'*(x'+1)/2] where:
private  void assignGeneListToBestKmeansNodes(boolean useMeanClusterVectors)
          assignGeneListToBestKmeansNodes() - assign genes for all complexClusterCL genes to the best N primary Nodes clusters.
private  float calcMeanClusterClusterDist(int n, int m)
          calcMeanClusterClusterDist() - m,n cluster-cluster Euclidean distances.
private  void calcMeanClusterVectors()
          calcMeanClusterVectors() - compute meanClusterVector Kmeans nodes.
private  void calcMedianClusterVectors()
          calcMedianClusterVectors() - compute meanClusterVector as K-median nodes.
private  void calcNearestGenes()
          calcNearestGenes() - compute rank ordered sorted list of nearest genes
(package private) static void chkIfAbort()
          chkIfAbort() - check if abort, then shut down clustering.
(package private) static void cleanup()
          cleanup() - close up what needs to be closed and GC all structures.
private  float computeGeneToMeanClusterDistance(int fk, int n)
          computeGeneToMeanClusterDistance() - gene to Mn-Cluster Euclidean distances
(package private) static boolean copyCurClusterToEditedGeneList()
          copyCurClusterToEditedGeneList() - set EGL to K-means curCluster genes for the most similar genes.
(package private)  boolean createClusterMethod(GeneList complexClusterCL, int nbrOfClusters, MaHybridSample[] msEPlist, int nEPmsList, int method, boolean resetFlag)
          createClusterMethod() - create instance of new cluster method
private  boolean createKmeansNodesPartition(int maxKmeansNodes)
          createKmeansNodesPartition() - setup primary K-means nodes partition.
(package private)  void createSimilarGeneCountsClusters()
          createSimilarGeneCountsClusters() - create similar gene counts clusters
(package private)  void createSimilarGenedCluster()
          createSimilarGenedCluster() - create cluster of similar genes
(package private) static void findAllGeneClusterCounts(MAExplorer maE, float clusterDistThr)
          findAllGeneClusterCounts() - # genes such that geneDist LEQ geneDistThr.
(package private) static int findClustersOfGene(MAExplorer maE, Gene geneToTest, float clusterDistThr, boolean doSortFlag)
          findClustersOfGene() - find all HP-E gene clusters LT clusterDist.
private  int[] getSortedListOfNearestGenesIdx(int cIdx)
          getSortedListOfNearestGenesIdx()- get sorted list of nearest genes[] of cIdx.
(package private)  void initData()
          initData() - init data
private  boolean reassignKmeansNodes()
          reassignKmeansNodes() - reassign nodes based on closest to new mean clusters.
(package private)  boolean removePreviousClusterMethod(int method)
          removePreviousClusterMethod() - remove any popups and data structures from previous cluster method if it was active.
private  void reportHierClusterTree()
          reportHierClusterTree() - popup report of hierarchical clusters tree.
private  void reportKmeansNodes()
          reportKmeansNodes() - popup expression profile report of K-means nodes
(package private)  boolean saveKmeansClustersAsGeneSets()
          saveKmeansClustersAsGeneSets() - save K-means clusters in named Gene BitSets.
(package private)  boolean setupKmeansHPstats()
          setupKmeansHPstats() - compute summary K-means node HP statistics for each HP sample in each Node and assign mnClustersCL to the nKmeansNodes primary nodes.
(package private) static void showReducedFilteredGenesMsg(java.lang.String optMsg2, java.lang.String optMsg3, int maxAllowed)
          showReducedFilteredGenesMsg() - show 'reduce the# of filtered genes' msg
(package private)  void sortKmeansClusterList(GeneList srcCL, GeneList dstCL)
          sortKmeansClusterList() - sort K-means srcCL to dstCL by Node number.
private  void sortNearestGenes(int c)
          sortNearestGenes() - sort nearest gene list for gene # c by min.
(package private) static void updateAllClustersGeneReport()
          updateAllClustersGeneReport() - update all filtered clusters gene report
(package private) static void updateGeneClustersOfCurrentGeneReport()
          updateGeneClustersOfCurrentGeneReport() - update current gene cluster report
private  void updateHierarchicalClusters()
          updateHierarchicalClusters() - create or update Hierarchical clusters
(package private)  void updateKmeansClusters()
          updateKmeansClusters() - update an existing Kmeans cluster window
(package private)  void updateSimilarGenesListCounts()
          updateSimilarGenesListCounts() - this updates the cluster counts for this cycle of clustering.
private  void updateSOMclusters()
          updateSOMclusters() - [FUTURE] create or update Self Organizing Maps clusters.
(package private)  boolean withinClusterKmeansStatistics()
          withinClusterKmeansStatistics() - compute mean & StdDev within cluster stats
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

mae

private static MAExplorer mae
link to global MAExplorer instance

fc

private static Filter fc
link to global Filter instance

fio

private static FileIO fio
link to global FileIO instance

cfg

private static Config cfg
link to global Config instance

ccd

static GeneGeneDist ccd
link to global GeneGeneDist instance

gct

private static GeneClass gct
link to global GeneClass instance

activeClusterMethod

static boolean activeClusterMethod
active instance, GC others

METHOD_SOM_CLUSTERING

static final int METHOD_SOM_CLUSTERING
Method: SOM - Self-Organizing-Maps, Tamayo (1999) PNAS USA 96:2907-2912

METHOD_CLUSTER_KMEANS

static final int METHOD_CLUSTER_KMEANS
Method: find most orthogonal clusters and then subset rest of genes to those. K-means has N Primary Nodes

METHOD_HIERARCHICAL_CLUSTERING

static final int METHOD_HIERARCHICAL_CLUSTERING
Method: Numerical Taxonomy, Sneath&Sokol, 1973, W.H. Freeman Co.

METHOD_SIMILAR_GENES_CLUSTERING

static final int METHOD_SIMILAR_GENES_CLUSTERING
Method: Numerical Taxonomy, Sneath&Sokol, 1973, W.H. Freeman Co.

METHOD_SIMILAR_GENE_COUNTS_CLUSTERING

static final int METHOD_SIMILAR_GENE_COUNTS_CLUSTERING
Method: Numerical Taxonomy, Sneath&Sokol, 1973, W.H. Freeman Co.

UPDATE

static final int UPDATE
bit property: cause PopupRegistry to force a update of a cluster window

DEFAULT_N_SOM_NODES1

static final int DEFAULT_N_SOM_NODES1
Default # of SOM map nodes

DEFAULT_N_SOM_NODES2

static final int DEFAULT_N_SOM_NODES2
Default # of SOM map nodes

DEFAULT_N_KMEANS_NODES

static final int DEFAULT_N_KMEANS_NODES
Default # of K-means nodes

DEF_NBR_RESAMPLE_RUNS

static int DEF_NBR_RESAMPLE_RUNS
Default number of resampling runs

method

int method
Current clustering method. Note: there may possibly be multiple cluster methods if for example we used some for the data filter as well as the popup cluster windows.

prevMethod

static int prevMethod
previous clustering method. We at most remove one previous cluster method popups.

maxGenesInCurCluster

static int maxGenesInCurCluster
max # filtered genes to do curClusterCL clustering

curClusterCL

static GeneList curClusterCL
ARG: current genes being clustered

curGene

static Gene curGene
current gene being clustered

curGeneDistThr

static float curGeneDistThr
Threshold distance for current gene cluster

complexClusterCL

static GeneList complexClusterCL
ARG: list of genes to be clustered

nClist

int nClist
i.e size of complexClusterCL.length

msEPlist

MaHybridSample[] msEPlist
list of expression profile samples [1:nEPmsList] where genes are to be checked normally this is mae.msListE[1:mae.nHP_E].

nEPmsList

int nEPmsList
size of geneEPvector[][0:nMSList-1]

cv1Tmp

private static float[] cv1Tmp
EP vector for CV1 computations

cv2Tmp

private static float[] cv2Tmp
EP vector for CV2 computations

cv1TmpEP

private static float[] cv1TmpEP
EP vector for CV1 computations

cv2TmpEP

private static float[] cv2TmpEP
EP vector for CV2 computations

geneEPvector

float[][] geneEPvector
normalized quantitation vector for all genes of size [0:nClist-1][0:nEPmsList-1] and also [0:nObj-1][0:nDataVect-1]

ccDist1D

float[] ccDist1D
 Gene-Gene distance matrix is a lower-diagonal ccDist[i][j]
 that is equivalent to ccDist1D[addr1D(i,j)]
 where:
     i' = (i>j) ? i : j
    j' = (i>j) ? j : i
    addr1D(i,j)= j' + i'*(i'+1)/2
This computes LSQ euclidean distance of the gene pattern vector from another gene using the current distance metric.

geneClustersPopup

static ShowStringPopup geneClustersPopup
for updateable String Cluster Report if used

hcn

static HierClustNode hcn
hierarchical clustering tree

hierClusterGramPopup

static ShowPlotPopup hierClusterGramPopup
plot popup for ClusterGram display for hierarchical clustering

nearestGenesIdx

int[][] nearestGenesIdx
[0:nClist-1] [0:nClist-1] sorted index of nearest genes

maxGenesForKmeansClustering

static int maxGenesForKmeansClustering
max # filtered genes to do K-means clustering

maxNgeneClusterCnt

static int maxNgeneClusterCnt
max # of clusters found

initialSeedGene

Gene initialSeedGene
initial seed gene - either 1st or current Obj gene

bestKmeansForGene

int[] bestKmeansForGene
[0:nClist-1] best Kmeans node cluster in [1:maxKmeansNodes] for all genes in complexClusterCL

maxGlobalDist

float maxGlobalDist
maximum global distance seen for all distances

meanClusterVector

float[][] meanClusterVector
mean normalized quantitation vector for K-means nodes [1:nKmeansNodes][0:nMSList-1]

kMeansDist

float[] kMeansDist
[1:maxKmeansNodes] distance between K-means primary clusters

kMeansMaxDist

float[] kMeansMaxDist
[1:maxKmeansNodes] max distance within each K-means primary clusters

mnWithinClusterDist

float[] mnWithinClusterDist
[1:maxKmeansNodes] mean within-cluster distance between K-means clusters

sdWithinClusterDist

float[] sdWithinClusterDist
[1:maxKmeansNodes] StdDev within-cluster distance between K-means clusters

kMeansList

int[] kMeansList
[1:maxKmeansNodes] index of gene as K-means cluster node

mnClustersCL

GeneList mnClustersCL
artificial mean K-means gene list

hpDataNbrA

int[] hpDataNbrA
opt # genes/K-means-cluster for nEPmsList HP-Es [nKmeansNodes]

hpDataMnA

float[][] hpDataMnA
opt Mean HP-E quant data [nKmeansNodes][nEPmsList]

hpDataSDA

float[][] hpDataSDA
opt S.D. HP-E quant data [nKmeansNodes][nEPmsList]

nKmeansNodes

int nKmeansNodes
# of unique K-means nodes found

maxKmeansNodes

int maxKmeansNodes
max # of K-means primary nodes will be set by thresholding slider

KmeansClustersExprProfPopup

static ShowExprProfilesPopup KmeansClustersExprProfPopup

KmeansClustersPopup

static ShowStringPopup KmeansClustersPopup
string report exists if not null
Constructor Detail

ClusterGenes

ClusterGenes(MAExplorer mae)
ClusterGenes() - constructor to create instance of new cluster method
Parameters:
mae - is the MAExplorer instance

ClusterGenes

ClusterGenes(GeneList complexClusterCL,
             MaHybridSample[] msEPlist,
             int nEPmsList)
ClusterGenes() - constructor to create instance of new cluster method
Parameters:
complexClusterCL - is the list of genes to cluster by sample
msEPlist - is the list of sample HP's to cluster in the expr vector
nEPmsList - is the # HP's to cluster
Method Detail

createClusterMethod

boolean createClusterMethod(GeneList complexClusterCL,
                            int nbrOfClusters,
                            MaHybridSample[] msEPlist,
                            int nEPmsList,
                            int method,
                            boolean resetFlag)
createClusterMethod() - create instance of new cluster method
Parameters:
complexClusterCL - is the list of genes to cluster by sample
nbrOfClusters - is the # of clusters to find for K-means
msEPlist - is the list of sample HP's to cluster in the expr vector
nEPmsList - is the # HP's to cluster
method - is the clusterMETHOD_xxx to use
resetFlag - is true if reset the data structures.
Returns:
true if succeed.
See Also:
MenuBarFrame.setSTOPbuttonState(boolean, boolean), showReducedFilteredGenesMsg(java.lang.String, java.lang.String, int), updateHierarchicalClusters(), updateKmeansClusters(), updateSOMclusters()

initData

void initData()
initData() - init data

removePreviousClusterMethod

boolean removePreviousClusterMethod(int method)
removePreviousClusterMethod() - remove any popups and data structures from previous cluster method if it was active. It will not remove the previous method (prevMethod) if it is the same as the new method. Note: a prevMethod value of 0 indicates that there was no previous method. The activeClusterMethod flag is set when the previous method is active.
Parameters:
method - is the new method. If it is 0, then just remove the previous method.
Returns:
true if remove a previous cluster method

createSimilarGenedCluster

void createSimilarGenedCluster()
createSimilarGenedCluster() - create cluster of similar genes

createSimilarGeneCountsClusters

void createSimilarGeneCountsClusters()
createSimilarGeneCountsClusters() - create similar gene counts clusters

updateHierarchicalClusters

private void updateHierarchicalClusters()
updateHierarchicalClusters() - create or update Hierarchical clusters
See Also:
EventMenu.setClusterDisplayState(java.awt.CheckboxMenuItem, boolean), GeneGeneDist.calcNormGeneVectors(GeneList, int), HierClustNode, HierClustNode.calcHierCluster(float[][], java.lang.String[], int[], int), Util.showMsg3(java.lang.String), chkIfAbort(), reportHierClusterTree()

updateSOMclusters

private void updateSOMclusters()
updateSOMclusters() - [FUTURE] create or update Self Organizing Maps clusters. [TODO] migrate SOM code into a MAEPlugin.
See Also:
GeneGeneDist.calcGeneGeneDists(float[], int, int), GeneGeneDist.calcNormGeneVectors(GeneList, int), calcNearestGenes()

updateKmeansClusters

void updateKmeansClusters()
updateKmeansClusters() - update an existing Kmeans cluster window
See Also:
Filter.showNbrFilteredGenes(), GeneGeneDist.calcNormGeneVectors(GeneList, int), GeneGeneDist.calcGeneGeneDists(float[], int, int), Component.repaint(), Util.showMsg3(java.lang.String), assignGeneListToBestKmeansNodes(boolean), calcMeanClusterVectors(), calcMedianClusterVectors(), createKmeansNodesPartition(int), reassignKmeansNodes(), reportKmeansNodes(), setupKmeansHPstats(), withinClusterKmeansStatistics()

updateSimilarGenesListCounts

void updateSimilarGenesListCounts()
updateSimilarGenesListCounts() - this updates the cluster counts for this cycle of clustering. Check all genes in the same cluster and add them to the similar genes list for each gene in the cluster. Do this for all clusters.

addr1D

private final int addr1D(int x,
                         int y)
addr1D() - lookup lower-diagonal addr1D(x,y) [y' + x'*(x'+1)/2] where:
    x' = (x>y) ? x : y,
    y' = (x>y) ? y : x.
Return the computed 1D address for the 2D (x,y) address.

showReducedFilteredGenesMsg

static void showReducedFilteredGenesMsg(java.lang.String optMsg2,
                                        java.lang.String optMsg3,
                                        int maxAllowed)
showReducedFilteredGenesMsg() - show 'reduce the# of filtered genes' msg
Parameters:
optMsg2 - is cluster message for msg2
optMsg3 - is cluster message for msg2
maxAllowed - is # of genes that can be clustered max (if a problem)
See Also:
Filter.showNbrFilteredGenes(), StateScrollers.regenerateScrollers(boolean), Util.showMsg2(java.lang.String), Util.showMsg3(java.lang.String), Util.sleepMsec(int)

calcMeanClusterClusterDist

private float calcMeanClusterClusterDist(int n,
                                         int m)
calcMeanClusterClusterDist() - m,n cluster-cluster Euclidean distances.
Parameters:
n - is cluster n
m - is cluster m
Returns:
distance between mean cluster vectors for clusters n and m

computeGeneToMeanClusterDistance

private float computeGeneToMeanClusterDistance(int fk,
                                               int n)
computeGeneToMeanClusterDistance() - gene to Mn-Cluster Euclidean distances
Parameters:
fk - is index of gene
n - is cluster n
Returns:
distance between gene fk and mean cluster vector for cluster n.

sortNearestGenes

private void sortNearestGenes(int c)
sortNearestGenes() - sort nearest gene list for gene # c by min. distance. The genes are sorted by minimum geneGeneDist[c][] from nearest to furthest. NOTE: This is NOT a symmetric array!
Parameters:
c - is gene number
See Also:
addr1D(int, int)

calcNearestGenes

private void calcNearestGenes()
calcNearestGenes() - compute rank ordered sorted list of nearest genes
See Also:
sortNearestGenes(int)

getSortedListOfNearestGenesIdx

private int[] getSortedListOfNearestGenesIdx(int cIdx)
getSortedListOfNearestGenesIdx()- get sorted list of nearest genes[] of cIdx. The list should be sorted already.
Parameters:
cIdx - is gene index of getSortedListOfNearestGenes
Returns:
list of nearest genes indices

findAllGeneClusterCounts

static void findAllGeneClusterCounts(MAExplorer maE,
                                     float clusterDistThr)
findAllGeneClusterCounts() - # genes such that geneDist LEQ geneDistThr. The genes being tested are in the fc.workingCL.
Parameters:
maE - is the MAExplorer instance
clusterDistThr - is threshold distance to set
See Also:
Filter.showNbrFilteredGenes(), MenuBarFrame.setSTOPbuttonState(boolean, boolean), Util.showMsg3(java.lang.String), Gene.setGeneData(float), Gene.sortGeneList(Gene[], int, boolean), findClustersOfGene(MAExplorer, Gene, float, boolean), showReducedFilteredGenesMsg(java.lang.String, java.lang.String, int), updateAllClustersGeneReport()

findClustersOfGene

static int findClustersOfGene(MAExplorer maE,
                              Gene geneToTest,
                              float clusterDistThr,
                              boolean doSortFlag)
findClustersOfGene() - find all HP-E gene clusters LT clusterDist. Save results in curClusterCL. Also copy curClusterCL to the E.C.L as a side effect.
Parameters:
maE - is the MAExplorer instance
geneToTest - is the gene to test
clusterDistThr - is threshold distance to set
doSortFlag -  
Returns:
the number of genes found
See Also:
Gene.setGeneDist(float), Gene.sortGeneList(Gene[], int, boolean), GeneList.copy(GeneList, GeneList), GeneGeneDist.clusterDistance(Gene, Gene), GeneList, GeneList.addGene(Gene), GeneList.copy(GeneList, GeneList)

updateGeneClustersOfCurrentGeneReport

static void updateGeneClustersOfCurrentGeneReport()
updateGeneClustersOfCurrentGeneReport() - update current gene cluster report
See Also:
Gene, MAExplorer.logDRYROTerr(java.lang.String), ShowStringPopup.updateText(java.lang.String), Util.cvf2s(float, int), Util.cvtValueToStars(float, float, int, boolean)

updateAllClustersGeneReport

static void updateAllClustersGeneReport()
updateAllClustersGeneReport() - update all filtered clusters gene report
See Also:
Gene, Gene.setGeneData(float), Gene.sortGeneList(Gene[], int, boolean), MAExplorer.logDRYROTerr(java.lang.String), ShowStringPopup.updateText(java.lang.String)

createKmeansNodesPartition

private boolean createKmeansNodesPartition(int maxKmeansNodes)
createKmeansNodesPartition() - setup primary K-means nodes partition. First find most orthogonal clusters and then assign rest of genes to these sets by picking the first gene idx (i.e. current gene) for node [0]. Then put next furthest gene idx in [1], etc. until fill up the kMeansDist[maxKmeansNodes]. The actual count is nKmeansNodes.
Parameters:
maxKmeansNodes - is the number of K means nodes to use
Returns:
true if successful.
See Also:
CompositeDatabase.setObjCoordFromMID(int, java.lang.Object), Gene, GeneGeneDist.findGeneWithLeastSumDistances(float[], int), GeneList, GeneList.clear(), GeneList.addGene(Gene), Util.showMsg2(java.lang.String), addr1D(int, int)

reassignKmeansNodes

private boolean reassignKmeansNodes()
reassignKmeansNodes() - reassign nodes based on closest to new mean clusters. The actual count is nKmeansNodes.
Returns:
true if successful.
See Also:
computeGeneToMeanClusterDistance(int, int)

calcMeanClusterVectors

private void calcMeanClusterVectors()
calcMeanClusterVectors() - compute meanClusterVector Kmeans nodes. Note: the mean vectors are saved in the global variable meanClusterVecto[maxKmeansNodes+1][nEPmsList]

calcMedianClusterVectors

private void calcMedianClusterVectors()
calcMedianClusterVectors() - compute meanClusterVector as K-median nodes. Note: the median vectors are saved in the global variable meanClusterVecto[maxKmeansNodes+1][nEPmsList]
See Also:
Statistics.calcHistStats(java.lang.String, int, float[], int)

assignGeneListToBestKmeansNodes

private void assignGeneListToBestKmeansNodes(boolean useMeanClusterVectors)
assignGeneListToBestKmeansNodes() - assign genes for all complexClusterCL genes to the best N primary Nodes clusters.
Parameters:
useMeanClusterVectors - to use mean cluster vectors else vector of current centroid gene.
See Also:
calcMeanClusterClusterDist(int, int), Gene.clearGeneProperty(int), Gene.isGeneProperty(int), Gene.setGeneProperty(int), addr1D(int, int), computeGeneToMeanClusterDistance(int, int)

sortKmeansClusterList

void sortKmeansClusterList(GeneList srcCL,
                           GeneList dstCL)
sortKmeansClusterList() - sort K-means srcCL to dstCL by Node number. Generate the cluster table in dstCL from srcCL. foreach n in Kmeans
   1. Put Kmeans node first.
   2. Sort members of Kmeans n clusters by distance to cluster centroid.
   3. Then output members of that Kmeans set.
 Generate and ordered newCL which will then be used
 to make the sorted Reports.
Note: requires that the genes in srcCL be assigned to the best K-means node.
Parameters:
srcCL - is the gene list to sort (source)
dstCL - is the resulting sorted gene list (destination)
See Also:
GeneList, GeneList.addGene(Gene), GeneList.clear(), GeneList.clearNull(), Gene.sortGeneList(Gene[], int, boolean)

withinClusterKmeansStatistics

boolean withinClusterKmeansStatistics()
withinClusterKmeansStatistics() - compute mean & StdDev within cluster stats
Returns:
true if successful.

saveKmeansClustersAsGeneSets

boolean saveKmeansClustersAsGeneSets()
saveKmeansClustersAsGeneSets() - save K-means clusters in named Gene BitSets. The named sets are "Cluster #i" where i is 1 to nKmeansNodes.
Returns:
true if succeed.
See Also:
GeneBitSet.addItem(int), GeneBitSet.clearNull(), GeneBitSet.lookupOrMakeNewGeneBitSet(java.lang.String, GeneBitSet)

reportKmeansNodes

private void reportKmeansNodes()
reportKmeansNodes() - popup expression profile report of K-means nodes
See Also:
Component.repaint(), Gene.isGeneProperty(int), ShowStringPopup, ShowStringPopup.updateText(java.lang.String), Util.cvtValueToStars(float, float, int, boolean), sortKmeansClusterList(GeneList, GeneList)

reportHierClusterTree

private void reportHierClusterTree()
reportHierClusterTree() - popup report of hierarchical clusters tree. This includes the expression profiles.
See Also:
GeneList, GeneList.addGene(Gene), GeneList.clear(), HierClustNode, HierClustNode.enumerateLeafNodes(), HierClustNode.setEnumerateNodes(), Util.showMsg(java.lang.String), Util.showMsg2(java.lang.String), ShowPlotPopup

copyCurClusterToEditedGeneList

static boolean copyCurClusterToEditedGeneList()
copyCurClusterToEditedGeneList() - set EGL to K-means curCluster genes for the most similar genes.
Returns:
true if succeed
See Also:
GeneList.addGene(Gene), GeneList.clear()

setupKmeansHPstats

boolean setupKmeansHPstats()
setupKmeansHPstats() - compute summary K-means node HP statistics for each HP sample in each Node and assign mnClustersCL to the nKmeansNodes primary nodes.
Returns:
true if successful.
See Also:
Gene, Gene.isGeneProperty(int), GeneList, GeneList.addGene(Gene)

chkIfAbort

static void chkIfAbort()
chkIfAbort() - check if abort, then shut down clustering. [TODO] buggy - needs to be put on separate thread.
See Also:
EventMenu.setClusterDisplayState(java.awt.CheckboxMenuItem, boolean), Component.repaint(), MenuBarFrame.setSTOPbuttonState(boolean, boolean), Util.showMsg3(java.lang.String)

cleanup

static void cleanup()
cleanup() - close up what needs to be closed and GC all structures. Reset to initial state so can restart it...
See Also:
MenuBarFrame.setSTOPbuttonState(boolean, boolean)