Exemplo n.º 1
0
        /// <summary>
        /// update entry-related data
        /// it is not necessary to recompute entry data from scratch
        /// </summary>
        /// <param name="updateEntries"></param>
        public void UpdateEntryInterfaceData(string[] updateEntries)
        {
            DbBuilderHelper.Initialize();
            if (updateEntries == null)
            {
                //              string lsFile = @"D:\Qifang\ProjectData\DbProjectData\PDB\newls-pdb_entry.txt";
                //               updateEntries = GetUpdateEntries(lsFile);
                updateEntries = GetUpdateEntries();
            }

            ProtCidSettings.logWriter.WriteLine("1. Compute interfaces from crystals");
            ProtCidSettings.progressInfo.progStrQueue.Enqueue("1. Compute interfaces from crystals");
            CrystInterfaceBuilder interfaceBuilder = new CrystInterfaceBuilder();

            interfaceBuilder.ComputeEntryCrystInterfaces(updateEntries);
            ProtCidSettings.progressInfo.progStrQueue.Enqueue("Done!");
            ProtCidSettings.logWriter.WriteLine("Done!");
            ProtCidSettings.progressInfo.currentOperationIndex++;

            ProtCidSettings.logWriter.WriteLine("2. Generate interface files, calculate ASA and contacts in interfaces");
            ProtCidSettings.progressInfo.progStrQueue.Enqueue("2. Generate interface files, calculate ASA and contacts in interfaces");
            interfaceBuilder.GenerateEntryInterfaceFiles(updateEntries);
            ProtCidSettings.progressInfo.progStrQueue.Enqueue("Done!");
            ProtCidSettings.logWriter.WriteLine("Done!");
            ProtCidSettings.progressInfo.currentOperationIndex++;

            ProtCidSettings.logWriter.WriteLine("3. Compare cryst interfaces with PDB/PISA BU and ASU Interfaces");
            ProtCidSettings.progressInfo.progStrQueue.Enqueue("3. Compare cryst interfaces with PDB/PISA BU and ASU Interfaces");
            // compare cryst interfaces and BU interfaces for each entry
            EntryCrystBuInterfaceComp crystBuInterfaceComp = new EntryCrystBuInterfaceComp();

            crystBuInterfaceComp.UpdateEntryCrystBuInterfaces(updateEntries);
            ProtCidSettings.progressInfo.progStrQueue.Enqueue("Done!");

            ProtCidSettings.logWriter.WriteLine("4. Update crc-crc hh alignments");
            ProtCidSettings.progressInfo.progStrQueue.Enqueue("4. Update crc-crc hh alignments");
            Alignments.GroupEntryAlignments groupAlignment = new InterfaceClusterLib.Alignments.GroupEntryAlignments();
            groupAlignment.UpdateCrcHhAlignments();
            ProtCidSettings.progressInfo.progStrQueue.Enqueue("Done!");

            ProtCidSettings.progressInfo.progStrQueue.Enqueue("Recomputing indices.");
            DbBuilderHelper.UpdateIndexes("CrystBuInterfaceComp", ProtCidSettings.protcidDbConnection);
            ProtCidSettings.progressInfo.progStrQueue.Enqueue("Done!");
            ProtCidSettings.logWriter.WriteLine("Done!");
            ProtCidSettings.progressInfo.currentOperationIndex++;
        }
Exemplo n.º 2
0
        /// <summary>
        /// build from current database by adding update/new pdb entries
        /// but rebuild entry-based groups due to new PFAM version
        /// regroup crystal forms
        /// </summary>
        public void BuildEntryInterfaceGroups(int step)
        {
            DbBuilderHelper.Initialize();
            ProtCidSettings.progressInfo.Reset();
            ProtCidSettings.progressInfo.totalOperationNum = 8;
            ProtCidSettings.progressInfo.progStrQueue.Enqueue("Building entry-based groups, includes 8 steps: ");
            ProtCidSettings.progressInfo.progStrQueue.Enqueue("1.Calculate entry interfaces");
            ProtCidSettings.progressInfo.progStrQueue.Enqueue("2. Generate interface files, calculate ASA.");
            ProtCidSettings.progressInfo.progStrQueue.Enqueue("3. Compare cryst interfaces with PDB/PQS/PISA BU and ASU Interfaces");
            ProtCidSettings.progressInfo.progStrQueue.Enqueue("4. Classify PDB entries into homologous groups");
            ProtCidSettings.progressInfo.progStrQueue.Enqueue("5. Retrieve chain alignments in groups");
            ProtCidSettings.progressInfo.progStrQueue.Enqueue("6. Calculate similarity Q scores in an entry group.");
            //     ProtCidSettings.progressInfo.progStrQueue.Enqueue("7. Compare interfaces of entries in entry groups.");
            ProtCidSettings.progressInfo.progStrQueue.Enqueue("7. Deal With Redundant Crystal Forms.");

            ProtCidSettings.logWriter.WriteLine(DateTime.Today.ToShortTimeString());
            ProtCidSettings.logWriter.WriteLine("Build entry-based group data.");

// update entry-related data, it is not necessary to recompute entry data from scratch
            string[] updateEntries = GetMissBuCompEntries();
            CrystInterfaceBuilder interfaceBuilder = new CrystInterfaceBuilder();

            switch (step)
            {
            case 1:
                ProtCidSettings.logWriter.WriteLine("1. Compute interfaces from crystals");
                ProtCidSettings.progressInfo.progStrQueue.Enqueue("1. Compute interfaces from crystals");
                interfaceBuilder.ComputeEntryCrystInterfaces(updateEntries);
                ProtCidSettings.progressInfo.progStrQueue.Enqueue("Done!");
                ProtCidSettings.progressInfo.currentOperationIndex++;
                goto case 2;

            case 2:
                ProtCidSettings.logWriter.WriteLine("2. Generate interface files, calculate ASA and contacts in interfaces");
                ProtCidSettings.progressInfo.progStrQueue.Enqueue("2. Generate interface files, calculate ASA and contacts in interfaces");
                interfaceBuilder.GenerateEntryInterfaceFiles(updateEntries);
                ProtCidSettings.progressInfo.progStrQueue.Enqueue("Done!");
                ProtCidSettings.progressInfo.currentOperationIndex++;
                break;

            case 3:
                ProtCidSettings.logWriter.WriteLine("3. Compare cryst interfaces with PDB/PISA BU and ASU Interfaces");
                ProtCidSettings.progressInfo.progStrQueue.Enqueue("3. Compare cryst interfaces with PDB/PISA BU and ASU Interfaces");
                // compare cryst interfaces and BU interfaces for each entry
                EntryCrystBuInterfaceComp crystBuInterfaceComp = new EntryCrystBuInterfaceComp();
                crystBuInterfaceComp.UpdateEntryCrystBuInterfaces(updateEntries);
                ProtCidSettings.progressInfo.progStrQueue.Enqueue("Done!");
                ProtCidSettings.progressInfo.progStrQueue.Enqueue("Recomputing indices.");
                DbBuilderHelper.UpdateIndexes("CrystBuInterfaceComp", ProtCidSettings.protcidDbConnection);
                ProtCidSettings.progressInfo.progStrQueue.Enqueue("Done!");
                ProtCidSettings.progressInfo.currentOperationIndex++;
                break;

            case 4:
                // group entries, rebuild group tables: PfamHomoSeqInfo, PfamHomoGroupEntryAlign, PfamHomoRepEntryAlign
                ProtCidSettings.logWriter.WriteLine("4. Classify PDB entries into homologous groups.");
                ProtCidSettings.progressInfo.progStrQueue.Enqueue("4. Classify PDB entries into homologous groups");
                PfamEntryClassifier pfamClassifier = new PfamEntryClassifier();
                pfamClassifier.ClassifyPdbPfamGroups();
                ProtCidSettings.progressInfo.progStrQueue.Enqueue("Recomputing indices.");
                DbBuilderHelper.UpdateIndexes("PFAMHOMO", ProtCidSettings.protcidDbConnection);
                ProtCidSettings.progressInfo.progStrQueue.Enqueue("Done!");
                ProtCidSettings.progressInfo.currentOperationIndex++;
                break;

            case 5:
                // retrieve chain alignments from HH, and fatcat alignments
                ProtCidSettings.logWriter.WriteLine("5. Retrieve chain alignments in groups");
                ProtCidSettings.progressInfo.progStrQueue.Enqueue("5. Retrieve chain alignments in groups");
                Alignments.GroupEntryAlignments groupAlignment = new InterfaceClusterLib.Alignments.GroupEntryAlignments();
                groupAlignment.UpdateCrcHhAlignments();
                groupAlignment.RetrieveChainAlignmentsInGroups();
                //        groupAlignment.GetRepChainPairsToBeAligned();
                //       groupAlignment.GetRepEntryChainAlignFilesFromMissingEntityAlign();
                //        groupAlignment.UpdateFatcatAlignmentsFromFile("");
                //         int[] updateGroups = { 10400 };
                //         groupAlignment.UpdateGroupEntryAlignments (updateGroups);
                //         groupAlignment.UpdateMissingChainAlignmentsInGroups (null);
                ProtCidSettings.progressInfo.progStrQueue.Enqueue("Recomputing indices.");
                DbBuilderHelper.UpdateIndexes("PFAMHOMO", ProtCidSettings.protcidDbConnection);
                ProtCidSettings.progressInfo.progStrQueue.Enqueue("Done!");
                ProtCidSettings.progressInfo.currentOperationIndex++;
                break;

            case 6:
                // compare entry interfaces in entry groups
                ProtCidSettings.logWriter.WriteLine("6. Calculate similarity Q scores in a entry-grouped group");
                ProtCidSettings.progressInfo.progStrQueue.Enqueue("6. Calculate similarity Q scores in a entry-grouped group");
                HomoGroupInterfacesFinder.modifyType = "build";
                HomoGroupInterfacesFinder groupInterfaceFinder = new HomoGroupInterfacesFinder();
                groupInterfaceFinder.DetectHomoGroupInterfaces(null);
                ProtCidSettings.progressInfo.progStrQueue.Enqueue("Done!");
                ProtCidSettings.progressInfo.progStrQueue.Enqueue("Recomputing indices.");
                DbBuilderHelper.UpdateIndexes("INTERFACE", ProtCidSettings.protcidDbConnection);
                ProtCidSettings.progressInfo.progStrQueue.Enqueue("Done!");
                ProtCidSettings.progressInfo.currentOperationIndex++;
                break;

            case 7:
                // group crystal forms based on Q scores of entry interfaces in an entry group
                ProtCidSettings.logWriter.WriteLine("7. Detecting redundant crystal forms");
                ProtCidSettings.progressInfo.progStrQueue.Enqueue("6. Detecting redundant crystal forms");
                RedundantCrystForms reduntCrystForm = new RedundantCrystForms();
                reduntCrystForm.CheckReduntCrystForms();
                ProtCidSettings.progressInfo.progStrQueue.Enqueue("Done!");
                ProtCidSettings.progressInfo.currentOperationIndex++;
                // distinct crystal forms
                ProtCidSettings.logWriter.WriteLine("8. Cluster crystal forms in entry groups");
                ProtCidSettings.progressInfo.progStrQueue.Enqueue("Non-Redundant Crystal Forms");
                NonredundantCfGroups nonreduntCfGroups = new NonredundantCfGroups();
                nonreduntCfGroups.UpdateCfGroupInfo();

                ProtCidSettings.progressInfo.progStrQueue.Enqueue("Done!");
                ProtCidSettings.progressInfo.progStrQueue.Enqueue("Recomputing indices.");
                DbBuilderHelper.UpdateIndexes("REDUN", ProtCidSettings.protcidDbConnection);
                break;

            default:
                break;
            }
            ProtCidSettings.progressInfo.progStrQueue.Enqueue("Build entry-based groups Done!");
            ProtCidSettings.logWriter.WriteLine("Build entry-based groups Done!");
            ProtCidSettings.logWriter.Flush();
        }