/// <summary> /// /// </summary> public void UpdateDomainInterfacesDb(string updateRelEntryFile) { Dictionary <int, string[]> updateRelEntryDict = new Dictionary <int, string[]> (); string line = ""; ProtCidSettings.progressInfo.progStrQueue.Enqueue("Detecting domain-domain interactions from cryst chain interfaces."); ProtCidSettings.logWriter.WriteLine("Detecting domain-domain interactions from cryst chain interfaces."); ProtCidSettings.progressInfo.currentOperationIndex++; List <string> updateEntryList = new List <string>(); List <int> updateRelationList = new List <int>(); int relSeqId = 0; if (File.Exists(updateRelEntryFile)) { StreamReader dataReader = new StreamReader(updateRelEntryFile); while ((line = dataReader.ReadLine()) != null) { string[] fields = line.Split(' '); relSeqId = Convert.ToInt32(fields[0]); string[] entries = new string[fields.Length - 1]; Array.Copy(fields, 1, entries, 0, entries.Length); updateRelEntryDict.Add(relSeqId, entries); updateRelationList.Add(relSeqId); for (int i = 1; i < fields.Length; i++) { if (!updateEntryList.Contains(fields[i])) { updateEntryList.Add(fields[i]); } } } dataReader.Close(); } string[] updateEntries = updateEntryList.ToArray(); if (updateRelEntryDict.Count == 0) { ProtCidSettings.progressInfo.progStrQueue.Enqueue("No relations need to be updated, program terminated, and return."); return; } int[] updateRelSeqIds = updateRelationList.ToArray(); ProtCidSettings.progressInfo.progStrQueue.Enqueue("Updating domain interface files."); ProtCidSettings.logWriter.WriteLine("Updating domain interface files."); DomainInterfaceWriter domainInterfaceFileGen = new DomainInterfaceWriter(); domainInterfaceFileGen.UpdateDomainInterfaceFiles(updateRelEntryDict); ProtCidSettings.progressInfo.currentOperationIndex++; ProtCidSettings.logWriter.Flush(); ProtCidSettings.progressInfo.progStrQueue.Enqueue("Update the surface areas for the domain interfaces."); ProtCidSettings.logWriter.WriteLine("Update the surfacea areas for the domain interfaces"); DomainInterfaceSA interfaceSa = new DomainInterfaceSA(); interfaceSa.UpdateDomainInterfaceSAs(updateEntries); ProtCidSettings.progressInfo.currentOperationIndex++; ProtCidSettings.logWriter.Flush(); ProtCidSettings.progressInfo.progStrQueue.Enqueue("Updating the comparison of domain interfaces in each relation."); ProtCidSettings.logWriter.WriteLine("Updating the comparison of domain interfaces in each relation."); PfamDomainInterfaceComp domainComp = new PfamDomainInterfaceComp(); domainComp.UpdateEntryDomainInterfaceComp(updateRelEntryDict); // domainComp.CompareRepHomoEntryDomainInterfaces(); ProtCidSettings.progressInfo.currentOperationIndex++; ProtCidSettings.logWriter.Flush(); ProtCidSettings.progressInfo.progStrQueue.Enqueue("Updating the comparison between cryst and BU entry domain interfaces."); ProtCidSettings.logWriter.WriteLine("Updating the comparison between cryst and BU entry domain interfaces."); DomainInterfaceBuComp.CrystBuDomainInterfaceComp domainInterfaceComp = new InterfaceClusterLib.DomainInterfaces.DomainInterfaceBuComp.CrystBuDomainInterfaceComp(); domainInterfaceComp.UpdateCrystBuDomainInterfaceComp(updateEntries); ProtCidSettings.progressInfo.currentOperationIndex++; ProtCidSettings.logWriter.Flush(); ProtCidSettings.progressInfo.progStrQueue.Enqueue("Update domain interface clusters."); ProtCidSettings.logWriter.WriteLine("Update domain interface clusters."); DomainInterfaceCluster domainInterfaceCluster = new DomainInterfaceCluster(); domainInterfaceCluster.UpdateDomainInterfaceClusters(updateRelSeqIds); ProtCidSettings.logWriter.Flush(); ProtCidSettings.progressInfo.progStrQueue.Enqueue("Update Domain Interface Cluster Info."); ProtCidSettings.logWriter.WriteLine("Update Domain Interface Cluster Info."); DomainClusterStat clusterStat = new DomainClusterStat(); clusterStat.UpdateDomainClusterInfo(updateRelEntryDict); // clusterStat.UpdateIPfamInPdbMetaData(updateRelSeqIds); ProtCidSettings.logWriter.Flush(); ProtCidSettings.progressInfo.progStrQueue.Enqueue("Update cluster file compressing."); ProtCidSettings.logWriter.WriteLine("Update compressing cluster interface files."); PfamClusterFilesCompress clusterFileCompress = new PfamClusterFilesCompress(); clusterFileCompress.UpdateRelationClusterChainInterfaceFiles(updateRelSeqIds); ProtCidSettings.logWriter.WriteLine("Copy interfaces not in any clusters"); clusterFileCompress.UpdateCrystInterfaceFilesNotInClusters(updateRelSeqIds, true); ProtCidSettings.logWriter.Flush(); ProtCidSettings.progressInfo.progStrQueue.Enqueue("Update domain cluster interface images."); ProtCidSettings.logWriter.WriteLine("Update domain cluster interface images"); DomainInterfaceImageGen imageGen = new DomainInterfaceImageGen(); imageGen.UpdateDomainInterfaceImages(updateRelSeqIds); ProtCidSettings.logWriter.Flush(); DomainSeqFasta seqFasta = new DomainSeqFasta(); seqFasta.UpdateClusterDomainSequences(updateRelSeqIds); PfamRelNetwork pfamNetWriter = new PfamRelNetwork(); pfamNetWriter.UpdatePfamNetworkGraphmlFiles(updateEntries); // build the unp-unp interaction table based on pdb domain interfaces UnpInteractionStr unpInteract = new UnpInteractionStr(); unpInteract.UpdateUnpInteractionNetTable(updateEntries); // update the domain alignment pymol session files // move the code after clustering ligands on May 2, 2017, so the cluster info can be included in the Pfam-ligands file /* ProtCidSettings.progressInfo.progStrQueue.Enqueue("Update compiling domain alignment pymol sessions"); * PfamDomainFileCompress domainFileCompress = new PfamDomainFileCompress(); * domainFileCompress.UpdatePfamDomainFiles(updateEntries);*/ ProtCidSettings.logWriter.WriteLine("Done!"); ProtCidSettings.logWriter.Flush(); }