/// <summary> /// get the cryst interfaces from the cryst interface files /// </summary> /// <param name="pdbId"></param> /// <param name="pqsBuId"></param> public InterfaceChains[] GetInterfacesFromFiles(string pdbId, string type) { string searchMode = pdbId + "*." + type + ".gz"; string filePath = ProtCidSettings.dirSettings.interfaceFilePath + "\\" + type + "\\" + pdbId.Substring(1, 2); List <InterfaceChains> interfaceList = new List <InterfaceChains>(); if (Directory.Exists(filePath)) { string[] interfaceFiles = Directory.GetFiles(filePath, searchMode); for (int i = 0; i < interfaceFiles.Length; i++) { InterfaceChains crystInterface = new InterfaceChains(); string interfaceFile = ParseHelper.UnZipFile(interfaceFiles[i], ProtCidSettings.tempDir); ReadInterfaceFromFile(interfaceFile, ref crystInterface, "ALL"); File.Delete(interfaceFile); if (crystInterface.GetInterfaceResidueDist()) { interfaceList.Add(crystInterface); } } } return(interfaceList.ToArray()); }
/// <summary> /// /// </summary> /// <param name="buInterfaceDefTable"></param> /// <param name="biolUnitHash"></param> /// <returns></returns> private InterfaceChains[] GetEntryBiolUnitInterfaces(DataTable buInterfaceDefTable, Dictionary <string, AtomInfo[]> biolUnitHash, string buType) { string chainSymOpString1 = ""; string chainSymOpString2 = ""; List <InterfaceChains> buInterfaceList = new List <InterfaceChains> (); foreach (DataRow interfaceDefRow in buInterfaceDefTable.Rows) { if (buType == "pqs") // use PQS chains { chainSymOpString1 = interfaceDefRow["Chain1"].ToString().TrimEnd(); chainSymOpString2 = interfaceDefRow["Chain2"].ToString().TrimEnd(); } else { chainSymOpString1 = interfaceDefRow["Chain1"].ToString().TrimEnd() + "_" + interfaceDefRow["SymmetryString1"].ToString().TrimEnd(); chainSymOpString2 = interfaceDefRow["Chain2"].ToString().TrimEnd() + "_" + interfaceDefRow["SymmetryString2"].ToString().TrimEnd(); } if (biolUnitHash.ContainsKey(chainSymOpString1) && biolUnitHash.ContainsKey(chainSymOpString2)) { InterfaceChains buInterface = new InterfaceChains(); buInterface.firstSymOpString = chainSymOpString1; buInterface.secondSymOpString = chainSymOpString2; buInterface.interfaceId = Convert.ToInt32(interfaceDefRow["InterfaceID"].ToString()); buInterface.pdbId = interfaceDefRow["PdbID"].ToString(); buInterface.chain1 = (AtomInfo[])biolUnitHash[chainSymOpString1]; buInterface.chain2 = (AtomInfo[])biolUnitHash[chainSymOpString2]; buInterface.GetInterfaceResidueDist(); buInterfaceList.Add(buInterface); } } return(buInterfaceList.ToArray()); }
/// <summary> /// /// </summary> /// <param name="srcDir"></param> /// <param name="pdbId"></param> /// <param name="interfaceIds"></param> /// <param name="type"></param> /// <returns></returns> public InterfaceChains[] GetInterfacesFromFiles(string srcDir, string pdbId, int[] interfaceIds, string type) { List <InterfaceChains> interfaceList = new List <InterfaceChains> (); if (Directory.Exists(srcDir)) { foreach (int interfaceId in interfaceIds) { string searchMode = pdbId + "_" + interfaceId.ToString() + "." + type + ".gz"; string[] interfaceFiles = Directory.GetFiles(srcDir, searchMode); if (interfaceFiles.Length > 0) { InterfaceChains crystInterface = new InterfaceChains(); crystInterface.pdbId = pdbId; string interfaceFile = ParseHelper.UnZipFile(interfaceFiles[0], ProtCidSettings.tempDir); ReadInterfaceFromFile(interfaceFile, ref crystInterface, "ALL"); File.Delete(interfaceFile); if (crystInterface.GetInterfaceResidueDist()) { interfaceList.Add(crystInterface); } } } } return(interfaceList.ToArray()); }
/// <summary> /// for h**o-dimer with sequence identity of two monomers > 95% /// </summary> /// <param name="inInterface">an interface with two homologous chains, with sequence identity >= 95%</param> /// <returns></returns> public double CalculateHomoInterfaceSymmetry(InterfaceChains inInterface, CrcSeqAlignInfo seqAlignInfo) { if (inInterface.seqDistHash == null) { inInterface.GetInterfaceResidueDist(); } List <string>[] seqIdPairLists = GetSeqIdPairLists(inInterface.seqDistHash, seqAlignInfo); List <string> totalSeqPairList = new List <string>(seqIdPairLists[0]); List <string> sameSeqPairList = new List <string>(); foreach (string seqPair in seqIdPairLists[0]) { if (seqIdPairLists[1].Contains(seqPair)) { sameSeqPairList.Add(seqPair); } } foreach (string seqPair in seqIdPairLists[1]) { if (!totalSeqPairList.Contains(seqPair)) { totalSeqPairList.Add(seqPair); } } double jIndex = (double)sameSeqPairList.Count / (double)totalSeqPairList.Count; return(jIndex); }
/// <summary> /// get the cryst interfaces from the cryst interface files /// </summary> /// <param name="pdbId"></param> /// <param name="pqsBuId"></param> public Dictionary <string, List <InterfaceChains> > GetBuInterfacesFromFiles(string pdbId, string type) { Dictionary <string, List <InterfaceChains> > buInterfacesListHash = new Dictionary <string, List <InterfaceChains> >(); string searchMode = pdbId + "*." + type + ".gz"; string fileDir = ProtCidSettings.dirSettings.interfaceFilePath + "\\" + type + "\\" + pdbId.Substring(1, 2); if (Directory.Exists(fileDir)) { string[] interfaceFiles = Directory.GetFiles(fileDir, searchMode); string buId = ""; string justFileName = ""; // InterfaceReader interfaceReader = new InterfaceReader (); foreach (string interfaceFile in interfaceFiles) { justFileName = interfaceFile.Substring(interfaceFile.LastIndexOf("\\") + 1, interfaceFile.Length - interfaceFile.LastIndexOf("\\") - 1); buId = justFileName.Substring(4, justFileName.IndexOf("_") - 4); string unzippedInterfaceFile = ParseHelper.UnZipFile(interfaceFile, ProtCidSettings.tempDir); InterfaceChains thisInterface = new InterfaceChains(); ReadBuInterfaceFromFile(unzippedInterfaceFile, ref thisInterface, "ALL"); File.Delete(unzippedInterfaceFile); if (type == "pqs") { ConvertPqsResidueNumToPdb(pdbId, ref thisInterface); } if (thisInterface.GetInterfaceResidueDist()) { if (buInterfacesListHash.ContainsKey(buId)) { buInterfacesListHash[buId].Add(thisInterface); } else { List <InterfaceChains> interfaceList = new List <InterfaceChains>(); interfaceList.Add(thisInterface); buInterfacesListHash.Add(buId, interfaceList); } } } } return(buInterfacesListHash); }
/// <summary> /// get the cryst interfaces from the cryst interface files /// </summary> /// <param name="pdbId"></param> /// <param name="pqsBuId"></param> public InterfaceChains[] GetBuInterfacesFromFiles(string pdbId, string buId, string type) { List <InterfaceChains> interfaceList = new List <InterfaceChains> (); string searchMode = pdbId + buId + "*." + type + ".gz"; string fileDir = ProtCidSettings.dirSettings.interfaceFilePath + "\\" + type + "\\" + pdbId.Substring(1, 2); if (Directory.Exists(fileDir)) { string[] interfaceFiles = Directory.GetFiles(fileDir, searchMode); foreach (string interfaceFile in interfaceFiles) { try { InterfaceChains thisInterface = new InterfaceChains(); string decompInterfaceFile = ParseHelper.UnZipFile(interfaceFile, ProtCidSettings.tempDir); ReadBuInterfaceFromFile(decompInterfaceFile, ref thisInterface, "ALL"); File.Delete(decompInterfaceFile); if (type == "pqs") { string asymChain1 = thisInterface.firstSymOpString.Substring(0, thisInterface.firstSymOpString.IndexOf("_")); string asymChain2 = thisInterface.secondSymOpString.Substring(0, thisInterface.secondSymOpString.IndexOf("_")); if (asymChain1 == "-" || asymChain2 == "-") { continue; } ConvertPqsResidueNumToPdb(pdbId, ref thisInterface); } if (thisInterface.GetInterfaceResidueDist()) { interfaceList.Add(thisInterface); } } catch (Exception ex) { ProtCidSettings.progressInfo.progStrQueue.Enqueue ("Errors in retrieving interfaces from " + interfaceFile + ": " + ex.Message); } } } return(interfaceList.ToArray()); }
/// <summary> /// for h**o-dimer with sequence identity of two monomers > 95% /// </summary> /// <param name="inInterface">an interface with two homologous chains, with sequence identity >= 95%</param> /// <returns></returns> public double CalculateHomoInterfaceSymmetry(InterfaceChains inInterface) { if (inInterface.seqDistHash == null) { inInterface.GetInterfaceResidueDist(); } List <string> seqIdPairListA = new List <string>(); List <string> seqIdPairListB = new List <string>(); foreach (string seqIdPair in inInterface.seqDistHash.Keys) { seqIdPairListA.Add(seqIdPair); string[] seqIds = seqIdPair.Split('_'); seqIdPairListB.Add(seqIds[1] + "_" + seqIds[0]); } List <string> totalSeqPairList = new List <string>(seqIdPairListA); List <string> sameSeqPairList = new List <string>(); foreach (string seqPair in seqIdPairListA) { if (seqIdPairListB.Contains(seqPair)) { sameSeqPairList.Add(seqPair); } } foreach (string seqPair in seqIdPairListB) { if (!totalSeqPairList.Contains(seqPair)) { totalSeqPairList.Add(seqPair); } } double jIndex = (double)sameSeqPairList.Count / (double)totalSeqPairList.Count; return(jIndex); }