/// <summary> /// /// </summary> public void UpdatePfamChainClusterFiles() { ProtCidSettings.dataType = "pfam"; DbBuilderHelper.Initialize(); ProtCidSettings.progressInfo.Reset(); // int[] updateSuperGroups = GetUpdateClusterChainGroups (); int[] updateSuperGroups = { 3171, 9125, 13844, 16380, 28272, 29578 }; ProtCidSettings.progressInfo.progStrQueue.Enqueue("Updating super groups clustering."); ChainInterfaceCluster interfaceCluster = new ChainInterfaceCluster(); interfaceCluster.UpdateSuperGroupClusters(updateSuperGroups); ProtCidSettings.progressInfo.progStrQueue.Enqueue("Updating the summary data."); ChainClusterStat superClusterStat = new ChainClusterStat(); superClusterStat.UpdateSupergroupInterfaceClustersSumInfo(updateSuperGroups, "pfam", true); ProtCidSettings.progressInfo.progStrQueue.Enqueue("Updating tar interface files."); InterfaceFilesReverser interfaceFileReverse = new InterfaceFilesReverser(); string updateClusterReverseFileList = interfaceFileReverse.ReverseClusterInterfaceFiles(updateSuperGroups); string updateClusterReverseFileList1 = "ReverseInterfacesInCluster.txt"; ChainClusterCompress clusterFileCompress = new ChainClusterCompress(); clusterFileCompress.CompressGroupClusterInterfaceFiles(updateSuperGroups, updateClusterReverseFileList1); clusterFileCompress.UpdateCrystInterfaceFilesNotInClusters(false); ProtCidSettings.progressInfo.progStrQueue.Enqueue("Updating sequence files."); SeqFastaGenerator seqFastaGen = new SeqFastaGenerator(); seqFastaGen.UpdateSeqFastaFiles(updateSuperGroups); InterfaceImageGen imageGen = new InterfaceImageGen(); imageGen.UpdateClusterInterfaceImages(updateSuperGroups); }
/// <summary> /// /// </summary> public void UpdateChainInterfaceClusters() { ProtCidSettings.dataType = "pfam"; DbBuilderHelper.Initialize(); ProtCidSettings.progressInfo.Reset(); ProtCidSettings.progressInfo.progStrQueue.Enqueue("Updating PFAM SuperGroup Interfaces Data."); // ChainClusterStat clusterStat = new ChainClusterStat(); // clusterStat.UpdateMinSeqIdentityInDb(); ProtCidSettings.logWriter.WriteLine(DateTime.Today.ToShortTimeString()); ProtCidSettings.logWriter.WriteLine("Updating PFAM SuperGroup Interfaces Data."); ProtCidSettings.logWriter.Flush(); ProtCidSettings.progressInfo.progStrQueue.Enqueue("Update biological units and entrypfamarch data for protcid"); Dictionary <int, string[]> updatedGroupHash = GetUpdatedGroups(); Dictionary <int, Dictionary <int, string[]> > updateSuperGroupHash = null; ProtCidSettings.progressInfo.progStrQueue.Enqueue("Updating Super Groups."); // ChainGroupsClassifier superGroupClassifier = new ChainGroupsClassifier(); // updateSuperGroupHash = superGroupClassifier.UpdateFamilySuperGroups(updatedGroupHash); if (updateSuperGroupHash == null) { updateSuperGroupHash = new Dictionary <int, Dictionary <int, string[]> > (); StreamReader dataReader = new StreamReader("UpdateSuperGroups.txt"); string line = ""; int superGroupId = -1; Dictionary <int, string[]> updateGroupEntryHash = null; while ((line = dataReader.ReadLine()) != null) { if (line == "") { continue; } if (line.Substring(0, 1) == "#") { if (superGroupId != -1) { updateSuperGroupHash.Add(superGroupId, updateGroupEntryHash); } superGroupId = Convert.ToInt32(line.Substring(1, line.Length - 1)); updateGroupEntryHash = new Dictionary <int, string[]> (); } if (line.IndexOf(":") > -1) { string[] fields = line.Split(':'); string[] entries = fields[1].Split(','); updateGroupEntryHash.Add(Convert.ToInt32(fields[0]), entries); } } if (superGroupId > -1) { updateSuperGroupHash.Add(superGroupId, updateGroupEntryHash); } dataReader.Close(); } List <int> updateSuperGroupList = new List <int> (updateSuperGroupHash.Keys); updateSuperGroupList.Sort(); int[] updateSuperGroups = new int[updateSuperGroupList.Count]; updateSuperGroupList.CopyTo(updateSuperGroups); string[] updateEntries = GetUpdateEntries(updateSuperGroupHash); // 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), true); File.Delete(nonAlignedPairFile); } ProtCidSettings.progressInfo.progStrQueue.Enqueue("Updating the interface comparisons between groups."); ChainGroupRepEntryComp interGroupRepEntryComp = new ChainGroupRepEntryComp(); interGroupRepEntryComp.UpdateEntryComparisonInSuperGroups(updateSuperGroupHash); // interGroupRepEntryComp.CompareMissingEntryPairs(); ProtCidSettings.progressInfo.progStrQueue.Enqueue("Updating super groups clustering."); ChainInterfaceCluster interfaceCluster = new ChainInterfaceCluster(); interfaceCluster.UpdateSuperGroupClusters(updateSuperGroups); ProtCidSettings.progressInfo.progStrQueue.Enqueue("Updating the summary data."); ChainClusterStat superClusterStat = new ChainClusterStat(); superClusterStat.UpdateSupergroupInterfaceClustersSumInfo(updateSuperGroups, updateEntries, "pfam", true); // superClusterStat.UpdateProtCidChainMetaData("pfam", updateEntries, updateSuperGroups); ProtCidSettings.progressInfo.progStrQueue.Enqueue("Updating tar interface files."); InterfaceFilesReverser interfaceFileReverse = new InterfaceFilesReverser(); string updateClusterReverseFileList = interfaceFileReverse.ReverseClusterInterfaceFiles(updateSuperGroupHash); // string updateClusterReverseFileList = "ReverseInterfacesInCluster.txt"; updateClusterReverseFileList = Path.Combine(ProtCidSettings.applicationStartPath, updateClusterReverseFileList); // string updateClusterReverseFileList = "ReverseInterfacesInCluster.txt"; ChainClusterCompress clusterFileCompress = new ChainClusterCompress(); clusterFileCompress.CompressGroupClusterInterfaceFiles(updateSuperGroups, updateClusterReverseFileList); clusterFileCompress.UpdateCrystInterfaceFilesNotInClusters(updateSuperGroups, false); ProtCidSettings.progressInfo.progStrQueue.Enqueue("Updating sequence files."); ProtCidSettings.logWriter.WriteLine("Updating sequence files."); SeqFastaGenerator seqFastaGen = new SeqFastaGenerator(); seqFastaGen.UpdateSeqFastaFiles(updateSuperGroups); ProtCidSettings.logWriter.WriteLine("Done!"); ProtCidSettings.logWriter.Flush(); ProtCidSettings.progressInfo.progStrQueue.Enqueue("Update biological units and entrypfamarch data for protcid"); ProtCidSettings.logWriter.WriteLine("Update biological units and entrypfamarch data for protcid"); BiolUnitSumInfo buSumInfo = new BiolUnitSumInfo(); buSumInfo.UpdateBiolUnits(updateEntries); ProtCidSettings.logWriter.WriteLine("Done!"); ProtCidSettings.logWriter.Flush(); ProtCidSettings.progressInfo.progStrQueue.Enqueue("Updating cluster interface images."); ProtCidSettings.logWriter.WriteLine("Updating cluster interface images."); InterfaceImageGen imageGen = new InterfaceImageGen(); imageGen.UpdateClusterInterfaceImages(updateSuperGroups); ProtCidSettings.logWriter.WriteLine("Done!"); ProtCidSettings.logWriter.Flush(); ProtCidSettings.progressInfo.progStrQueue.Enqueue("Updating indexes for super groups tables"); ProtCidSettings.logWriter.WriteLine("Updating indexes for super groups tables"); DbBuilderHelper.UpdateIndexes("PfamSuper", ProtCidSettings.protcidDbConnection); ProtCidSettings.logWriter.WriteLine("Done!"); ProtCidSettings.logWriter.Flush(); ProtCidSettings.progressInfo.progStrQueue.Enqueue("Update Done!"); ProtCidSettings.progressInfo.threadFinished = true; ProtCidSettings.logWriter.Flush(); }