Пример #1
0
        /// <summary>
        /// check the representative interfaces exist in the NMR group
        /// </summary>
        /// <param name="noCrystFileList"></param>
        /// <param name="groupId"></param>
        /// <returns></returns>
        public InterfaceChains[] GetNmrEntryInterfaces(string[] nmrPdbList)
        {
            asuInterfacesNonCryst = new AsuInterfaces();
            Dictionary <string, InterfaceChains[]> sgEntryInterfacesHash = new Dictionary <string, InterfaceChains[]> ();

            CrystInterfaceTables.InitializeTables();

            foreach (string pdbId in nmrPdbList)
            {
                string noCrystFile = Path.Combine(ProtCidSettings.dirSettings.coordXmlPath, pdbId + ".xml.gz");
                // unzip xml file
                if (!File.Exists(noCrystFile))
                {
                    ProtCidSettings.progressInfo.progStrQueue.Enqueue(string.Format("{0} file not exist. ", noCrystFile));
#if DEBUG
                    ProtCidSettings.logWriter.WriteLine(string.Format("{0} file not exist. ", noCrystFile));
#endif
                    continue;
                }
                try
                {
                    InterfaceChains[] asuInterfaces = null;
                    asuInterfaces = asuInterfacesNonCryst.GetAsuInterfacesFromXml(noCrystFile);
                    AddEntityIDsToInterfaces(pdbId, ref asuInterfaces);

                    if (asuInterfaces != null && asuInterfaces.Length > 0)
                    {
                        sgEntryInterfacesHash.Add(pdbId, asuInterfaces);
                        AssignEntryInterfacesToTable(asuInterfaces, pdbId, "NMR");
                    }
                }
                catch (Exception ex)
                {
                    ProtCidSettings.progressInfo.progStrQueue.Enqueue(ex.Message);
#if DEBUG
                    ProtCidSettings.logWriter.WriteLine(ex.Message);
#endif
                }
            }
            return(null);
        }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="pdbId"></param>
        /// <param name="isUpdate"></param>
        /// <returns></returns>
        public InterfaceChains[] FindUniquePfamInterfaces(string pdbId, bool isUpdate)
        {
            string spaceGroup = GetEntrySpaceGroup(pdbId);

            string xmlFile = Path.Combine(ProtCidSettings.dirSettings.coordXmlPath, pdbId + ".xml.gz");

            if (!Directory.Exists(ProtCidSettings.tempDir))
            {
                Directory.CreateDirectory(ProtCidSettings.tempDir);
            }
            string coordXmlFile = ParseHelper.UnZipFile(xmlFile, ProtCidSettings.tempDir);

            InterfaceChains[] entryInterfaces       = null;
            AsuInterfaces     asuInterfacesNonCryst = new AsuInterfaces();

            try
            {
                if (spaceGroup == "NMR")
                {
                    entryInterfaces = asuInterfacesNonCryst.GetAsuInterfacesFromXml(coordXmlFile);
                    if (entryInterfaces == null)
                    {
                        ProtCidSettings.progressInfo.progStrQueue.Enqueue("NMR entry " + pdbId + " is a monomer.");
#if DEBUG
                        ProtCidSettings.logWriter.WriteLine("NMR entry " + pdbId + " is a monomer.");
                        ProtCidSettings.logWriter.Flush();
#endif
                    }
                }
                else
                {
                    ContactInCrystal contactInCrystal = new ContactInCrystal();
                    int numOfChainsInUnitCell         = contactInCrystal.FindInteractChains(coordXmlFile);

                    if (numOfChainsInUnitCell > 64)
                    {
                        ProtCidSettings.progressInfo.progStrQueue.Enqueue("The number of chains of " + pdbId + " in a unit cell: " + numOfChainsInUnitCell.ToString());
#if DEBUG
                        ProtCidSettings.logWriter.WriteLine("The number of chains of " + pdbId + " in a unit cell: " + numOfChainsInUnitCell.ToString());
                        ProtCidSettings.logWriter.Flush();
#endif
                    }

                    if (contactInCrystal.InterfaceChainsList == null)
                    {
                        ProtCidSettings.progressInfo.progStrQueue.Enqueue("No interfaces exist in entry: " + pdbId);
                    }
                    entryInterfaces = contactInCrystal.InterfaceChainsList;
                }
            }
            catch (Exception ex)
            {
                ProtCidSettings.progressInfo.progStrQueue.Enqueue("Retrieving interfaces from " + pdbId + " errors: " + ex.Message);
#if DEBUG
                ProtCidSettings.logWriter.WriteLine("Retrieving interfaces from " + pdbId + " errors: " + ex.Message);
                ProtCidSettings.logWriter.Flush();
#endif
            }
            finally
            {
                if (File.Exists(coordXmlFile))
                {
                    File.Delete(coordXmlFile);
                }
            }
            return(entryInterfaces);
        }
Пример #3
0
        /// <summary>
        /// find unique interfaces in a crystal
        /// </summary>
        /// <param name="xmlFile"></param>
        /// <returns></returns>
        public void FindUniqueInterfaces(string repEntry, string[] pdbIdList)
        {
            CrystInterfaceTables.InitializeTables();
            asuInterfacesNonCryst = new AsuInterfaces();

            List <string> entryList = new List <string> (pdbIdList);

            entryList.Insert(0, repEntry);

            if (!Directory.Exists(ProtCidSettings.tempDir))
            {
                Directory.CreateDirectory(ProtCidSettings.tempDir);
            }
            ProtCidSettings.progressInfo.ResetCurrentProgressInfo();
            ProtCidSettings.progressInfo.currentOperationLabel = "Computing Interfaces.";
            ProtCidSettings.progressInfo.totalStepNum          = entryList.Count;
            ProtCidSettings.progressInfo.totalOperationNum     = entryList.Count;
            ProtCidSettings.progressInfo.progStrQueue.Enqueue("Computing interfaces from crystal structures.");

            Dictionary <string, InterfaceChains[]> entryInterfacesHash = new Dictionary <string, InterfaceChains[]> ();
            Dictionary <string, string>            entrySgHash         = GetEntrySgAsu(entryList);

            foreach (string pdbId in entryList)
            {
                ProtCidSettings.progressInfo.currentFileName = pdbId;
                ProtCidSettings.progressInfo.currentOperationNum++;
                ProtCidSettings.progressInfo.currentStepNum++;

                InterfaceChains[] entryInterfaces = null;
                string            xmlFile         = Path.Combine(ProtCidSettings.dirSettings.coordXmlPath, pdbId + ".xml.gz");
                string            coordXmlFile    = ParseHelper.UnZipFile(xmlFile, ProtCidSettings.tempDir);

                try
                {
                    if ((string)entrySgHash[pdbId] == "NMR")
                    {
                        entryInterfaces = asuInterfacesNonCryst.GetAsuInterfacesFromXml(coordXmlFile);
                    }
                    else
                    {
                        ContactInCrystal contactInCrystal = new ContactInCrystal();

                        int numOfChainsInUnitCell = contactInCrystal.FindInteractChains(coordXmlFile);

                        if (numOfChainsInUnitCell > 64)
                        {
                            ProtCidSettings.progressInfo.progStrQueue.Enqueue("The number of chains of " + pdbId + " in a unit cell: " + numOfChainsInUnitCell.ToString());
                        }

                        if (contactInCrystal.InterfaceChainsList == null)
                        {
                            continue;
                        }
                        entryInterfaces = contactInCrystal.InterfaceChainsList;
                    }
                    AssignEntryInterfacesToTable(entryInterfaces, pdbId, (string)entrySgHash[pdbId]);
                    entryInterfacesHash.Add(pdbId, entryInterfaces);

                    string deleteString = string.Format("Delete From CrystEntryInterfaces Where PdbID = '{0}'", pdbId);
                    ProtCidSettings.protcidQuery.Query(deleteString);

                    dbInsert.InsertDataIntoDBtables
                        (ProtCidSettings.protcidDbConnection, CrystInterfaceTables.crystInterfaceTables[CrystInterfaceTables.CrystEntryInterfaces]);
                    CrystInterfaceTables.crystInterfaceTables[CrystInterfaceTables.CrystEntryInterfaces].Clear();
                }
                catch (Exception ex)
                {
                    if (ex.Message.ToLower().IndexOf("no protein chains") < -1 &&
                        ex.Message.ToLower().IndexOf("no symmetry operators") < -1)
                    {
                        ProtCidSettings.progressInfo.progStrQueue.Enqueue(pdbId + ": " + ex.Message);
#if DEBUG
                        ProtCidSettings.logWriter.WriteLine(pdbId + ": " + ex.Message);
#endif
                    }
                }
                finally
                {
                    if (File.Exists(coordXmlFile))
                    {
                        File.Delete(coordXmlFile);
                    }
                }
            }
            Directory.Delete(ProtCidSettings.tempDir, true);
            // compare interfaces between representative entry and its homology entries
            // save data into db
            crystInterfaceComp.CompareRepHomoEntryInterfacesInGroup(repEntry, pdbIdList, entryInterfacesHash);

            ProtCidSettings.progressInfo.progStrQueue.Enqueue("Done!");
            ProtCidSettings.progressInfo.threadFinished = true;
        }
Пример #4
0
        /// <summary>
        /// find unique interfaces in a crystal
        /// </summary>
        /// <param name="xmlFile"></param>
        /// <returns></returns>
        public void FindUniqueInterfacesFromAsu(string[] pdbIdList)
        {
            CrystInterfaceTables.InitializeTables();

#if DEBUG
            StreamWriter interfaceDataWriter          = new StreamWriter("CrystEntryInterfaces.txt", true);
            StreamWriter entryInterfaceCompDataWriter = new StreamWriter("EntryInterfaceComp.txt", true);
            StreamWriter logWriter = new StreamWriter("EntryInterfaceRetrievalLog.txt", true);
#endif
            if (!Directory.Exists(ProtCidSettings.tempDir))
            {
                Directory.CreateDirectory(ProtCidSettings.tempDir);
            }
            ProtCidSettings.progressInfo.ResetCurrentProgressInfo();
            ProtCidSettings.progressInfo.currentOperationLabel = "Computing Interfaces.";
            ProtCidSettings.progressInfo.totalStepNum          = pdbIdList.Length;
            ProtCidSettings.progressInfo.totalOperationNum     = pdbIdList.Length;
            ProtCidSettings.progressInfo.progStrQueue.Enqueue("Computing interfaces from crystal structures.");

            //    Hashtable entrySgHash = GetEntrySgAsu(new ArrayList(pdbIdList));
            InterfaceChains[] entryInterfaces       = null;
            AsuInterfaces     asuInterfacesNonCryst = new AsuInterfaces();
            string            spaceGroup            = "";
            foreach (string pdbId in pdbIdList)
            {
                ProtCidSettings.progressInfo.currentFileName = pdbId;
                ProtCidSettings.progressInfo.currentOperationNum++;
                ProtCidSettings.progressInfo.currentStepNum++;

                spaceGroup = GetEntrySpaceGroup(pdbId);

                string xmlFile      = Path.Combine(ProtCidSettings.dirSettings.coordXmlPath, pdbId + ".xml.gz");
                string coordXmlFile = ParseHelper.UnZipFile(xmlFile, ProtCidSettings.tempDir);

                try
                {
                    entryInterfaces = asuInterfacesNonCryst.GetAsuInterfacesFromXml(coordXmlFile);
                    if (entryInterfaces == null)
                    {
                        ProtCidSettings.progressInfo.progStrQueue.Enqueue("Entry " + pdbId + " is a monomer.");
#if DEBUG
                        logWriter.WriteLine("Entry " + pdbId + " is a monomer.");
                        logWriter.Flush();
#endif
                        continue;
                    }
                    AssignEntryInterfacesToTable(entryInterfaces, pdbId, spaceGroup);
                    AssignEntryInterfaceCompToTable(pdbId, entryInterfaces);

                    dbInsert.InsertDataIntoDBtables
                        (ProtCidSettings.protcidDbConnection, CrystInterfaceTables.crystInterfaceTables[CrystInterfaceTables.CrystEntryInterfaces]);
                    dbInsert.InsertDataIntoDBtables
                        (ProtCidSettings.protcidDbConnection, CrystInterfaceTables.crystInterfaceTables[CrystInterfaceTables.EntryInterfaceComp]);
#if DEBUG
                    WriteDataToFiles(interfaceDataWriter, entryInterfaceCompDataWriter);
#endif

                    CrystInterfaceTables.crystInterfaceTables[CrystInterfaceTables.CrystEntryInterfaces].Clear();
                    CrystInterfaceTables.crystInterfaceTables[CrystInterfaceTables.EntryInterfaceComp].Clear();
                }
                catch (Exception ex)
                {
                    ProtCidSettings.progressInfo.progStrQueue.Enqueue("Retrieving interfaces from " + pdbId + " errors: " + ex.Message);
#if DEBUG
                    logWriter.WriteLine("Retrieving interfaces from " + pdbId + " errors: " + ex.Message);
                    logWriter.Flush();
#endif
                }
                finally
                {
                    if (File.Exists(coordXmlFile))
                    {
                        File.Delete(coordXmlFile);
                    }
                }
            }
            try
            {
                Directory.Delete(ProtCidSettings.tempDir, true);
            }
            catch { }

#if DEBUG
            interfaceDataWriter.Close();
            entryInterfaceCompDataWriter.Close();
            logWriter.Close();
#endif
            ProtCidSettings.progressInfo.progStrQueue.Enqueue("Done!");
            ProtCidSettings.progressInfo.threadFinished = true;
        }