Пример #1
0
 /// <summary>
 /// the domain list for all interactions in one entry interfaces
 /// </summary>
 /// <param name="domainInterfaces"></param>
 /// <param name="familyDomainHash"></param>
 public void GetFamilyDomainHash(DomainInterface domainInterface, ref Dictionary <string, List <long> > familyDomainHash)
 {
     if (familyDomainHash.ContainsKey(domainInterface.familyCode1))
     {
         if (!familyDomainHash[domainInterface.familyCode1].Contains(domainInterface.domainId1))
         {
             familyDomainHash[domainInterface.familyCode1].Add(domainInterface.domainId1);
         }
     }
     else
     {
         List <long> domainList = new List <long> ();
         domainList.Add(domainInterface.domainId1);
         familyDomainHash.Add(domainInterface.familyCode1, domainList);
     }
     if (familyDomainHash.ContainsKey(domainInterface.familyCode2))
     {
         if (!familyDomainHash[domainInterface.familyCode2].Contains(domainInterface.domainId2))
         {
             familyDomainHash[domainInterface.familyCode2].Add(domainInterface.domainId2);
         }
     }
     else
     {
         List <long> domainList = new List <long> ();
         domainList.Add(domainInterface.domainId2);
         familyDomainHash.Add(domainInterface.familyCode2, domainList);
     }
 }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="extDomainInterface"></param>
        /// <param name="deepCopy"></param>
        public DomainInterface(DomainInterface extDomainInterface, bool deepCopy)
        {
            this.domainId1         = extDomainInterface.domainId1;
            this.domainId2         = extDomainInterface.domainId2;
            this.domainInterfaceId = extDomainInterface.domainInterfaceId;
            this.familyCode1       = extDomainInterface.familyCode1;
            this.familyCode2       = extDomainInterface.familyCode2;
            this.remark            = extDomainInterface.remark;

            this.interfaceId       = extDomainInterface.interfaceId;
            this.firstSymOpString  = extDomainInterface.firstSymOpString;
            this.secondSymOpString = extDomainInterface.secondSymOpString;
            this.entityId1         = extDomainInterface.entityId1;
            this.entityId2         = extDomainInterface.entityId2;

            if (deepCopy)
            {
                DeepCopyChains(extDomainInterface.chain1, 1);
                DeepCopyChains(extDomainInterface.chain2, 2);
                DeepCopySeqDistHash(extDomainInterface.seqDistHash);
                DeepCopySeqContactHash(extDomainInterface.seqContactHash);
            }
            else
            {
                this.chain1         = (AtomInfo[])extDomainInterface.chain1.Clone();
                this.chain2         = (AtomInfo[])extDomainInterface.chain2.Clone();
                this.seqDistHash    = new Dictionary <string, double>(extDomainInterface.seqDistHash);
                this.seqContactHash = new Dictionary <string, Contact>(extDomainInterface.seqContactHash);
            }
        }
Пример #3
0
        /// <summary>
        /// compare two domain interfaces
        /// </summary>
        /// <param name="domainInterface1"></param>
        /// <param name="domainInterface2"></param>
        /// <returns></returns>
        public DomainInterfacePairInfo CompareEntryDomainInterfaces(DomainInterface domainInterface1,
                                                                    DomainInterface domainInterface2)
        {
            double qScore            = qFunc.WeightQFunc(domainInterface1, domainInterface2);
            bool   interfaceReversed = false;

            if (qScore < AppSettings.parameters.simInteractParam.interfaceSimCutoff &&
                domainInterface1.familyCode1 == domainInterface2.familyCode2)
            {
                domainInterface2.Reverse();
                double reversedQScore = qFunc.WeightQFunc(domainInterface1, domainInterface2);
                if (qScore < reversedQScore)
                {
                    qScore            = reversedQScore;
                    interfaceReversed = true;
                }
                else
                {
                    domainInterface2.Reverse();
                }
            }

            DomainInterfacePairInfo interfacePairInfo = new DomainInterfacePairInfo
                                                            (new DomainInterfaceInfo(domainInterface1), new DomainInterfaceInfo(domainInterface2));

            interfacePairInfo.qScore = qScore;
            interfacePairInfo.isInterface2Reversed = interfaceReversed;
            return(interfacePairInfo);
        }
Пример #4
0
        /// <summary>
        /// superpose domain interfaces
        /// </summary>
        /// <param name="domainInterface1"></param>
        /// <param name="domainInterface2"></param>
        /// <param name="alignInfoTable"></param>
        public double SuperposeDomainInterfaces(DomainInterface domainInterface1, DomainInterface domainInterface2, DataTable alignInfoTable)
        {
            long   domainID11 = domainInterface1.domainId1;
            long   domainID12 = domainInterface1.domainId2;
            long   domainID21 = domainInterface2.domainId1;
            long   domainID22 = domainInterface2.domainId2;
            double identity1  = 100;
            double identity2  = 100;

            DataRow alignRow1 = null;
            DataRow alignRow2 = null;

            if (domainID11 != domainID21)
            {
                alignRow1 = GetAlignRow(domainID11, domainID21, alignInfoTable);
                if (alignRow1 != null)
                {
                    SuperposeChain(domainInterface2.chain1, alignRow1);
                    identity1 = Convert.ToDouble(alignRow1["Identity"].ToString());
                }
            }

            if (domainID12 != domainID22)
            {
                alignRow2 = GetAlignRow(domainID12, domainID22, alignInfoTable);
                if (alignRow2 != null)
                {
                    SuperposeChain(domainInterface2.chain2, alignRow2);
                    identity2 = Convert.ToDouble(alignRow2["Identity"].ToString());
                }
            }
            if (alignRow1 != null && alignRow2 != null)
            {
                domainInterface2.seqDistHash = SuperposeInterface(domainInterface2.seqDistHash, alignRow1, alignRow2);
                domainInterface2.ResetSeqResidueHash();
            }

            if (identity1 < 0)
            {
                identity1 = 0;
            }
            if (identity2 < 0)
            {
                identity2 = 0;
            }
            if (identity1 > 0 && identity2 > 0)
            {
                return(Math.Sqrt(identity1 * identity2));
            }
            else if (identity1 > 0)
            {
                return(identity1);
            }
            else if (identity2 > 0)
            {
                return(identity2);
            }
            return(-1.0);
        }
Пример #5
0
        /// <summary>
        /// the domain list for each family in the interaction
        /// </summary>
        /// <param name="domainInterfaces1"></param>
        /// <param name="domainInterfaces2"></param>
        /// <returns></returns>
        public Dictionary <string, long[]> GetFamilyDomainHash(DomainInterface domainInterface1, DomainInterface domainInterface2)
        {
            DomainInterface[] domainInterfaces = new DomainInterface[2];
            domainInterfaces[0] = domainInterface1;
            domainInterfaces[1] = domainInterface2;
            Dictionary <string, long[]> familyDomainsHash = GetFamilyDomainHash(domainInterfaces);

            return(familyDomainsHash);
        }
Пример #6
0
 public DomainInterfaceInfo(DomainInterface domainInterface)
 {
     this.pdbId             = domainInterface.pdbId;
     this.interfaceId       = domainInterface.interfaceId;
     this.firstSymOpString  = domainInterface.firstSymOpString;
     this.secondSymOpString = domainInterface.secondSymOpString;
     this.entityId1         = domainInterface.entityId1;
     this.entityId2         = domainInterface.entityId2;
     this.domainID1         = domainInterface.domainId1;
     this.domainID2         = domainInterface.domainId2;
     this.domainInterfaceId = domainInterface.domainInterfaceId;
 }
Пример #7
0
        /// <summary>
        /// same domain interfaces means two domain interfaces with same domain id components
        /// and Q score >= unique interface q score which is defined to 0.90
        /// </summary>
        /// <param name="domainInterface1"></param>
        /// <param name="domainInterface2"></param>
        /// <returns></returns>
        public bool AreSameDomainInterfaces(DomainInterface domainInterface1, DomainInterface domainInterface2)
        {
            DomainInterfacePairInfo pairInfo =
                CompareEntryDomainInterfaces(domainInterface1, domainInterface2);

            if (pairInfo.qScore >= AppSettings.parameters.simInteractParam.uniqueInterfaceCutoff &&
                AreDomainInterfacesSameDomainIds(domainInterface1, domainInterface2))
            {
                return(true);
            }
            return(false);
        }
Пример #8
0
 /// <summary>
 /// check if two domain interfaces with same asymmetric chain component or domain definition components
 /// e.g domain interface 1: A_1_555 C_1_555
 /// domain interface 2: A_1_555 C_4_555 or C_4_555  A_1_555
 /// have same pfam domain definition, if domain interfaces are same, only keep one
 /// </summary>
 /// <param name="domainInterface1"></param>
 /// <param name="domainInterface2"></param>
 /// <returns></returns>
 public bool AreDomainInterfacesSameDomainIds(DomainInterface domainInterface1, DomainInterface domainInterface2)
 {
     if (domainInterface1.domainId1 == domainInterface2.domainId1 &&
         domainInterface1.domainId2 == domainInterface2.domainId2)
     {
         return(true);
     }
     else if (domainInterface1.domainId1 == domainInterface2.domainId2 &&
              domainInterface1.domainId2 == domainInterface2.domainId1)
     {
         return(true);
     }
     return(false);
 }
Пример #9
0
        /// <summary>
        /// compare two domain interfaces
        /// </summary>
        /// <param name="domainInterfaces1"></param>
        /// <param name="domainInterfaces2"></param>
        public DomainInterfacePairInfo CompareDomainInterfaces(DomainInterface domainInterface1, DomainInterface domainInterface2)
        {
            Dictionary <string, long[]> familyDomainHash = GetFamilyDomainHash(domainInterface1, domainInterface2);
            DataTable domainAlignmentTable = GetDomainAlignmentTable(familyDomainHash);

            /*    if (domainAlignInfoTable == null || domainAlignInfoTable.Rows.Count == 0)
             *  {
             *      return null;
             *  }*/
            DomainInterfacePairInfo compInfo =
                CompareTwoDomainInterfaces(domainInterface1, domainInterface2, domainAlignmentTable);

            domainAlignmentTable.Clear();

            return(compInfo);
        }
Пример #10
0
        /// <summary>
        /// compare two domain interfaces
        /// </summary>
        /// <param name="domainInterface1"></param>
        /// <param name="domainInterface2"></param>
        /// <param name="domainAlignInfoTable"></param>
        /// <returns></returns>
        public DomainInterfacePairInfo CompareTwoDomainInterfaces(DomainInterface domainInterface1,
                                                                  DomainInterface domainInterface2, DataTable domainAlignInfoTable)
        {
            DomainInterface domainInterface2Copy = new DomainInterface(domainInterface2, true); // keep a deep copy
            double          identity             = supDomainInterface.SuperposeDomainInterfaces(domainInterface1, domainInterface2Copy, domainAlignInfoTable);
            double          qScore = qFunc.WeightQFunc(domainInterface1, domainInterface2Copy);
            //    domainInterface2 = domainInterface2Copy; // shadow copy
            //      supDomainInterface.ReverseSupDomainInterfaces(domainInterface1, domainInterface2, domainAlignInfoTable);

            bool interfaceReversed = false;

            if (qScore < AppSettings.parameters.simInteractParam.interfaceSimCutoff &&
                domainInterface1.familyCode1 == domainInterface2.familyCode2)
            {
                domainInterface2Copy = new DomainInterface(domainInterface2, true);

                domainInterface2Copy.Reverse();
                // keep deep copy
                double reversedIdentity =
                    supDomainInterface.SuperposeDomainInterfaces(domainInterface1, domainInterface2Copy, domainAlignInfoTable);
                double reversedQScore = qFunc.WeightQFunc(domainInterface1, domainInterface2Copy);
                //        domainInterface2 = domainInterface2Copy;
                //        supDomainInterface.ReverseSupDomainInterfaces(domainInterface1, domainInterface2, domainAlignInfoTable);
                if (qScore < reversedQScore)
                {
                    qScore            = reversedQScore;
                    identity          = reversedIdentity;
                    interfaceReversed = true;
                }
            }

            DomainInterfacePairInfo interfacePairInfo = new DomainInterfacePairInfo
                                                            (new DomainInterfaceInfo(domainInterface1), new DomainInterfaceInfo(domainInterface2));

            interfacePairInfo.qScore = qScore;
            if (identity <= 0)
            {
                interfacePairInfo.identity = -1.0;
            }
            else
            {
                interfacePairInfo.identity = identity;
            }
            interfacePairInfo.isInterface2Reversed = interfaceReversed;

            return(interfacePairInfo);
        }
Пример #11
0
 /// <summary>
 /// interface alignments exist in the input datatable
 /// </summary>
 /// <param name="dinterface1"></param>
 /// <param name="dinterface2"></param>
 /// <param name="alignInfoTable"></param>
 /// <returns></returns>
 public bool IsDomainInterfaceAlignmentExist(DomainInterface dinterface1, DomainInterface dinterface2, DataTable alignInfoTable)
 {
     if ((dinterface1.domainId1 == dinterface2.domainId1 && dinterface1.domainId2 == dinterface2.domainId2) ||
         (dinterface1.domainId1 == dinterface2.domainId2 && dinterface1.domainId2 == dinterface2.domainId1))
     {
         return(true);
     }
     if (IsDomainAlignmentExist(dinterface1.domainId1, dinterface2.domainId1, alignInfoTable) &&
         IsDomainAlignmentExist(dinterface1.domainId2, dinterface2.domainId2, alignInfoTable))
     {
         return(true);
     }
     else if (IsDomainAlignmentExist(dinterface1.domainId2, dinterface2.domainId1, alignInfoTable) &&
              IsDomainAlignmentExist(dinterface1.domainId1, dinterface2.domainId2, alignInfoTable))
     {
         return(true);
     }
     return(false);
 }
Пример #12
0
        /// <summary>
        /// reverse the superposed interfaces
        /// </summary>
        /// <param name="domainInterface1"></param>
        /// <param name="domainInterface2"></param>
        /// <param name="alignInfoTable"></param>
        public void ReverseSupDomainInterfaces(DomainInterface domainInterface1,
                                               DomainInterface domainInterface2, DataTable alignInfoTable)
        {
            long domainID11 = domainInterface1.domainId1;
            long domainID12 = domainInterface1.domainId2;
            long domainID21 = domainInterface2.domainId1;
            long domainID22 = domainInterface2.domainId2;

            DataRow alignRow1 = GetAlignRow(domainID11, domainID21, alignInfoTable);

            ReverseSupChain(domainInterface2.chain1, alignRow1);

            DataRow alignRow2 = GetAlignRow(domainID12, domainID22, alignInfoTable);

            ReverseSupChain(domainInterface2.chain2, alignRow2);

            domainInterface2.seqDistHash = ReverseSupInterface(domainInterface2.seqDistHash, alignRow1, alignRow2);
            domainInterface2.ResetSeqResidueHash();
        }