public void BuildChainInterfaceClusters(int operationStep) { ProtCidSettings.dataType = "pfam"; DbBuilderHelper.Initialize(); switch (operationStep) { case 1: try { ChainGroupsClassifier chainGroupClassifier = new ChainGroupsClassifier(); chainGroupClassifier.CombineFamilyGroups(); } catch (Exception ex) { ProtCidSettings.progressInfo.progStrQueue.Enqueue("Classify chain relations error: " + ex.Message); ProtCidSettings.logWriter.WriteLine("Classify chain relations error: " + ex.Message); ProtCidSettings.logWriter.Flush(); } break; // goto case 2; case 2: ChainGroupRepEntryComp interGroupRepEntryComp = new ChainGroupRepEntryComp(); interGroupRepEntryComp.CompareTwoEntries("5uvz", "2dww"); interGroupRepEntryComp.CompareInterGroupRepEntryInterfacesInChainGroups(); // interGroupRepEntryComp.PrintMissingAlignInterGroupRepEntries(); Alignments.GroupEntryAlignments groupAlign = new Alignments.GroupEntryAlignments(); groupAlign.GetRepChainPairsToBeAligned(); // interGroupRepEntryComp.CompareMissingEntryPairs(); break; // goto case 3; case 3: ChainInterfaceCluster interfaceCluster = new ChainInterfaceCluster(); interfaceCluster.ClusterChainGroupInterfaces(); /* int[] abSuperGroupIds = { 744}; * interfaceCluster.UpdateSuperGroups(abSuperGroupIds); */ break; // goto case 4; case 4: ChainClusterStat superClusterStat = new ChainClusterStat(); // superClusterStat.PrintChainClusterTextFilesFromDb (); superClusterStat.PrintSupergroupInterfaceClusters("pfam"); // goto case 5; break; case 5: InterfaceFilesReverser interfaceFileReverse = new InterfaceFilesReverser(); // interfaceFileReverse.UpdateIsSymmetry(); string clusterReverseFileList = interfaceFileReverse.ReverseClusterInterfaceFiles(); #if DEBUG ///////////////////////////////////// // the clusterReverseFileList is still a problem, file not exist exception, probably due to change the current directory // but I can not detect where the problem is. // should fix it. //////////////////////////////////// ProtCidSettings.progressInfo.progStrQueue.Enqueue("The current working directory: " + System.Environment.CurrentDirectory); ProtCidSettings.logWriter.WriteLine("The current working directory: " + System.Environment.CurrentDirectory); FileInfo fileInfo = new FileInfo(clusterReverseFileList); ProtCidSettings.logWriter.WriteLine("The directory of clusterReverseFileList file: " + fileInfo.DirectoryName); #endif clusterReverseFileList = Path.Combine(ProtCidSettings.applicationStartPath, clusterReverseFileList); ChainClusterCompress clusterFileCompress = new ChainClusterCompress(); clusterFileCompress.CompressClusterInterfaceFiles(clusterReverseFileList); // copy the interface files for those not in any clusters // save disk space in the web server clusterFileCompress.RetrieveCrystInterfaceFilesNotInClusters(false); InterfaceImageGen imageGen = new InterfaceImageGen(); imageGen.GenerateInterfaceImages(); // goto case 6; break; case 6: SeqFastaGenerator seqFastaGen = new SeqFastaGenerator(); seqFastaGen.WriteSequencesToFastaFiles(); break; // goto case 7; case 7: BiolUnitSumInfo buSumInfo = new BiolUnitSumInfo(); // buSumInfo.UpdateBiolUnits(); buSumInfo.RetrieveBiolUnits(); break; default: break; } DbBuilderHelper.UpdateIndexes("PfamSuper", ProtCidSettings.protcidDbConnection); ProtCidSettings.progressInfo.threadFinished = true; }
/// <summary> /// /// </summary> /// <param name="userGroupName"></param> /// <param name="userGroupSeqId"></param> /// <param name="userEntries"></param> public void FindInterfaceClustersInUserGroup(string userGroupName, int userGroupSeqId, string[] userEntries) { ProtCidSettings.progressInfo.Reset(); ProtCidSettings.progressInfo.progStrQueue.Enqueue("Clutering interfaces in the user group"); ProtCidSettings.progressInfo.progStrQueue.Enqueue(userGroupName + " " + userGroupSeqId.ToString()); Dictionary <int, string[]> updatedGroupHash = GetUpdatedGroups(userEntries); Dictionary <int, Dictionary <int, string[]> > updateSuperGroupHash = new Dictionary <int, Dictionary <int, string[]> > (); updateSuperGroupHash.Add(userGroupSeqId, updatedGroupHash); Dictionary <int, string> superGroupNameHash = new Dictionary <int, string> (); superGroupNameHash.Add(userGroupSeqId, userGroupName); List <int> updateSuperGroupList = new List <int> (updateSuperGroupHash.Keys); int[] updateSuperGroups = new int[updateSuperGroupList.Count]; updateSuperGroupList.CopyTo(updateSuperGroups); ProtCidSettings.progressInfo.progStrQueue.Enqueue("Updating Super Groups."); ChainGroupsClassifier superGroupClassifier = new ChainGroupsClassifier(); superGroupClassifier.AddChainRelGroupsBasedOnPfam(updateSuperGroupHash, superGroupNameHash); // clear the any existing file to make sure the file containing only those from // the comparison between groups. string nonAlignedPairFile = "NonAlignedEntryPairs.txt"; if (File.Exists(nonAlignedPairFile)) { // before delete, make a copy File.Copy(nonAlignedPairFile, Path.Combine(ProtCidSettings.dirSettings.fatcatPath, nonAlignedPairFile)); File.Delete(nonAlignedPairFile); } ProtCidSettings.progressInfo.progStrQueue.Enqueue("Updating the interface comparisons between groups."); ChainGroupRepEntryComp interGroupRepEntryComp = new ChainGroupRepEntryComp(); interGroupRepEntryComp.UpdateEntryComparisonInSuperGroups(updateSuperGroupHash); ProtCidSettings.progressInfo.progStrQueue.Enqueue("Updating super groups clustering."); ChainInterfaceCluster interfaceCluster = new ChainInterfaceCluster(); interfaceCluster.ClusterUserDefinedGroupInterfaces(updateSuperGroups); ProtCidSettings.progressInfo.progStrQueue.Enqueue("Updating the summary data."); ChainClusterStat superClusterStat = new ChainClusterStat(); superClusterStat.UpdateSupergroupInterfaceClustersSumInfo(updateSuperGroups, userEntries, "pfam", false); ProtCidSettings.progressInfo.progStrQueue.Enqueue("Updating tar interface files."); InterfaceFilesReverser interfaceFileReverse = new InterfaceFilesReverser(); string updateClusterReverseListFile = interfaceFileReverse.ReverseClusterInterfaceFiles(updateSuperGroupHash); // string updateClusterReverseListFile = "ReverseInterfacesInCluster.txt"; ChainClusterCompress clusterFileCompress = new ChainClusterCompress(); clusterFileCompress.CompressGroupClusterInterfaceFiles(updateSuperGroups, updateClusterReverseListFile); ProtCidSettings.progressInfo.progStrQueue.Enqueue("Updating sequence files."); SeqFastaGenerator seqFastaGen = new SeqFastaGenerator(); seqFastaGen.UpdateSeqFastaFiles(updateSuperGroups); ProtCidSettings.progressInfo.progStrQueue.Enqueue("Done!"); }