private void AlignProfile(string protName, string profileName, List <byte> prof) { List <byte> ll = new List <byte>(prof.Count); int m = 0; if (align == null || align[profileName] == null || !align[profileName].ContainsKey(protName)) { foreach (var item in prof) { ll.Add(item); } } else { string alignProfile = align[profileName][protName]; for (int i = 0; i < alignProfile.Length; i++) { if (alignProfile[i] == '-') { ll.Add(0); continue; } if (m < prof.Count) { ll.Add(prof[m++]); } else { ErrorBase.AddErrors("Profile " + profileName + " for " + protName + " seems to be incorect"); } } } protInfo tmp = new protInfo(); if (r.profiles[profileName].ContainsKey(protName)) { tmp = r.profiles[profileName][protName]; tmp.alignment = ll; r.profiles[profileName][protName] = tmp; } }
public Dictionary <string, List <byte> > CombineProfiles(string protName, Dictionary <string, Dictionary <string, protInfo> > pr) { if (protCombineStates == null) { protCombineStates = new Dictionary <string, List <byte> >(); } if (combine == profileCombination.JOIN_STATES) { List <string> profName = new List <string>(pr.Keys); List <string> states = new List <string>(pr[profName[0]][protName].alignment.Count); protInfo info = pr[profName[0]][protName]; for (int i = 0; i < info.alignment.Count; i++) { string currentState = ""; foreach (var profileName in pr.Keys) { byte cc = pr[profileName][protName].alignment[i]; if (cc == 0) { currentState = "0"; break; } currentState += cc.ToString(); } states.Add(currentState); } if (states.Count > 0) { //return states; if (protCombineStates.Count > 0) { List <string> keys = new List <string>(protCombineStates.Keys); if (states.Count == protCombineStates[keys[0]].Count) { AddItemsCombineStates(protName, states); } else { ErrorBase.AddErrors("Wrong alignment: " + protName); } } else { AddItemsCombineStates(protName, states); } } } else { List <string> profNames = new List <string>(pr.Keys); for (int i = 0; i < profNames.Count; i++) { List <string> codes = new List <string>(); foreach (var code in pr[profNames[i]][protName].alignment) { if (code != 0) { codes.Add(code.ToString() + "_" + i); } else { codes.Add("0"); } AddItemsCombineStates(protName, codes); codes.Clear(); } } } return(protCombineStates); }
public void StartAll(object processParams) { ErrorBase.ClearErrors(); DebugClass.DebugOn(); string orgProcessName = ((ThreadParam)processParams).name; currentProcessName = ((ThreadParam)processParams).name; int counter = 1; try { if (opt.profileFiles.Count == 0) { foreach (var alg in opt.clusterAlgorithm) { foreach (var item in opt.dataDir) { // if (tTimer != null) // tTimer.Start(); currentProcessName = MakeName(processParams, alg, counter); //if (beginJob != null) // beginJob(currentProcessName, alg.ToString("g"), item, opt.GetDistanceMeasure(alg)); switch (alg) { case ClusterAlgorithm.uQlustTree: RunHashDendrogCombine(currentProcessName, item); break; case ClusterAlgorithm.HashCluster: RunHashCluster(currentProcessName, item); break; case ClusterAlgorithm.HierarchicalCluster: RunHierarchicalCluster(currentProcessName, item); break; case ClusterAlgorithm.HKmeans: RunHKMeans(currentProcessName, item); break; case ClusterAlgorithm.FastHCluster: RunFastHCluster(currentProcessName, item); break; case ClusterAlgorithm.Kmeans: RunKMeans(currentProcessName, item); break; case ClusterAlgorithm.BakerCluster: RunBakerCluster(currentProcessName, item); break; case ClusterAlgorithm.Jury1D: Run1DJury(currentProcessName, item); break; case ClusterAlgorithm.Jury3D: Run3DJury(currentProcessName, item); break; case ClusterAlgorithm.Sift: RunSift(currentProcessName, item); break; case ClusterAlgorithm.HTree: RunHTree(currentProcessName, item); break; } counter++; } foreach (var item in opt.dcdFiles) { // if (tTimer != null) // tTimer.Start(); currentProcessName = MakeName(processParams, alg, counter); //if (beginJob != null) // beginJob(currentProcessName, opt.clusterAlgorithm.ToString(), item.dcdFile, opt.GetDistanceMeasure(alg)); switch (alg) { case ClusterAlgorithm.uQlustTree: RunHashDendrog(currentProcessName, null, null, item); break; case ClusterAlgorithm.HashCluster: RunHashCluster(currentProcessName, null, null, item); break; case ClusterAlgorithm.HierarchicalCluster: RunHierarchicalCluster(currentProcessName, null, null, item); break; case ClusterAlgorithm.HKmeans: RunHKMeans(currentProcessName, null, null, item); break; case ClusterAlgorithm.FastHCluster: RunFastHCluster(currentProcessName, null, null, item); break; case ClusterAlgorithm.Kmeans: RunKMeans(currentProcessName, null, null, item); break; case ClusterAlgorithm.BakerCluster: RunBakerCluster(currentProcessName, null, null, item); break; case ClusterAlgorithm.Jury1D: Run1DJury(currentProcessName, null, null, item); break; case ClusterAlgorithm.Jury3D: Run3DJury(currentProcessName, null, null, item); break; case ClusterAlgorithm.Sift: RunSift(currentProcessName, null, item); break; case ClusterAlgorithm.HTree: RunHTree(currentProcessName, null, null, item); break; } counter++; } } } else { foreach (var alg in opt.clusterAlgorithm) { foreach (var item in opt.profileFiles) { // if (tTimer != null) // tTimer.Start(); currentProcessName = MakeName(processParams, alg, counter); // if (beginJob != null) // beginJob(currentProcessName, opt.clusterAlgorithm.ToString(), item, opt.GetDistanceMeasure(alg)); switch (alg) { case ClusterAlgorithm.uQlustTree: RunHashDendrogCombine(currentProcessName, item, item); //RunHashDendrog(currentProcessName, null, item); break; case ClusterAlgorithm.HashCluster: RunHashCluster(currentProcessName, item, item); break; case ClusterAlgorithm.HierarchicalCluster: RunHierarchicalCluster(currentProcessName, item, item); break; case ClusterAlgorithm.HKmeans: RunHKMeans(currentProcessName, item, item); break; case ClusterAlgorithm.FastHCluster: RunFastHCluster(currentProcessName, item, item); break; case ClusterAlgorithm.Kmeans: RunKMeans(currentProcessName, item, item); break; case ClusterAlgorithm.BakerCluster: RunBakerCluster(currentProcessName, item, item); break; case ClusterAlgorithm.Jury1D: Run1DJury(currentProcessName, item, item); break; case ClusterAlgorithm.Jury3D: Run3DJury(currentProcessName, item, item); break; case ClusterAlgorithm.HTree: RunHTree(currentProcessName, item, item); break; } counter++; } } } FinishThread(orgProcessName, false); } catch (Exception ex) { FinishThread(orgProcessName, true); message(ex.Message); } DebugClass.DebugOff(); }