ClusterMain.h
上传用户:szb0815
上传日期:2007-06-13
资源大小:338k
文件大小:13k
- //---------------------------------------------------------------------------
- #ifndef ClusterMainH
- #define ClusterMainH
- //---------------------------------------------------------------------------
- #include <Classes.hpp>
- #include <Controls.hpp>
- #include <StdCtrls.hpp>
- #include <Forms.hpp>
- #include <Dialogs.hpp>
- #include <ComCtrls.hpp>
- #include <NMHttp.hpp>
- #include <Psock.hpp>
- #include <Registry.hpp>
- #include <ExtCtrls.hpp>
- #include <Menus.hpp>
- #include <Buttons.hpp>
- #include <Chart.hpp>
- #include <TeEngine.hpp>
- #include <TeeProcs.hpp>
- #include <Series.hpp>
- #include <TeEngine.hpp>
- #include <TeeProcs.hpp>
- #include <TeeShape.hpp>
- //---------------------------------------------------------------------------
- /*
- TNode is a simple class for keeping track of objects in binary trees
- */
- class TNode : public TObject
- {
- public:
- __fastcall TNode();
- __fastcall ~TNode();
- bool IsNode; // IsNode = true if there are children
- TNode *Parent;
- TNode *Child1;
- TNode *Child2;
- AnsiString ID; // Text identifier of node
- double Length; // Branch length
- AnsiString __fastcall Newick();
- void __fastcall SetList(TStringList *List)
- {
- if (IsNode == true)
- {
- Child1->SetList(List);
- Child2->SetList(List);
- }
- else
- {
- List->Add(ID);
- }
- }
- };
- class TMainForm : public TForm
- {
- __published: // IDE-managed Components
- TOpenDialog *LoadFileDialog;
- TStatusBar *StatusBar1;
- TNMHTTP *NMHTTP1;
- TSaveDialog *DistFileDialogBox;
- TSaveDialog *SaveDialog1;
- TPanel *Panel3;
- TGroupBox *InputGroupBox;
- TButton *LoadFileButton;
- TButton *FileHelp;
- TMainMenu *MainMenu1;
- TMenuItem *About1;
- TLabel *Label13;
- TLabel *Label14;
- TPageControl *MainTabSheet;
- TTabSheet *ClusterTabSheet;
- TPanel *ClusterPanel;
- TLabel *Label4;
- TLabel *Label12;
- TGroupBox *GeneGroupBox;
- TLabel *Label3;
- TCheckBox *CalculateGeneWeightsCheckBox;
- TCheckBox *ClusterGenesCheckBox;
- TComboBox *GeneMetricComboBox;
- TGroupBox *GeneWeightOptionsGroupBox;
- TLabel *Label5;
- TLabel *Label6;
- TEdit *GeneWeightCutoffEdit;
- TEdit *GeneWeightExpEdit;
- TGroupBox *ArrayGroupBox;
- TLabel *Label1;
- TComboBox *ArrayMetricComboBox;
- TCheckBox *ClusterArraysCheckBox;
- TCheckBox *CalculateArrayWeightsCheckBox;
- TGroupBox *ArrayWeightOptionsGroupBox;
- TLabel *Label7;
- TLabel *Label8;
- TEdit *ArrayWeightCutoffEdit;
- TEdit *ArrayWeightExpEdit;
- TButton *AverageLinkageClusterButton;
- TTabSheet *SOMTabSheet;
- TPanel *Panel1;
- TLabel *Label11;
- TGroupBox *Genes;
- TLabel *SOMGenesXDimLabel;
- TLabel *SOMGenesYDimLabel;
- TLabel *SOMGenesTauLabel;
- TLabel *SOMGenesIterationsLabel;
- TEdit *SOMGenesXDimEdit;
- TEdit *SOMGenesYDimEdit;
- TCheckBox *SOMOrganizeGenesCheckBox;
- TEdit *SOMGenesTauEdit;
- TEdit *SOMGenesIterationsEdit;
- TGroupBox *ArraySomGroupBox;
- TLabel *SOMArraysXDimLabel;
- TLabel *SOMArraysYDimLabel;
- TLabel *SOMArraysTauLabel;
- TLabel *SOMArraysIterationsLabel;
- TEdit *SOMArraysXDimEdit;
- TEdit *SOMArraysYDimEdit;
- TCheckBox *SOMOrganizeArraysCheckBox;
- TEdit *SOMArraysTauEdit;
- TEdit *SOMArraysIterationsEdit;
- TButton *MakeSOMButton;
- TTabSheet *FilterTabSheet;
- TGroupBox *FilterDataGroupBox;
- TLabel *Label2;
- TLabel *FilterResultsLabel;
- TButton *Filter;
- TEdit *FilterPercentEdit;
- TCheckBox *FilterPercentCheckBox;
- TCheckBox *FilterSDCheckBox;
- TCheckBox *FilterAbsValCheckBox;
- TCheckBox *FilterMaxMinCheckBox;
- TEdit *FilterSDEdit;
- TEdit *FilterAbsValCountEdit;
- TEdit *FilterMaxMinEdit;
- TEdit *FilterAbsValEdit;
- TButton *AcceptFilterButton;
- TPanel *Panel4;
- TLabel *Label9;
- TLabel *Label10;
- TLabel *RowLabel;
- TLabel *ColumnLabel;
- TLabel *Label15;
- TLabel *Label16;
- TEdit *JobNameEdit;
- TLabel *Label17;
- TMemo *FileNameMemo;
- TTabSheet *AdjustTabSheet;
- TTabSheet *SVDTabSheet;
- TButton *AdjustDataButton;
- TPanel *Panel5;
- TLabel *Label19;
- TCheckBox *MeanCenterGenesCheckBox;
- TCheckBox *MeanCenterArraysCheckBox;
- TPanel *Panel6;
- TCheckBox *MedianCenterArraysCheckBox;
- TCheckBox *MedianCenterGenesCheckBox;
- TLabel *Label18;
- TPanel *Panel7;
- TLabel *Label20;
- TCheckBox *NormalizeArraysCheckBox;
- TCheckBox *NormalizeGenesCheckBox;
- TPanel *Panel8;
- TCheckBox *LogTransformCheckBox;
- TGroupBox *GroupBox1;
- TMemo *Memo2;
- TButton *DoSVDButton;
- TMemo *Memo3;
- TMemo *Memo4;
- TLabel *FractalLabel;
- TButton *CompleteLinkageClusterButton;
- TButton *SingleLinkageClusterButton;
- TButton *ReorderType1Button;
- TButton *SaveButton;
- TTabSheet *KMeansTabSheet;
- TGroupBox *KMeansGroupBox;
- TGroupBox *GroupBox2;
- TGroupBox *GroupBox3;
- TCheckBox *KOrganizeGenesCheckBox;
- TCheckBox *KOrganizeArraysCheckBox;
- TEdit *GenesKEdit;
- TEdit *ArraysKEdit;
- TLabel *Label21;
- TLabel *Label22;
- TEdit *GMaxKCyclesEdit;
- TLabel *Label23;
- TEdit *AMaxKCyclesEdit;
- TLabel *Label24;
- TRadioGroup *GKMethod;
- TRadioGroup *AKMethod;
- TButton *KExecute;
- TSaveDialog *SaveDataDialog;
- TButton *ManualButton;
- void __fastcall LoadFileButtonClick(TObject *Sender);
- void __fastcall AverageLinkageClusterButtonClick(TObject *Sender);
- void __fastcall FileHelpClick(TObject *Sender);
- void __fastcall AboutButtonClick(TObject *Sender);
- void __fastcall CalculateGeneWeightsCheckBoxClick(TObject *Sender);
- void __fastcall GeneWeightCutoffEditExit(TObject *Sender);
- void __fastcall GeneWeightExpEditExit(TObject *Sender);
- void __fastcall CalculateArrayWeightsCheckBoxClick(TObject *Sender);
- void __fastcall ArrayWeightExpEditExit(TObject *Sender);
- void __fastcall ArrayWeightCutoffEditExit(TObject *Sender);
- void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
- void __fastcall ReorderType1ButtonClick(TObject *Sender);
- void __fastcall FormDragDrop(TObject *Sender, TObject *Source,
- int X, int Y);
- void __fastcall FormDragOver(TObject *Sender, TObject *Source,
- int X, int Y, TDragState State, bool &Accept);
- void __fastcall AppMessage(tagMSG &Msg, bool &Handled);
- void __fastcall LoadFile(AnsiString FileName);
- void __fastcall FormDestroy(TObject *Sender);
- void __fastcall FilterClick(TObject *Sender);
- void __fastcall SOMOrganizeGenesCheckBoxClick(TObject *Sender);
- void __fastcall SOMOrganizeArraysCheckBoxClick(TObject *Sender);
- void __fastcall About1Click(TObject *Sender);
- void __fastcall FilterPercentEditExit(TObject *Sender);
- void __fastcall FilterSDEditExit(TObject *Sender);
- void __fastcall FilterAbsValCountEditExit(TObject *Sender);
- void __fastcall FilterAbsValEditExit(TObject *Sender);
- void __fastcall FilterMaxMinEditExit(TObject *Sender);
- void __fastcall AcceptFilterButtonClick(TObject *Sender);
- void __fastcall SOMGenesXDimEditExit(TObject *Sender);
- void __fastcall SOMGenesYDimEditExit(TObject *Sender);
- void __fastcall SOMGenesTauEditExit(TObject *Sender);
- void __fastcall SOMGenesIterationsEditExit(TObject *Sender);
- void __fastcall SOMArraysXDimEditExit(TObject *Sender);
- void __fastcall SOMArraysYDimEditExit(TObject *Sender);
- void __fastcall SOMArraysTauEditExit(TObject *Sender);
- void __fastcall SOMArraysIterationsEditExit(TObject *Sender);
- void __fastcall MakeSOMButtonClick(TObject *Sender);
- void __fastcall AdjustDataButtonClick(TObject *Sender);
- void __fastcall DoSVDButtonClick(TObject *Sender);
- void __fastcall CompleteLinkageClusterButtonClick(TObject *Sender);
- void __fastcall SingleLinkageClusterButtonClick(TObject *Sender);
- void __fastcall KExecuteClick(TObject *Sender);
- void __fastcall SaveButtonClick(TObject *Sender);
- void __fastcall GenesKEditExit(TObject *Sender);
- void __fastcall ArraysKEditExit(TObject *Sender);
- void __fastcall GMaxKCyclesEditExit(TObject *Sender);
- void __fastcall AMaxKCyclesEditExit(TObject *Sender);
- void __fastcall ManualButtonClick(TObject *Sender);
- private: // User declarations
- int FRows;
- int FColumns;
- protected:
- __fastcall void SetRows(int NewRows)
- {
- FRows = NewRows;
- RowLabel->Caption = NewRows;
- }
- __fastcall void SetColumns(int NewColumns)
- {
- FColumns = NewColumns;
- ColumnLabel->Caption = NewColumns;
- }
- public: // User declarations
- __fastcall TMainForm(TComponent* Owner);
- AnsiString NextString(AnsiString *InString);
- unsigned short Correlation(double **Data, bool **Mask, double *Weight,
- bool Centered, bool Absolute, int elem1, int elem2, int ClusterColumns);
- float Correlation(double **Data, bool **Mask, double *Weight,
- int elem1, int elem2, int ClusterColumns);
- unsigned short Distance(double **Data, bool **Mask, double *Weight,
bool Centered, bool Absolute, int elem1, int elem2, int ClusterColumns);
unsigned short Distance(int Metric, double **Data, bool **Mask, double *Weight,
int elem1, int elem2, int DataColumns);
void Cluster(double **ClusterData, bool **ClusterMask,
int ClusterRows, int ClusterColumns,
- TStringList *TreeFile, double *Order, double *RowWeight, double *ColumnWeight,
- AnsiString *ID, int DistFunction,
- bool CalculateWeights, double WeightCutoff, double WeightPower,
- TStringList *ClusterOrder, TStatusBar *StatusBar,
bool ReturnTNode, TNode *TopNode);
-
void CompactCluster(double **ClusterData, bool **ClusterMask,
int ClusterRows, int ClusterColumns,
- TStringList *TreeFile, double *Order, double *RowWeight, double *ColumnWeight,
- AnsiString *ID, int DistFunction,
- bool CalculateWeights, double WeightCutoff, double WeightPower,
- TStringList *ClusterOrder, TStatusBar *StatusBar,
bool ReturnTNode, TNode *TopNode);
-
void SingleCluster(double **ClusterData, bool **ClusterMask,
int ClusterRows, int ClusterColumns,
- TStringList *TreeFile, double *Order, double *RowWeight, double *ColumnWeight,
- AnsiString *ID, int DistFunction,
- bool CalculateWeights, double WeightCutoff, double WeightPower,
- TStringList *ClusterOrder, TStatusBar *StatusBar,
bool ReturnTNode, TNode *TopNode);
-
double*** __fastcall SOM(int X, int Y, double **SOMData, bool **SOMMask,
int SOMRows, int SOMColumns, int SOMIterations);
-
double Correlation(double ***Nodes, double **SOMData, bool **SOMMask,
bool Centered, int j, int k, int n, int SOMColumns);
-
void SaveDistMatrix(double **ClusterData, bool **ClusterMask, double *ClusterWeight,
int ClusterRows, int ClusterColumns, AnsiString FileName);
void CompDistMatrix(double **ClusterData, bool **ClusterMask, double *ClusterWeight,
int ClusterRows, int ClusterColumns, int NumBins, int NumIterations);
-
int * __fastcall DoKMeans(int K, double **KData, bool **KMask,
int KRows, int KColumns, int KMaxIterations, int Method);
-
void __fastcall SaveData(AnsiString FileName);
-
void __fastcall MakeSOM();
void __fastcall MakeSVD();
-
double **GeneData;
- bool **GeneMask;
- AnsiString *UniqID;
AnsiString *GeneName;
//int Rows, Columns;
double *GeneWeight;
double *GeneOrder;
double *ArrayWeight;
double *ArrayOrder;
char ClusterName[256];
AnsiString JobName;
TStringList *Headers;
bool *IsData;
int *InColumn;
AnsiString UniqueID;
double GeneWeightExp, GeneWeightCutoff;
- double ArrayWeightExp, ArrayWeightCutoff;
double FilterPercentVal;
double FilterSDVal;
int FilterAbsValCount;
double FilterAbsValVal;
double FilterMaxMinVal;
bool *Use;
-
int UseRows;
int SOMGenesXDim, SOMGenesYDim;
int SOMArraysXDim, SOMArraysYDim;
double SOMGenesTau, SOMArraysTau;
int SOMGenesIterations, SOMArraysIterations;
int GenesK, ArraysK, GMaxKCycles, AMaxKCycles;
__property int Rows = {read=FRows, write=SetRows};
__property int Columns = {read=FColumns, write=SetColumns};
};
- //---------------------------------------------------------------------------
- extern PACKAGE TMainForm *MainForm;
- //---------------------------------------------------------------------------
- #endif