public Aglomerative(HierarchicalCInput obj, ClusterAlgorithm alg, INPUTMODE mode, bool flag, List <string> profiles) { InitializeComponent(); Settings set = new Settings(); set.Load(); switch (set.mode) { case INPUTMODE.RNA: distanceControl1.HideAtoms = true; break; case INPUTMODE.USER_DEFINED: distanceControl1.HideRmsdLike = true; break; } foreach (var item in Enum.GetValues(typeof(AglomerativeType))) { comboBox1.Items.Add(Enum.GetName(typeof(AglomerativeType), item)); } if (obj != null) { comboBox1.SelectedItem = Enum.GetName(typeof(AglomerativeType), obj.linkageType); distanceControl1.reference = obj.reference1DjuryH; distanceControl1.referenceProfile = obj.jury1DProfileH; distanceControl1.distDef = obj.distance; distanceControl1.CAtoms = obj.atoms; distanceControl1.profileName = obj.hammingProfile; } }
public void RunCluster(ClusterAlgorithm algorithm, int parameter1, int parameter2) { switch (algorithm) { //case ClusterAlgorithm.DBSCAN: // const double eps = 20; // Clusters = dbscan.Solve(Nodes, eps, 2, costByReference); // break; //case ClusterAlgorithm.KMEAN: // Clusters = kmean.Solve(Nodes, 10, Diverse.DistanceSquared); // break; //case ClusterAlgorithm.KMEDOID: // Clusters = kmedoid.Solve(Nodes, 10, costByReference, costAnalyzer); // break; //case ClusterAlgorithm.DIRK: // Clusters = testje.Algorithm(Nodes, costByReference); // break; //case ClusterAlgorithm.DIRK2: // Clusters = oneDirectioning.Solve(Nodes, costAnalyzer, new ObjectToIndexMapper<TNode>(Nodes), parametervalue); // break; case ClusterAlgorithm.DIRK3: Clusters = dirk3.Solve(Nodes, costAnalyzer, parameter1, parameter2); break; } cluster_AfterIterationEvent(this, EventArgs.Empty); }
private void SetOptions() { localOpt = new HierarchicalCInput(); localOpt.linkageType = (AglomerativeType)Enum.Parse(typeof(AglomerativeType), comboBox1.SelectedItem.ToString()); alg = ClusterAlgorithm.HierarchicalCluster; if (distanceControl1.distDef == DistanceMeasures.RMSD || distanceControl1.distDef == DistanceMeasures.MAXSUB || distanceControl1.distDef == DistanceMeasures.GDT_TS) { localOpt.reference1DjuryH = false; } else { string hammingProfile = distanceControl1.profileName; localOpt.hammingProfile = hammingProfile; localOpt.reference1DjuryAglom = distanceControl1.reference; localOpt.jury1DProfileAglom = hammingProfile.Replace("_distance", ""); if (!localOpt.jury1DProfileAglom.Contains(".profiles")) { localOpt.jury1DProfileAglom = localOpt.jury1DProfileAglom.Replace(".profile", ".profiles"); } } localOpt.distance = distanceControl1.distDef; localOpt.atoms = distanceControl1.CAtoms; }
private void SetOptions() { localOpt = new Options(); HashCInput hash = new HashCInput(); localOpt.hierarchical.linkageType = (AglomerativeType)Enum.Parse(typeof(AglomerativeType), comboBox1.SelectedItem.ToString()); if (radioButton6.Checked) { alg = ClusterAlgorithm.HTree; } else { alg = ClusterAlgorithm.uQlustTree; } if (distanceControl1.distDef == DistanceMeasures.RMSD || distanceControl1.distDef == DistanceMeasures.MAXSUB || distanceControl1.distDef == DistanceMeasures.GDT_TS) { localOpt.hierarchical.reference1DjuryH = false; } else { string hammingProfile = jury1DSetup1.profileName; hammingProfile = hammingProfile.Replace(".profiles", "_distance.profile"); localOpt.hierarchical.hammingProfile = hammingProfile; localOpt.hierarchical.reference1DjuryH = true; localOpt.hierarchical.jury1DProfileH = jury1DSetup1.profileName; } localOpt.hierarchical.distance = distanceControl1.distDef; localOpt.hierarchical.atoms = distanceControl1.CAtoms; localOpt.hierarchical.consensusProfile = jury1DSetup1.profileName; localOpt.hierarchical.uHTree = radioButton6.Checked; if (radioButton1.Checked) { localOpt.hash.jury = true; } else { localOpt.hash.jury = false; } hash.perData = (int)percentData.Value; hash.relClusters = (int)relevantC.Value; hash.profileName = jury1DSetup1.profileName; if (radioButton3.Checked) { hash.combine = true; hash.fcolumns = false; } else { hash.combine = false; hash.fcolumns = true; } hash.selectionMethod = COL_SELECTION.ENTROPY; localOpt.hash = hash; }
public uQlustTreeAdvanced(Options obj, ClusterAlgorithm alg, INPUTMODE mode, bool flag, List <string> profiles) { InitializeComponent(); if (profiles != null) { button3.Visible = true; profileFile = profiles[0]; } else { button3.Visible = false; } Settings set = new Settings(); set.Load(); switch (set.mode) { case INPUTMODE.RNA: distanceControl1.HideAtoms = true; break; case INPUTMODE.USER_DEFINED: distanceControl1.HideRmsdLike = true; break; } foreach (var item in Enum.GetValues(typeof(AglomerativeType))) { comboBox1.Items.Add(Enum.GetName(typeof(AglomerativeType), item)); } if (obj != null) { comboBox1.SelectedItem = Enum.GetName(typeof(AglomerativeType), obj.hierarchical.linkageType); relevantC.Value = obj.hash.relClusters; percentData.Value = obj.hash.perData; distanceControl1.reference = obj.hierarchical.reference1DjuryH; distanceControl1.referenceProfile = obj.hash.profileName; distanceControl1.distDef = obj.hierarchical.distance; distanceControl1.CAtoms = obj.hierarchical.atoms; distanceControl1.profileName = obj.hierarchical.hammingProfile; jury1DSetup1.profileName = obj.hash.profileName; if (obj.hash.jury) { radioButton1.Checked = true; radioButton2.Checked = false; } else { radioButton1.Checked = false; radioButton2.Checked = true; } } }
DoDataExchange ( Boolean bFromControls ) { if (bFromControls) { ClusterAlgorithm eClusterAlgorithm = ClusterAlgorithm.ClausetNewmanMoore; if (radWakitaTsurumi.Checked) { eClusterAlgorithm = ClusterAlgorithm.WakitaTsurumi; } else if (radGirvanNewman.Checked) { eClusterAlgorithm = ClusterAlgorithm.GirvanNewman; } m_oClusterUserSettings.ClusterAlgorithm = eClusterAlgorithm; m_oClusterUserSettings.PutNeighborlessVerticesInOneCluster = chkPutNeighborlessVerticesInOneCluster.Checked; } else { switch (m_oClusterUserSettings.ClusterAlgorithm) { case ClusterAlgorithm.ClausetNewmanMoore: radClausetNewmanMoore.Checked = true; break; case ClusterAlgorithm.WakitaTsurumi: radWakitaTsurumi.Checked = true; break; case ClusterAlgorithm.GirvanNewman: radGirvanNewman.Checked = true; break; default: Debug.Assert(false); break; } chkPutNeighborlessVerticesInOneCluster.Checked = m_oClusterUserSettings.PutNeighborlessVerticesInOneCluster; } return(true); }
private Structuring RunMethod(ClusterAlgorithm aClusterAlgorithm) { try { aClusterAlgorithm.IContainerProgressBar = IContainerProgressBar; //return aClusterAlgorithm.BuildStructuring(); return(aClusterAlgorithm.BuildStructuringWithTime()); } catch (Exception _ex) { GeneralTools.Tools.WriteToLog(_ex); return(null); } }
string MakeName(object processParams, ClusterAlgorithm alg, int counter) { string currentProcessName = ""; if (((ThreadParam)processParams).name != null && ((ThreadParam)processParams).name.Length > 0) { currentProcessName = ((ThreadParam)processParams).name + "_" + counter; } else { currentProcessName = alg.ToString() + "_" + counter; } return(currentProcessName); }
/// <summary> /// /// </summary> /// <param name="aparameter">Nombre de la clase a instanciar, esta clase debe heredar de ClusterAlgorithm</param> /// <param name="aresult"></param> /// <returns></returns> public bool TryConvert(string aparameter, out object aresult) { ClusterAlgorithm _temp = ReflectionTools.GetInstance <ClusterAlgorithm>("ClusterEnsemble.Clusters." + aparameter); if (_temp != null) { aresult = _temp; return(true); } else { aresult = null; return(false); } }
private void SetOptions() { if (jury1d.Checked) alg = ClusterAlgorithm.Jury1D; else if (jury3d.Checked) alg = ClusterAlgorithm.Jury3D; else alg = ClusterAlgorithm.Sift; localObj.oDistance = distanceControl1.distDef; localObj.oAtoms = distanceControl1.CAtoms; localObj.hammingProfile = distanceControl1.profileName; localObj.juryProfile = jury1DSetup1.profileName; localObj.reference1Djury = distanceControl1.reference; localObj.referenceProfile=distanceControl1.referenceProfile; }
private void bt_Run_Click(object sender, RoutedEventArgs e) { try { if (HasSelectedAlgorithm) { string _Error = ""; if (!Enviroment.CanRunAlgorithm(out _Error, AlgorithmType.Clustering)) { MessageBox.Show(_Error, "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } ReflectionTools _rct = new ReflectionTools(); ClusterAlgorithm _ClusterAlg = ReflectionTools.GetInstance <ClusterAlgorithm>(Tree.Value.FullName); foreach (CEDS.Property _p in Tree.Value.InProperties) { _rct.SetProperty(Tree.Value.FullName, _ClusterAlg, _p); } if (!VisualUtils.SetGlobalInProperties(_rct, _ClusterAlg, Tree, out _Error, this.chbx_AttrRnd.IsChecked.Value)) { MessageBox.Show(_Error, "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } Run _run = RunMethod; _run.BeginInvoke(_ClusterAlg, RunFinish, new DataThread() { Run = _run, ClusterAlgorithm = _ClusterAlg }); } else { MessageBox.Show("You must first select a Clustering algorithm.", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } } catch (Exception _ex) { GeneralTools.Tools.WriteToLog(_ex); } }
private void UpdateProximities(Tree aTree) { try { if (!aTree.Value.IsAbstract) { List <Proximity> _dissTemp = (CurrentProximities != null) ? CurrentProximities : new List <Proximity>(); ClusterAlgorithm _ClusterAlgorithm = ReflectionTools.GetInstance <ClusterAlgorithm>(aTree.Value.FullName); List <Proximity> _source = new List <Proximity>(); foreach (Proximity _prox in _dissTemp) { if (_ClusterAlgorithm.ProximityType == ProximityType.Both || VerifyProximity(_ClusterAlgorithm.ProximityType, _prox)) { _source.Add(_prox); } } this.cb_Proximities.ItemsSource = null; this.cb_Proximities.ItemsSource = _source; this.cb_Proximities.DisplayMemberPath = "Name"; if (_source.Count > 0) { this.cb_Proximities.SelectedIndex = 0; } else { Enviroment.Proximity = null; } this.cb_Proximities.IsEnabled = _ClusterAlgorithm.ProximityType != ProximityType.None; } } catch (Exception _ex) { GeneralTools.Tools.WriteToLog(_ex); } }
private void RunFinish(Structuring aStructuring, ClusterAlgorithm aClusterAlgorithm) { try { ClusterAlgorithm _ClusterAlg = aClusterAlgorithm; Structuring _structuring = aStructuring; if (_structuring != null) { TimeSpan ts = _ClusterAlg.Time; string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10); PartitionInfo _partinfo = new PartitionInfo() { AlgorithmName = this.tb_SelectClusterAlg.Text, ClusterAlgorithm = _ClusterAlg, Partition = _structuring, AlgorithmType = AlgorithmType.Clustering, Time = elapsedTime, Index = -1 }; this.uctrl_ListClusterAlgVisualizer.AddPartitionInfo(_partinfo); this.tb_output.Text = _ClusterAlg.Output; if (NewStructuringEventHandler != null) { NewStructuringEventHandler(this, new NewStructuringEventArgs(_partinfo)); } //Experimental Mode this.ExperimentalMode = false; } } catch (Exception _ex) { GeneralTools.Tools.WriteToLog(_ex); } }
public DistanceMeasures GetDistanceMeasure(ClusterAlgorithm clAlgorithm) { switch (clAlgorithm) { case ClusterAlgorithm.FastHCluster: case ClusterAlgorithm.HierarchicalCluster: case ClusterAlgorithm.HKmeans: return(hierarchical.distance); case ClusterAlgorithm.Kmeans: return(kmeans.kDistance); case ClusterAlgorithm.Jury3D: return(other.oDistance); case ClusterAlgorithm.BakerCluster: return(threshold.hDistance); default: return(DistanceMeasures.NONE); } }
private void SetOptions() { if (jury1d.Checked) { alg = ClusterAlgorithm.Jury1D; } else if (jury3d.Checked) { alg = ClusterAlgorithm.Jury3D; } else { alg = ClusterAlgorithm.Sift; } localObj.oDistance = distanceControl1.distDef; localObj.oAtoms = distanceControl1.CAtoms; localObj.hammingProfile = distanceControl1.profileName; localObj.juryProfile = jury1DSetup1.profileName; localObj.reference1Djury = distanceControl1.reference; localObj.referenceProfile = distanceControl1.referenceProfile; }
//************************************************************************* // Method: CalculateClusters() // /// <summary> /// Partitions the graph into clusters. /// </summary> /// /// <param name="clusterAlgorithm"> /// The cluster algorithm to use. /// </param> /// /// <returns> /// true if the graph was successfully partitioned into clusters. /// </returns> //************************************************************************* public Boolean CalculateClusters( ClusterAlgorithm clusterAlgorithm ) { AssertValid(); ClusterCalculator2 oClusterCalculator2 = new ClusterCalculator2(); oClusterCalculator2.Algorithm = clusterAlgorithm; return ( CalculateGroups(oClusterCalculator2, "Finding Clusters") ); }
string MakeName(object processParams,ClusterAlgorithm alg,int counter) { string currentProcessName = ""; if (((ThreadParam)processParams).name != null && ((ThreadParam)processParams).name.Length > 0) currentProcessName = ((ThreadParam)processParams).name + "_" + counter; else currentProcessName = alg.ToString() + "_" + counter; return currentProcessName; }
public RankingCForm(RankingCInput obj,ClusterAlgorithm alg,bool flag,INPUTMODE inputMode,List<string> profFiles=null) { this.alg = alg; this.inputMode = inputMode; InitializeComponent(); if (profFiles != null) { profileFile = profFiles[0]; button3.Visible = true; } else button3.Visible = false; Settings set = new Settings(); set.Load(); if (set.mode == INPUTMODE.RNA) distanceControl1.HideAtoms = true; if (flag) { distanceControl1.FreezDist(); sift.Enabled = false; if (sift.Checked) { jury1d.Checked = true; } } switch(alg) { case ClusterAlgorithm.Jury1D: jury1d.Checked = true; jury3d.Checked = false; sift.Checked = false; break; case ClusterAlgorithm.Jury3D: jury1d.Checked = false; jury3d.Checked = true; sift.Checked = false; break; case ClusterAlgorithm.Sift: jury1d.Checked = false; jury3d.Checked = false; sift.Checked = true; break; default: jury1d.Checked = true; jury3d.Checked = false; sift.Checked = false; break; } if (obj != null) { distanceControl1.distDef = obj.oDistance; distanceControl1.CAtoms = obj.oAtoms; distanceControl1.profileName = obj.hammingProfile; jury1DSetup1.profileName = obj.juryProfile; distanceControl1.referenceProfile = obj.referenceProfile; distanceControl1.reference = obj.reference1Djury; } if(jury1d.Checked) distanceControl1.Enabled = false; }
private void SetOptions() { userHash1.UpdateMode(); localOpt = new HierarchicalCInput(); localOpt.linkageType = (AglomerativeType) Enum.Parse(typeof(AglomerativeType), comboBox1.SelectedItem.ToString()); localOpt.numInitNodes = Convert.ToInt32(numericBox1.Text); localOpt.indexDB = (float)DBIndex.Value; localOpt.numberOfStruct = (int)threshold.Value; localOpt.repeatTime = (int)maxRepeat.Value; localOpt.maxK = (int)maxK.Value; if (AglomRadio.Checked) { alg = ClusterAlgorithm.HierarchicalCluster; localOpt.reference1DjuryAglom = distanceControl1.reference; localOpt.jury1DProfileAglom= distanceControl1.referenceProfile; } else if (FastHClusterRadio.Checked) { alg = ClusterAlgorithm.FastHCluster; localOpt.reference1DjuryFast = distanceControl1.reference; localOpt.consensusProfile = distanceControl1.referenceProfile; if (distanceControl1.reference) { localOpt.jury1DProfileFast = distanceControl1.referenceProfile; } } else if (KmeansRadio.Checked) { alg = ClusterAlgorithm.HKmeans; localOpt.reference1DjuryKmeans = distanceControl1.reference; localOpt.jury1DProfileKmeans = distanceControl1.referenceProfile; } else { alg = ClusterAlgorithm.uQlustTree; localOpt.reference1DjuryH = distanceControl1.reference; localOpt.jury1DProfileH = distanceControl1.referenceProfile; } localOpt.distance = distanceControl1.distDef; localOpt.atoms = distanceControl1.CAtoms; localOpt.hammingProfile = distanceControl1.profileName; //localOpt.usedJuryForRef = distanceControl1.reference; localOpt.consensusProfile = jury1DSetup3.profileName; localOpt.ItMeans = checkBox2.Checked; if (radioButton1.Checked) localOpt.HConsensus = false; else localOpt.HConsensus = true ; localOpt.ItNum = (int)numericUpDown1.Value; localOpt.hash = userHash1.GetHash(); }
public HierarchicalCForm(HierarchicalCInput obj,ClusterAlgorithm alg,INPUTMODE mode,bool flag,List<string> profiles) { this.alg = alg; objCopy = obj; this.mode = mode; InitializeComponent(); if (profiles != null) { button3.Visible = true; profileFile = profiles[0]; } else button3.Visible = false; userHash1.regularizationOff(); SizeHeight = this.Size.Height; distanceControl1.refChanged = ReferanceCheckChanged; //distanceControl1.FreezeCAtoms(); Settings set = new Settings(); set.Load(); if (set.mode == INPUTMODE.RNA) distanceControl1.HideAtoms = true; foreach (var item in Enum.GetValues(typeof(AglomerativeType))) comboBox1.Items.Add(Enum.GetName(typeof(AglomerativeType),item)); if (obj != null) { comboBox1.SelectedItem=Enum.GetName(typeof(AglomerativeType),obj.linkageType); numericBox1.Text = obj.numInitNodes.ToString(); DBIndex.Value = (decimal)obj.indexDB; threshold.Value = (decimal)obj.numberOfStruct; maxRepeat.Value = (decimal)obj.repeatTime; maxK.Value = (decimal)obj.maxK; switch (alg) { case ClusterAlgorithm.FastHCluster: AglomRadio.Checked = false; FastHClusterRadio.Checked = true; KmeansRadio.Checked = false; userHash1.Visible = false; radioButton3.Checked = false; groupBox1.Visible = true; if (radioButton1.Checked) if (distanceControl1.reference) jury1DSetup3.Visible = false; else jury1DSetup3.Visible = true; this.Size = new Size(this.Size.Width, SizeHeight / 2 + SizeHeight / 4); distanceControl1.reference = obj.reference1DjuryFast; distanceControl1.referenceProfile = obj.consensusProfile; userHash1.profRefFile = obj.jury1DProfileFast; break; case ClusterAlgorithm.HKmeans: AglomRadio.Checked = false; FastHClusterRadio.Checked = false; KmeansRadio.Checked = true; groupBox1.Visible = false; radioButton3.Checked = false; userHash1.Visible = false; this.Size = new Size(this.Size.Width, SizeHeight / 2 + SizeHeight/3); distanceControl1.reference = obj.reference1DjuryKmeans; distanceControl1.referenceProfile = obj.jury1DProfileKmeans; break; case ClusterAlgorithm.uQlustTree: userHash1.Visible = true; AglomRadio.Checked = false; FastHClusterRadio.Checked = false; KmeansRadio.Checked = false; groupBox1.Visible = false; radioButton3.Checked = true; this.Size = new Size(this.Size.Width, SizeHeight); distanceControl1.reference = obj.reference1DjuryH; distanceControl1.referenceProfile = obj.jury1DProfileH; break; default://Aglomerative AglomRadio.Checked = true; FastHClusterRadio.Checked = false; KmeansRadio.Checked = false; groupBox1.Visible = false; userHash1.Visible = false; radioButton3.Checked = false; distanceControl1.reference = obj.reference1DjuryAglom; distanceControl1.referenceProfile = obj.jury1DProfileAglom; break; } distanceControl1.distDef = obj.distance; distanceControl1.CAtoms = obj.atoms; distanceControl1.profileName = obj.hammingProfile; jury1DSetup3.profileName = obj.consensusProfile; checkBox2.Checked = obj.ItMeans; numericUpDown1.Value = obj.ItNum; if (obj.HConsensus) { radioButton1.Checked = false; radioButton2.Checked = true; } else { radioButton1.Checked = true; radioButton2.Checked = false; } if (flag) { distanceControl1.FreezDist(); // distanceControl1.distDef = DistanceMeasures.HAMMING; } // distanceControl1.CAtoms = PDB.PDBMODE.ONLY_CA; userHash1.SetHash(obj.hash); } }
private void SetOptions() { userHash1.UpdateMode(); localOpt.hierarchical = new HierarchicalCInput(); localOpt.hierarchical.linkageType = (AglomerativeType)Enum.Parse(typeof(AglomerativeType), comboBox1.SelectedItem.ToString()); localOpt.hierarchical.numInitNodes = Convert.ToInt32(numericBox1.Text); localOpt.hierarchical.indexDB = (float)DBIndex.Value; localOpt.hierarchical.numberOfStruct = (int)threshold.Value; localOpt.hierarchical.repeatTime = (int)maxRepeat.Value; localOpt.hierarchical.maxK = (int)maxK.Value; if (AglomRadio.Checked) { alg = ClusterAlgorithm.HierarchicalCluster; localOpt.hierarchical.reference1DjuryAglom = distanceControl1.reference; localOpt.hierarchical.jury1DProfileAglom = distanceControl1.referenceProfile; } else if (FastHClusterRadio.Checked) { alg = ClusterAlgorithm.FastHCluster; localOpt.hierarchical.reference1DjuryFast = distanceControl1.reference; localOpt.hierarchical.consensusProfile = distanceControl1.referenceProfile; if (distanceControl1.reference) { localOpt.hierarchical.jury1DProfileFast = distanceControl1.referenceProfile; } } else if (KmeansRadio.Checked) { alg = ClusterAlgorithm.HKmeans; localOpt.hierarchical.reference1DjuryKmeans = distanceControl1.reference; localOpt.hierarchical.jury1DProfileKmeans = distanceControl1.referenceProfile; } else if (radioHTree.Checked) { alg = ClusterAlgorithm.HTree; } else { alg = ClusterAlgorithm.uQlustTree; localOpt.hierarchical.reference1DjuryH = distanceControl1.reference; localOpt.hierarchical.jury1DProfileH = distanceControl1.referenceProfile; } localOpt.hierarchical.distance = distanceControl1.distDef; localOpt.hierarchical.atoms = distanceControl1.CAtoms; localOpt.hierarchical.hammingProfile = distanceControl1.profileName; //localOpt.usedJuryForRef = distanceControl1.reference; localOpt.hierarchical.consensusProfile = jury1DSetup3.profileName; localOpt.hierarchical.ItMeans = checkBox2.Checked; if (radioButton1.Checked) { localOpt.hierarchical.HConsensus = false; } else { localOpt.hierarchical.HConsensus = true; } localOpt.hierarchical.ItNum = (int)numericUpDown1.Value; localOpt.hash = userHash1.GetHash(); }
public HierarchicalCForm(Options opt, ClusterAlgorithm alg, INPUTMODE mode, bool flag, List <string> profiles) { HierarchicalCInput obj = opt.hierarchical; this.alg = alg; objCopy = obj; this.mode = mode; InitializeComponent(); if (profiles != null) { button3.Visible = true; profileFile = profiles[0]; } else { button3.Visible = false; } userHash1.regularizationOff(); SizeHeight = this.Size.Height; distanceControl1.refChanged = ReferanceCheckChanged; //distanceControl1.FreezeCAtoms(); Settings set = new Settings(); set.Load(); if (set.mode == INPUTMODE.RNA) { distanceControl1.HideAtoms = true; } foreach (var item in Enum.GetValues(typeof(AglomerativeType))) { comboBox1.Items.Add(Enum.GetName(typeof(AglomerativeType), item)); } if (obj != null) { comboBox1.SelectedItem = Enum.GetName(typeof(AglomerativeType), obj.linkageType); numericBox1.Text = obj.numInitNodes.ToString(); DBIndex.Value = (decimal)obj.indexDB; threshold.Value = (decimal)obj.numberOfStruct; maxRepeat.Value = (decimal)obj.repeatTime; maxK.Value = (decimal)obj.maxK; switch (alg) { case ClusterAlgorithm.FastHCluster: AglomRadio.Checked = false; FastHClusterRadio.Checked = true; KmeansRadio.Checked = false; userHash1.Visible = false; radioButton3.Checked = false; groupBox1.Visible = true; if (radioButton1.Checked) { if (distanceControl1.reference) { jury1DSetup3.Visible = false; } else { jury1DSetup3.Visible = true; } } this.Size = new Size(this.Size.Width, SizeHeight / 2 + SizeHeight / 4); distanceControl1.reference = obj.reference1DjuryFast; distanceControl1.referenceProfile = obj.consensusProfile; userHash1.profRefFile = obj.jury1DProfileFast; break; case ClusterAlgorithm.HKmeans: AglomRadio.Checked = false; FastHClusterRadio.Checked = false; KmeansRadio.Checked = true; groupBox1.Visible = false; radioButton3.Checked = false; userHash1.Visible = false; this.Size = new Size(this.Size.Width, SizeHeight / 2 + SizeHeight / 3); distanceControl1.reference = obj.reference1DjuryKmeans; distanceControl1.referenceProfile = obj.jury1DProfileKmeans; break; case ClusterAlgorithm.uQlustTree: userHash1.Visible = true; AglomRadio.Checked = false; FastHClusterRadio.Checked = false; KmeansRadio.Checked = false; groupBox1.Visible = false; radioButton3.Checked = true; this.Size = new Size(this.Size.Width, SizeHeight); distanceControl1.reference = obj.reference1DjuryH; distanceControl1.referenceProfile = obj.jury1DProfileH; break; default: //Aglomerative AglomRadio.Checked = true; FastHClusterRadio.Checked = false; KmeansRadio.Checked = false; groupBox1.Visible = false; userHash1.Visible = false; radioButton3.Checked = false; distanceControl1.reference = obj.reference1DjuryAglom; distanceControl1.referenceProfile = obj.jury1DProfileAglom; break; } distanceControl1.distDef = obj.distance; distanceControl1.CAtoms = obj.atoms; distanceControl1.profileName = obj.hammingProfile; jury1DSetup3.profileName = obj.consensusProfile; checkBox2.Checked = obj.ItMeans; numericUpDown1.Value = obj.ItNum; if (obj.HConsensus) { radioButton1.Checked = false; radioButton2.Checked = true; } else { radioButton1.Checked = true; radioButton2.Checked = false; } if (flag) { distanceControl1.FreezDist(); // distanceControl1.distDef = DistanceMeasures.HAMMING; } // distanceControl1.CAtoms = PDB.PDBMODE.ONLY_CA; userHash1.SetHash(opt.hash); } }
/// <summary> /// Le pone las propiedades que se don de entradas, pero que son las mismas para todos los algoritmos /// </summary> /// <param name="_rct"> Clase que le pone cierta propiedad a un algoritmo de cluster </param> /// <param name="_ClusterAlg"> Clase que es el algoritmo de cluster al que se la van a poner las propiedades</param> /// <param name="Tree"> El nodo que representa el Algoritmo de Cluster que tiene todas las propiedades, al igual que las de In y Out </param> public static bool SetGlobalInProperties(ReflectionTools arct, ClusterAlgorithm aClusterAlg, Tree Tree, out string aError, bool aRandAttr) { ClusterEnsemble.DataStructures.Property _Set = Tree.Value.Properties.First(p => p.Name == "Set"); _Set.Value = Enviroment.Set; if (!aRandAttr) { Enviroment.Proximity.AttributesToCalculateProximity = Enviroment.AttributesToCalculateProximity; } else { //el ultimo attr debe estar unchecked List <ClusterEnsemble.Attribute> _attr = Enviroment.AttributesToCalculateProximity; List <ClusterEnsemble.Attribute> _new = new List <ClusterEnsemble.Attribute>(); Random _rnd = new Random(Environment.TickCount); for (int i = 0; i < _attr.Count; i++) { double _num = _rnd.NextDouble(); if (_num > .5) { _new.Add(_attr[i]); } } if (_new.Count == 0) { _new.Add(_attr[_rnd.Next(0, _attr.Count)]); } Enviroment.Proximity.AttributesToCalculateProximity = _new; } ClusterEnsemble.DataStructures.Property _Proximity = Tree.Value.Properties.First(p => p.Name == "Proximity"); _Proximity.Value = Enviroment.Proximity; aError = ""; switch (aClusterAlg.ProximityType) { case ProximityType.Similarity: if (!(Enviroment.Proximity is Similarity)) { aError = "The current algorithm work only with Similarity"; return(false); } break; case ProximityType.Dissimilarity: if (!(Enviroment.Proximity is Dissimilarity)) { aError = "The current algorithm work only with Dissimilarity"; return(false); } break; case ProximityType.Both: break; } arct.SetProperty(Tree.Value.FullName, aClusterAlg, _Set); arct.SetProperty(Tree.Value.FullName, aClusterAlg, _Proximity); return(true); }
public RankingCForm(RankingCInput obj, ClusterAlgorithm alg, bool flag, INPUTMODE inputMode, List <string> profFiles = null) { this.alg = alg; this.inputMode = inputMode; InitializeComponent(); if (profFiles != null) { profileFile = profFiles[0]; button3.Visible = true; } else { button3.Visible = false; } Settings set = new Settings(); set.Load(); if (set.mode == INPUTMODE.RNA) { distanceControl1.HideAtoms = true; } if (flag) { distanceControl1.FreezDist(); sift.Enabled = false; if (sift.Checked) { jury1d.Checked = true; } } switch (alg) { case ClusterAlgorithm.Jury1D: jury1d.Checked = true; jury3d.Checked = false; sift.Checked = false; break; case ClusterAlgorithm.Jury3D: jury1d.Checked = false; jury3d.Checked = true; sift.Checked = false; break; case ClusterAlgorithm.Sift: jury1d.Checked = false; jury3d.Checked = false; sift.Checked = true; break; default: jury1d.Checked = true; jury3d.Checked = false; sift.Checked = false; break; } if (obj != null) { distanceControl1.distDef = obj.oDistance; distanceControl1.CAtoms = obj.oAtoms; distanceControl1.profileName = obj.hammingProfile; jury1DSetup1.profileName = obj.juryProfile; distanceControl1.referenceProfile = obj.referenceProfile; distanceControl1.reference = obj.reference1Djury; } if (jury1d.Checked) { distanceControl1.Enabled = false; } }
public DistanceMeasures GetDistanceMeasure(ClusterAlgorithm clAlgorithm) { switch (clAlgorithm) { case ClusterAlgorithm.FastHCluster: case ClusterAlgorithm.HierarchicalCluster: case ClusterAlgorithm.HKmeans: return hierarchical.distance; case ClusterAlgorithm.Kmeans: return kmeans.kDistance; case ClusterAlgorithm.Jury3D: return other.oDistance; case ClusterAlgorithm.BakerCluster: return threshold.hDistance; default: return DistanceMeasures.NONE; } }