예제 #1
0
        /*
         * Function:
         * 1. constant function
         * y = 1 if x > 0 and x <= 5;
         * 2. Gaussian distribution function
         * y = (area / (sigma * sqrt(PI / 2))) * exp(-2 * ((x - mean) / sigma)^2) if x > 5
         * */
        /// <summary>
        /// Q Score from KLD
        /// </summary>
        /// <param name="interface1"></param>
        /// <param name="interface2"></param>
        /// <returns></returns>
        public double KLDQFunc_Gauss(InterfaceChains interface1, InterfaceChains interface2)
        {
            bool needReversed = false;

            //		string[] allResiduePairs = GetCommonResiduePairs (interface1, interface2, out needReversed);
            string[] allResiduePairs = GetAllResiduePairs(interface1, interface2, out needReversed);
            // no common residue pairs
            if (needReversed)
            {
                interface2.Reverse();
                allResiduePairs = GetAllResiduePairs(interface1, interface2);
            }

            Dictionary <string, double> probDistHash1 = null;
            Dictionary <string, double> probDistHash2 = null;
            double propSum1 = GetProbDistHash(interface1, allResiduePairs, ref probDistHash1, "GAUSS");
            double propSum2 = GetProbDistHash(interface2, allResiduePairs, ref probDistHash2, "GAUSS");

            double qScore = GetSimScoreForDistributions(probDistHash1, probDistHash2);

            // reverse back to original order
            if (needReversed)
            {
                interface2.Reverse();
            }
            return(qScore);
        }
예제 #2
0
        /// <summary>
        /// compare two interfaces
        /// </summary>
        /// <param name="interChains"></param>
        /// <param name="interChainsList"></param>
        /// <returns></returns>
        public bool AreChainInterfacesSame(InterfaceChains interface1, InterfaceChains interface2)
        {
            // get q scores for the interaction chains: Q_weight
            float qScore = (float)qFunc.WeightQFunc(interface1, interface2);

            if (qScore >= AppSettings.parameters.simInteractParam.uniqueInterfaceCutoff)
            {
                return(true);
            }
            else
            {
                interface2.Reverse();
                qScore = (float)qFunc.WeightQFunc(interface1, interface2);
                if (qScore >= AppSettings.parameters.simInteractParam.uniqueInterfaceCutoff)
                {
                    return(true);
                }
                else
                {
                    // reverse it back
                    interface2.Reverse();
                    return(false);
                }
            }
        }
예제 #3
0
        /// <summary>
        /// compare two interfaces
        /// if no similar interfaces, return true
        /// otherwise return false
        /// </summary>
        /// <param name="interChains"></param>
        /// <param name="interChainsList"></param>
        /// <returns></returns>
        public bool AreInterfacesSame(InterfaceChains interface1, InterfaceChains interface2)
        {
            // compare two interfaces,
            // if different asymmetric chains, then not same
            int asymChainCompResult = AreAsymChainsSame(interface1, interface2);

            if (asymChainCompResult < 0)
            {
                return(false);
            }
            else if (asymChainCompResult == 1)          // reversed same
            {
                interface2.Reverse();                   // match the asymmetric chains to interface1
            }
            // get q scores for the interaction chains: Q_weight
            float qScore = (float)qFunc.WeightQFunc(interface1, interface2);

            if (qScore >= AppSettings.parameters.simInteractParam.uniqueInterfaceCutoff)
            {
                return(true);
            }
            else
            {
                interface2.Reverse();
                qScore = (float)qFunc.WeightQFunc(interface1, interface2);
                if (qScore >= AppSettings.parameters.simInteractParam.uniqueInterfaceCutoff)
                {
                    return(true);
                }
                else
                {
                    // reverse it back
                    if (asymChainCompResult != 1)
                    {
                        interface2.Reverse();
                    }
                    return(false);
                }
            }
        }
예제 #4
0
        /// <summary>
        /// superpose interfaces based on psiblast alignment
        /// </summary>
        /// <param name="interChains2"></param>
        /// <param name="alignInfoTable"></param>
        public double SuperposeInterfaces(InterfaceChains interface1,
                                          InterfaceChains interface2, DataTable alignInfoTable, bool isReverse)
        {
            DataRow alignRow  = null;
            DataRow alignRow2 = null;
            double  identity  = 100.0;

            if (isReverse)
            {
                interface2.Reverse();
            }
            int entityId11 = interface1.entityId1;

            AtomInfo[] chain21    = interface2.chain1;
            int        entityId21 = interface2.entityId1;

            int entityId12 = interface1.entityId2;

            AtomInfo[] chain22    = interface2.chain2;
            int        entityId22 = interface2.entityId2;

            alignRow = GetAlignRow(alignInfoTable, entityId11, entityId21);
            if (alignRow != null)
            {
                identity = Convert.ToDouble(alignRow["Identity"].ToString());
                SuperposeChain(chain21, alignRow);
            }
            if (entityId21 == entityId22 && entityId11 == entityId12)
            {
                SuperposeChain(chain22, alignRow);
                interface2.seqDistHash =
                    SuperposeInterface(interface2.seqDistHash, alignRow);
            }
            else
            {
                alignRow2 = GetAlignRow(alignInfoTable, entityId12, entityId22);
                if (alignRow2 != null)
                {
                    if (identity > Convert.ToDouble(alignRow2["Identity"].ToString()))
                    {
                        identity = Convert.ToDouble(alignRow2["Identity"].ToString());
                    }
                    SuperposeChain(chain22, alignRow2);
                }
                interface2.seqDistHash =
                    SuperposeInterface(interface2.seqDistHash, alignRow, alignRow2);
            }
            // reset the hashtable for residue and its bb atoms.
            interface2.ResetSeqResidueHash();

            return(identity);
        }
예제 #5
0
        /// <summary>
        /// reverse the residue sequence id after interface comparing
        /// </summary>
        /// <param name="interChains2"></param>
        /// <param name="alignInfoTable"></param>
        public void ReverseSupInterfaces(InterfaceChains interface1, InterfaceChains interface2,
                                         DataTable alignInfoTable, bool isReverse)
        {
            DataRow alignRow  = null;
            DataRow alignRow2 = null;

            int entityId11 = interface1.entityId1;

            AtomInfo[] chain21    = interface2.chain1;
            int        entityId21 = interface2.entityId1;

            int entityId12 = interface1.entityId2;

            AtomInfo[] chain22    = interface2.chain2;
            int        entityId22 = interface2.entityId2;

            alignRow = GetAlignRow(alignInfoTable, entityId11, entityId21);
            if (alignRow != null)
            {
                ReverseSupChain(chain21, alignRow);
            }
            if (entityId21 == entityId22 && entityId11 == entityId12)
            {
                ReverseSupChain(chain22, alignRow);
                interface2.seqDistHash =
                    ReverseSupInterface(interface2.seqDistHash, alignRow);
            }
            else
            {
                alignRow2 = GetAlignRow(alignInfoTable, entityId12, entityId22);
                if (alignRow2 != null)
                {
                    ReverseSupChain(chain22, alignRow2);
                    interface2.seqDistHash =
                        ReverseSupInterface(interface2.seqDistHash, alignRow, alignRow2);
                }
            }
            if (isReverse)
            {
                interface2.Reverse();
            }
            interface2.ClearSeqResidueHash();
        }