|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ClusterGenes
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/.
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 |
|
Field Detail |
private static MAExplorer mae
private static Filter fc
private static FileIO fio
private static Config cfg
static GeneGeneDist ccd
private static GeneClass gct
static boolean activeClusterMethod
static final int METHOD_SOM_CLUSTERING
static final int METHOD_CLUSTER_KMEANS
static final int METHOD_HIERARCHICAL_CLUSTERING
static final int METHOD_SIMILAR_GENES_CLUSTERING
static final int METHOD_SIMILAR_GENE_COUNTS_CLUSTERING
static final int UPDATE
static final int DEFAULT_N_SOM_NODES1
static final int DEFAULT_N_SOM_NODES2
static final int DEFAULT_N_KMEANS_NODES
static int DEF_NBR_RESAMPLE_RUNS
int method
static int prevMethod
static int maxGenesInCurCluster
static GeneList curClusterCL
static Gene curGene
static float curGeneDistThr
static GeneList complexClusterCL
int nClist
MaHybridSample[] msEPlist
int nEPmsList
private static float[] cv1Tmp
private static float[] cv2Tmp
private static float[] cv1TmpEP
private static float[] cv2TmpEP
float[][] geneEPvector
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)/2This computes LSQ euclidean distance of the gene pattern vector from another gene using the current distance metric.
static ShowStringPopup geneClustersPopup
static HierClustNode hcn
static ShowPlotPopup hierClusterGramPopup
int[][] nearestGenesIdx
static int maxGenesForKmeansClustering
static int maxNgeneClusterCnt
Gene initialSeedGene
int[] bestKmeansForGene
float maxGlobalDist
float[][] meanClusterVector
float[] kMeansDist
float[] kMeansMaxDist
float[] mnWithinClusterDist
float[] sdWithinClusterDist
int[] kMeansList
GeneList mnClustersCL
int[] hpDataNbrA
float[][] hpDataMnA
float[][] hpDataSDA
int nKmeansNodes
int maxKmeansNodes
static ShowExprProfilesPopup KmeansClustersExprProfPopup
static ShowStringPopup KmeansClustersPopup
Constructor Detail |
ClusterGenes(MAExplorer mae)
mae
- is the MAExplorer instanceClusterGenes(GeneList complexClusterCL, MaHybridSample[] msEPlist, int nEPmsList)
complexClusterCL
- is the list of genes to cluster by samplemsEPlist
- is the list of sample HP's to cluster in the expr vectornEPmsList
- is the # HP's to clusterMethod Detail |
boolean createClusterMethod(GeneList complexClusterCL, int nbrOfClusters, MaHybridSample[] msEPlist, int nEPmsList, int method, boolean resetFlag)
complexClusterCL
- is the list of genes to cluster by samplenbrOfClusters
- is the # of clusters to find for K-meansmsEPlist
- is the list of sample HP's to cluster in the expr vectornEPmsList
- is the # HP's to clustermethod
- is the clusterMETHOD_xxx to useresetFlag
- is true if reset the data structures.MenuBarFrame.setSTOPbuttonState(boolean, boolean)
,
showReducedFilteredGenesMsg(java.lang.String, java.lang.String, int)
,
updateHierarchicalClusters()
,
updateKmeansClusters()
,
updateSOMclusters()
void initData()
boolean removePreviousClusterMethod(int method)
method
- is the new method. If it is 0, then just remove
the previous method.void createSimilarGenedCluster()
void createSimilarGeneCountsClusters()
private void updateHierarchicalClusters()
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()
private void updateSOMclusters()
GeneGeneDist.calcGeneGeneDists(float[], int, int)
,
GeneGeneDist.calcNormGeneVectors(GeneList, int)
,
calcNearestGenes()
void updateKmeansClusters()
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()
void updateSimilarGenesListCounts()
private final int addr1D(int x, int y)
x' = (x>y) ? x : y, y' = (x>y) ? y : x.Return the computed 1D address for the 2D (x,y) address.
static void showReducedFilteredGenesMsg(java.lang.String optMsg2, java.lang.String optMsg3, int maxAllowed)
optMsg2
- is cluster message for msg2optMsg3
- is cluster message for msg2maxAllowed
- is # of genes that can be clustered max (if a problem)Filter.showNbrFilteredGenes()
,
StateScrollers.regenerateScrollers(boolean)
,
Util.showMsg2(java.lang.String)
,
Util.showMsg3(java.lang.String)
,
Util.sleepMsec(int)
private float calcMeanClusterClusterDist(int n, int m)
n
- is cluster nm
- is cluster mprivate float computeGeneToMeanClusterDistance(int fk, int n)
fk
- is index of genen
- is cluster nprivate void sortNearestGenes(int c)
c
- is gene numberaddr1D(int, int)
private void calcNearestGenes()
sortNearestGenes(int)
private int[] getSortedListOfNearestGenesIdx(int cIdx)
cIdx
- is gene index of getSortedListOfNearestGenesstatic void findAllGeneClusterCounts(MAExplorer maE, float clusterDistThr)
maE
- is the MAExplorer instanceclusterDistThr
- is threshold distance to setFilter.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()
static int findClustersOfGene(MAExplorer maE, Gene geneToTest, float clusterDistThr, boolean doSortFlag)
maE
- is the MAExplorer instancegeneToTest
- is the gene to testclusterDistThr
- is threshold distance to setdoSortFlag
- Gene.setGeneDist(float)
,
Gene.sortGeneList(Gene[], int, boolean)
,
GeneList.copy(GeneList, GeneList)
,
GeneGeneDist.clusterDistance(Gene, Gene)
,
GeneList
,
GeneList.addGene(Gene)
,
GeneList.copy(GeneList, GeneList)
static void updateGeneClustersOfCurrentGeneReport()
Gene
,
MAExplorer.logDRYROTerr(java.lang.String)
,
ShowStringPopup.updateText(java.lang.String)
,
Util.cvf2s(float, int)
,
Util.cvtValueToStars(float, float, int, boolean)
static void updateAllClustersGeneReport()
Gene
,
Gene.setGeneData(float)
,
Gene.sortGeneList(Gene[], int, boolean)
,
MAExplorer.logDRYROTerr(java.lang.String)
,
ShowStringPopup.updateText(java.lang.String)
private boolean createKmeansNodesPartition(int maxKmeansNodes)
maxKmeansNodes
- is the number of K means nodes to useCompositeDatabase.setObjCoordFromMID(int, java.lang.Object)
,
Gene
,
GeneGeneDist.findGeneWithLeastSumDistances(float[], int)
,
GeneList
,
GeneList.clear()
,
GeneList.addGene(Gene)
,
Util.showMsg2(java.lang.String)
,
addr1D(int, int)
private boolean reassignKmeansNodes()
computeGeneToMeanClusterDistance(int, int)
private void calcMeanClusterVectors()
private void calcMedianClusterVectors()
Statistics.calcHistStats(java.lang.String, int, float[], int)
private void assignGeneListToBestKmeansNodes(boolean useMeanClusterVectors)
useMeanClusterVectors
- to use mean cluster vectors else
vector of current centroid gene.calcMeanClusterClusterDist(int, int)
,
Gene.clearGeneProperty(int)
,
Gene.isGeneProperty(int)
,
Gene.setGeneProperty(int)
,
addr1D(int, int)
,
computeGeneToMeanClusterDistance(int, int)
void sortKmeansClusterList(GeneList srcCL, GeneList dstCL)
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.
srcCL
- is the gene list to sort (source)dstCL
- is the resulting sorted gene list (destination)GeneList
,
GeneList.addGene(Gene)
,
GeneList.clear()
,
GeneList.clearNull()
,
Gene.sortGeneList(Gene[], int, boolean)
boolean withinClusterKmeansStatistics()
boolean saveKmeansClustersAsGeneSets()
GeneBitSet.addItem(int)
,
GeneBitSet.clearNull()
,
GeneBitSet.lookupOrMakeNewGeneBitSet(java.lang.String, GeneBitSet)
private void reportKmeansNodes()
Component.repaint()
,
Gene.isGeneProperty(int)
,
ShowStringPopup
,
ShowStringPopup.updateText(java.lang.String)
,
Util.cvtValueToStars(float, float, int, boolean)
,
sortKmeansClusterList(GeneList, GeneList)
private void reportHierClusterTree()
GeneList
,
GeneList.addGene(Gene)
,
GeneList.clear()
,
HierClustNode
,
HierClustNode.enumerateLeafNodes()
,
HierClustNode.setEnumerateNodes()
,
Util.showMsg(java.lang.String)
,
Util.showMsg2(java.lang.String)
,
ShowPlotPopup
static boolean copyCurClusterToEditedGeneList()
GeneList.addGene(Gene)
,
GeneList.clear()
boolean setupKmeansHPstats()
Gene
,
Gene.isGeneProperty(int)
,
GeneList
,
GeneList.addGene(Gene)
static void chkIfAbort()
EventMenu.setClusterDisplayState(java.awt.CheckboxMenuItem, boolean)
,
Component.repaint()
,
MenuBarFrame.setSTOPbuttonState(boolean, boolean)
,
Util.showMsg3(java.lang.String)
static void cleanup()
MenuBarFrame.setSTOPbuttonState(boolean, boolean)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |