Ejemplo n.º 1
0
        /// <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();
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="stepNum"></param>
        public void BuildDomainInterfaces(int stepNum)
        {
            InitializeThread();

            DomainInterfaceTables.InitializeTables();
            ProtCidSettings.progressInfo.Reset();
            ProtCidSettings.progressInfo.progStrQueue.Enqueue("Retrieving domain-domain interactions.");

            /*    ProtCidSettings.progressInfo.progStrQueue.Enqueue("Creating database tables.");
             *  DomainInterfaceTables.InitializeDbTables();
             *  ProtCidSettings.progressInfo.progStrQueue.Enqueue("Done.");
             */
            switch (stepNum)
            {
            case 1:
                ProtCidSettings.progressInfo.progStrQueue.Enqueue("Detecting domain-domain interactions from cryst chain interfaces.");
                DomainClassifier domainClassifier = new DomainClassifier();
                domainClassifier.RetrieveDomainInterfaces();
                ProtCidSettings.progressInfo.currentOperationIndex++;
                //	goto case 1;
                break;

            case 2:
                ProtCidSettings.progressInfo.progStrQueue.Enqueue("Write domain interface files.");
                DomainInterfaceWriter domainInterfaceWriter = new DomainInterfaceWriter();
                domainInterfaceWriter.WriteDomainInterfaceFiles();
                //      domainInterfaceWriter.UpdateDomainInterfaceFiles();
                //        domainInterfaceWriter.WriteMultiChainDomainInterfaces();
                ProtCidSettings.progressInfo.currentOperationIndex++;

                ProtCidSettings.progressInfo.progStrQueue.Enqueue("Calculate SAs of domain interface files.");
                DomainInterfaceSA interfaceSa = new DomainInterfaceSA();
                //   interfaceSa.UpdateDomainInterfaceSAs();
                interfaceSa.CalculateDomainInterfaceSAs();
                ProtCidSettings.progressInfo.currentOperationIndex++;
                //   goto case 2;
                break;

            case 3:
                ProtCidSettings.progressInfo.progStrQueue.Enqueue("Comparing domain interfaces.");
                PfamDomainInterfaceComp domainComp = new PfamDomainInterfaceComp();
                domainComp.CompareDomainInterfaces();

                /*   domainComp.SynchronizeDomainChainInterfaceComp();
                 *  domainComp.CompareSpecificDomainInterfaces ();
                 *  domainComp.UpdateMultiChainDomainInterfaces();
                 */
                ProtCidSettings.progressInfo.currentOperationIndex++;
                break;

            case 4:
                ProtCidSettings.progressInfo.progStrQueue.Enqueue("Comparing entry domain interfaces.");
                DomainInterfaceBuComp.CrystBuDomainInterfaceComp domainInterfaceComp =
                    new InterfaceClusterLib.DomainInterfaces.DomainInterfaceBuComp.CrystBuDomainInterfaceComp();
                //    int[] relSeqIds = {10515 };
                //     domainInterfaceComp.UpdateCrystBuDomainInterfaceComp(relSeqIds);
                domainInterfaceComp.CompareCrystBuDomainInterfaces();
                ProtCidSettings.progressInfo.currentOperationIndex++;
                break;


            case 5:
                ProtCidSettings.progressInfo.progStrQueue.Enqueue("Cluster domain interfaces.");
                DomainInterfaceCluster interfaceCluster = new DomainInterfaceCluster();
                int[] relSeqIds = { 2 };
                interfaceCluster.UpdateDomainInterfaceClusters(relSeqIds);
//                    interfaceCluster.ClusterDomainInterfaces();
                // interfaceCluster.ClusterLeftRelations();
                break;
            //    goto case 4;

            case 6:
                ProtCidSettings.progressInfo.progStrQueue.Enqueue("Print Domain Interface Cluster Info.");
                DomainClusterStat clusterStat     = new DomainClusterStat();
                int[]             updateRelSeqIds = { 2 };
                clusterStat.UpdateDomainClusterInfo(updateRelSeqIds);
                //                   clusterStat.PrintDomainClusterInfo();
                //            clusterStat.PrintDomainDbSumInfo("PfamDomain");
                //           clusterStat.AddNumCFsToIPfamInPdbMetaData();



                //      clusterStat.PrintPartialDomainClusterInfo();
                //      clusterStat.GetPfamDomainSumInfo();

                /*                  DomainInterfaceStatInfo statInfo = new DomainInterfaceStatInfo();
                 *          //      statInfo.PrintPepInteractingHmmSites();
                 *                //     statInfo.GetPfamPepInterfaceClusterInfo();
                 *                //    statInfo.PrintPepLigandHmmSites ();
                 *                    statInfo.PrintPfamDomainRelationInfo();
                 *                //    statInfo.GetGenAsymChainDomainInterfaces();*/
                break;
            //    goto case 7;

            case 7:
                PfamClusterFilesCompress clusterFileCompress = new PfamClusterFilesCompress();
                clusterFileCompress.CompressPfamClusterChainInterfaceFiles();
                clusterFileCompress.RetrieveCrystInterfaceFilesNotInClusters(true);

                DomainSeqFasta seqFasta = new DomainSeqFasta();
                seqFasta.PrintClusterDomainSequences();

                DomainInterfaceImageGen imageGen = new DomainInterfaceImageGen();
                imageGen.GenerateDomainInterfaceImages();

                PfamRelNetwork pfamNetWriter = new PfamRelNetwork();
                pfamNetWriter.GeneratePfamNetworkGraphmlFiles();

                // build the unp-unp interaction table based on pdb domain interfaces
                UnpInteractionStr unpInteract = new UnpInteractionStr();
                unpInteract.BuildUnpInteractionNetTable();
                break;

            case 8:      // about peptide interfaces
                PfamPeptideInterfaces pepInterfaces = new PfamPeptideInterfaces();
                pepInterfaceBuilder.BuildPfamPeptideInterfaces();
                break;

            case 9:
                //          ligandInteractBuilder.AddClusterInfoToPfamDomainAlign();

                ligandInteractBuilder.BuildPfamLigandInteractions();
                break;

            default:
                break;
            }
            ProtCidSettings.logWriter.Close();

            ProtCidSettings.progressInfo.threadFinished = true;
        }