Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="pdbList"></param>
        /// <param name="userGroupName"></param>
        public void FindCommonInterfaceInGroup(string[] pdbList, string userGroupName)
        {
            Initialize();

            ProtCidSettings.progressInfo.Reset();
            int groupId = 111111;

            int[] updateGroups = new int [1];
            updateGroups[0] = groupId;

            ClearPreviousUserData(groupId);

            ProtCidSettings.progressInfo.progStrQueue.Enqueue("1. Classify PDB entries into homologous groups");
            HomoEntryClassifier entryClassifier = new HomoEntryClassifier(groupId);

            entryClassifier.ClassifyHomoEntries(pdbList, userGroupName);
            ProtCidSettings.progressInfo.currentOperationIndex++;

            ProtCidSettings.progressInfo.progStrQueue.Enqueue("2. Build crystal, detect common interfaces in a group");
            HomoGroupInterfacesFinder interfaceFinder = new HomoGroupInterfacesFinder();

            HomoGroupInterfacesFinder.modifyType = "update";
            interfaceFinder.DetectHomoGroupInterfaces(updateGroups);
            ProtCidSettings.progressInfo.currentOperationIndex++;

            ProtCidSettings.progressInfo.progStrQueue.Enqueue("3. Generate interface files, calculate ASA in interfaces");
            CrystInterfaceProcessor interfaceProcessor = new CrystInterfaceProcessor();

            interfaceProcessor.GenerateEntryInterfaceFiles(pdbList);
            ProtCidSettings.progressInfo.currentOperationIndex++;

            ProtCidSettings.progressInfo.progStrQueue.Enqueue("4. Compare cryst interfaces with PDB/PISA BUs and ASU Interfaces");
            EntryCrystBuInterfaceComp buInterfaceComp = new EntryCrystBuInterfaceComp();

            buInterfaceComp.CompareEntryCrystBuInterfaces(pdbList);
            ProtCidSettings.progressInfo.currentOperationIndex++;

            ProtCidSettings.progressInfo.progStrQueue.Enqueue("5. Deal With Redundant Crystal Forms.");
            RedundantCrystForms reduntCf = new RedundantCrystForms();

            reduntCf.UpdateReduntCrystForms(updateGroups);
            NonredundantCfGroups nonreduntCfGroups = new NonredundantCfGroups();

            nonreduntCfGroups.UpdateCfGroupInfo(updateGroups);
            ProtCidSettings.progressInfo.currentOperationIndex++;

            ProtCidSettings.progressInfo.progStrQueue.Enqueue("6. Cluster cryst common interfaces");
            InterfaceCluster interfaceCluster = new InterfaceCluster();

            interfaceCluster.UpdateInterfaceClusters(updateGroups);
            ProtCidSettings.progressInfo.currentOperationIndex++;

            ProtCidSettings.progressInfo.progStrQueue.Enqueue("7. Print cryst common interfaces");
            ClusterStat clusterStat = new ClusterStat();

            clusterStat.PrintCrystInterfaceClusters(groupId, ProtCidSettings.dataType);

            ProtCidSettings.progressInfo.threadFinished = true;
        }
Exemple #2
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++;
        }
Exemple #3
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();
        }