/// <summary> /// /// </summary> /// <param name="domainRow"></param> /// <param name="pfamCode1"></param> /// <param name="pfamCode2"></param> /// <param name="chainInterfaces"></param> /// <returns></returns> private DomainInterface GetInterChainDomainInterface(DataRow domainInterfaceRow, string pfamCode1, string pfamCode2, InterfaceChains[] chainInterfaces) { string pdbId = domainInterfaceRow["PdbID"].ToString(); DomainInterface domainInterface = new DomainInterface(); int domainInterfaceId = Convert.ToInt32(domainInterfaceRow["DomainInterfaceID"].ToString()); string interfacePfam1 = ""; string interfacePfam2 = ""; Range[] domainRanges1 = GetDomainRange(pdbId, Convert.ToInt64(domainInterfaceRow["DomainID1"].ToString()), out interfacePfam1); Range[] domainRanges2 = GetDomainRange(pdbId, Convert.ToInt64(domainInterfaceRow["DomainID2"].ToString()), out interfacePfam2); int chainInterfaceId = Convert.ToInt32(domainInterfaceRow["InterfaceID"].ToString()); if (chainInterfaceId > 0) // inter-chain domain interface { InterfaceChains chainInterface = GetChainInterface(chainInterfaces, chainInterfaceId); if (chainInterface != null) { domainInterface = GetDomainInterface(chainInterface, domainRanges1, domainRanges2); } } if (domainInterface != null) { /* if (domainInterfaceRow["IsReversed"].ToString() == "1") * { * domainInterface.familyCode1 = pfamCode2; * domainInterface.familyCode2 = pfamCode1; * } * else * { * domainInterface.familyCode1 = pfamCode1; * domainInterface.familyCode2 = pfamCode2; * }*/ domainInterface.domainInterfaceId = domainInterfaceId; domainInterface.pdbId = pdbId; domainInterface.interfaceId = chainInterfaceId; domainInterface.domainId1 = Convert.ToInt64(domainInterfaceRow["DomainID1"].ToString()); domainInterface.domainId2 = Convert.ToInt64(domainInterfaceRow["DomainID2"].ToString()); domainInterface.familyCode1 = interfacePfam1; domainInterface.familyCode2 = interfacePfam2; // if the domain interface chain order is different from the pfam ids defined for the relation // then reverse the interface chains if (interfacePfam1 == pfamCode2 && interfacePfam2 == pfamCode1) { domainInterface.Reverse(); } } return(domainInterface); }
/// <summary> /// /// </summary> /// <param name="pdbId"></param> /// <param name="relSeqId"></param> /// <param name="type"></param> /// <returns></returns> public DomainInterface[] GetInterChainDomainInterfaces(string pdbId, int relSeqId, string type) { string queryString = string.Format("Select * From {0}DomainInterfaces " + " Where RelSeqID = {1} AND PdbID = '{2}' AND InterfaceID > 0;", ProtCidSettings.dataType, relSeqId, pdbId); DataTable domainInterfaceTable = ProtCidSettings.protcidQuery.Query(queryString); queryString = string.Format("Select * From {0}DomainFamilyRelation Where RelSeqId = {1};", ProtCidSettings.dataType, relSeqId); DataTable domainSeqIdTable = ProtCidSettings.protcidQuery.Query(queryString); string family1 = domainSeqIdTable.Rows[0]["FamilyCode1"].ToString().Trim(); string family2 = domainSeqIdTable.Rows[0]["FamilyCode2"].ToString().Trim(); int[] chainInterfaceIds = GetInterChainInterfaceIDs(relSeqId, pdbId); InterfaceChains[] chainInterfaces = GetCrystInterfaces(pdbId, chainInterfaceIds, type); List <DomainInterface> domainInterfaceList = new List <DomainInterface> (); Range[] domainRanges1 = null; Range[] domainRanges2 = null; int chainInterfaceId = -1; int domainInterfaceId = -1; string interfacePfam1 = ""; string interfacePfam2 = ""; bool isReversedChains = false; foreach (DataRow domainRow in domainInterfaceTable.Rows) { isReversedChains = false; DomainInterface domainInterface = new DomainInterface(); domainInterfaceId = Convert.ToInt32(domainRow["DomainInterfaceID"].ToString()); domainRanges1 = GetDomainRange(pdbId, Convert.ToInt64(domainRow["DomainID1"].ToString()), out interfacePfam1); domainRanges2 = GetDomainRange(pdbId, Convert.ToInt64(domainRow["DomainID2"].ToString()), out interfacePfam2); chainInterfaceId = Convert.ToInt32(domainRow["InterfaceID"].ToString()); InterfaceChains chainInterface = GetChainInterface(chainInterfaces, chainInterfaceId); if (chainInterface == null) { continue; } // domain interface chains are in the different order of the corresponding chain interface chains if (domainRow["IsReversed"].ToString() == "1") { isReversedChains = true; domainInterface = GetDomainInterface(chainInterface, domainRanges2, domainRanges1, isReversedChains); } else { domainInterface = GetDomainInterface(chainInterface, domainRanges1, domainRanges2); } domainInterface.domainInterfaceId = domainInterfaceId; domainInterface.pdbId = pdbId; domainInterface.interfaceId = chainInterfaceId; domainInterface.domainId1 = Convert.ToInt64(domainRow["DomainID1"].ToString()); domainInterface.domainId2 = Convert.ToInt64(domainRow["DomainID2"].ToString()); domainInterface.familyCode1 = interfacePfam1; domainInterface.familyCode2 = interfacePfam2; if (family2 != family1 && interfacePfam1 == family2 && interfacePfam2 == family1) { domainInterface.Reverse(); } domainInterfaceList.Add(domainInterface); } return(domainInterfaceList.ToArray()); }