Example #1
0
        /*	public InterfacesComp(double uniqueCutoff)
         *      {
         *              this.uniqueCutoff = uniqueCutoff;
         *      }
         */
        #region Interfaces within one structure
        /// <summary>
        /// get q scores within a crystal
        /// </summary>
        /// <param name="interChains">input: all pairwise interactive chains</param>
        /// return: an array of unique pairwise interfaces and their q scores
        public InterfacePairInfo[] CompareInterfacesWithinCrystal(ref InterfaceChains[] interfaceChains)
        {
            List <InterfacePairInfo> interfacesList = new List <InterfacePairInfo> ();

            // pairwise compare two interfaces
            for (int i = 0; i < interfaceChains.Length - 1; i++)
            {
                for (int j = i + 1; j < interfaceChains.Length; j++)
                {
                    // get q scores for each interaction chains: Q_weight
                    float qScore = (float)qFunc.WeightQFunc(interfaceChains[i], interfaceChains[j]);
                    if (qScore < AppSettings.parameters.simInteractParam.uniqueInterfaceCutoff)
                    {
                        interfaceChains[j].Reverse();
                        float reversedQScore = (float)qFunc.WeightQFunc(interfaceChains[i], interfaceChains[j]);
                        if (reversedQScore > qScore)
                        {
                            qScore = reversedQScore;
                        }
                        else
                        {
                            interfaceChains[j].Reverse();
                        }
                    }
                    InterfacePairInfo interfacesInfo = new InterfacePairInfo((InterfaceInfo)interfaceChains[i],
                                                                             (InterfaceInfo)interfaceChains[j]);
                    interfacesInfo.qScore = qScore;
                    interfacesList.Add(interfacesInfo);
                }
            }
            // return an array of interface info
            return(interfacesList.ToArray());
        }
Example #2
0
        /// <summary>
        /// pairwise interfaces comparisons between two crystal structures
        /// </summary>
        /// <param name="interChains1">interactive chains and interfaces</param>
        /// <param name="interChains2">interactive chains and </param>
        public InterfacePairInfo[] CompareInterfacesBetweenCrystals(InterfaceChains[] interChains1, InterfaceChains[] interChains2)
        {
            List <InterfacePairInfo> interfacesList = new List <InterfacePairInfo> ();

            for (int i = 0; i < interChains1.Length; i++)
            {
                for (int j = 0; j < interChains2.Length; j++)
                {
                    // get q scores for each interaction chains: Q_weight
                    float qScore = (float)qFunc.WeightQFunc(interChains1[i], interChains2[j]);
                    if (qScore < AppSettings.parameters.simInteractParam.interfaceSimCutoff)
                    {
                        interChains2[j].Reverse();
                        float reversedQScore = (float)qFunc.WeightQFunc(interChains1[i], interChains2[j]);
                        if (qScore < reversedQScore)
                        {
                            qScore = reversedQScore;
                        }
                        else
                        {
                            interChains2[j].Reverse();
                        }
                    }
                    if (qScore >= 0.0)
                    {
                        InterfacePairInfo interfacesInfo = new InterfacePairInfo((InterfaceInfo)interChains1[i], (InterfaceInfo)interChains2[j]);
                        interfacesInfo.qScore = qScore;
                        interfacesList.Add(interfacesInfo);
                    }
                }
            }

            return(interfacesList.ToArray());
        }
Example #3
0
        /// <summary>
        /// compare one pair interactive chains with a list of interactive chains
        /// if no similar interfaces, return true
        /// otherwise return false
        /// </summary>
        /// <param name="interChains"></param>
        /// <param name="interChainsList"></param>
        /// <returns></returns>
        public bool IsInterfaceUnique(InterfaceChains interChains, List <InterfaceChains> interChainsList)
        {
            // pairwise compare two interfaces
            for (int i = 0; i < interChainsList.Count; i++)
            {
                // get q scores for each interaction chains: Q_weight
                float qScore = (float)qFunc.WeightQFunc(interChains, interChainsList[i]);

                InterfacePairInfo interfacesInfo = new InterfacePairInfo((InterfaceInfo)interChains, (InterfaceInfo)interChainsList[i]);
                interfacesInfo.qScore = qScore;
                if (qScore >= AppSettings.parameters.simInteractParam.interfaceSimCutoff)
                {
                    return(false);
                }
            }
            return(true);
        }
Example #4
0
        /// <summary>
        /// get q scores within a crystal
        /// </summary>
        /// <param name="interChains">input: all pairwise interactive chains
        /// output: unique pairwise interactive chains</param>
        /// return: an array of pairwise interfaces and their q scores
        public InterfacePairInfo[] FindUniqueInterfacesWithinCrystal(ref InterfaceChains[] interChains)
        {
            List <InterfacePairInfo> interfacesCompList = new List <InterfacePairInfo>  ();
            List <int> uniqueInterChainsIdList          = new List <int>  ();

            // initialize the unique interchains list
            for (int i = 0; i < interChains.Length; i++)
            {
                uniqueInterChainsIdList.Add(i + 1);
            }

            // pairwise compare two interfaces
            for (int i = 0; i < interChains.Length - 1; i++)
            {
                // should have similar structure to a structure
                if (!uniqueInterChainsIdList.Contains(i + 1))
                {
                    continue;
                }
                for (int j = i + 1; j < interChains.Length; j++)
                {
                    // should have similar structures
                    if (!uniqueInterChainsIdList.Contains(j + 1))
                    {
                        continue;
                    }

                    // get q scores for each interaction chains: Q_weight
                    float qScore = (float)qFunc.WeightQFunc(interChains[i], interChains[j]);
                    if (qScore < AppSettings.parameters.simInteractParam.uniqueInterfaceCutoff)
                    {
                        interChains[j].Reverse();
                        float reversedQScore = (float)qFunc.WeightQFunc(interChains[i], interChains[j]);
                        if (reversedQScore > qScore)
                        {
                            qScore = reversedQScore;
                        }
                        else
                        {
                            interChains[j].Reverse();
                        }
                    }
                    InterfacePairInfo interfacesInfo = new InterfacePairInfo((InterfaceInfo)interChains[i], (InterfaceInfo)interChains[j]);
                    interfacesInfo.qScore = qScore;
                    // remove same interfaces with Qscore >= cutoff and with same asymmetric chains
                    if (qScore > AppSettings.parameters.simInteractParam.uniqueInterfaceCutoff &&
                        AreAsymChainsSame(interChains[i], interChains[j]) > -1)
                    {
                        interfacesInfo.sameAsym = true;
                        uniqueInterChainsIdList.Remove(j + 1);
                    }
                    interfacesCompList.Add(interfacesInfo);
                }
            }
            // keep unique interfaces
            InterfaceChains[] uniqueInterChains = new InterfaceChains [uniqueInterChainsIdList.Count];
            for (int i = 0; i < uniqueInterChainsIdList.Count; i++)
            {
                uniqueInterChains[i] = interChains[uniqueInterChainsIdList[i] - 1];
            }
            interChains = uniqueInterChains;
            // return an array of interface info
            return(interfacesCompList.ToArray());
        }
Example #5
0
        /// <summary>
        /// remove the interface pair from the interfaces list
        /// </summary>
        /// <param name="interfacePairList"></param>
        /// <param name="interfaceInfo"></param>
        private void RemoveInterfacePairInfo(ref List <InterfacePairInfo> interfacePairList, InterfacePairInfo interfaceInfo)
        {
            int  removedIndex   = -1;
            bool interfaceFound = false;

            foreach (InterfacePairInfo interfacePair in interfacePairList)
            {
                removedIndex++;
                if (interfacePair.interfaceInfo1.interfaceId == interfaceInfo.interfaceInfo1.interfaceId &&
                    interfacePair.interfaceInfo2.interfaceId == interfaceInfo.interfaceInfo2.interfaceId)
                {
                    interfaceFound = true;
                    break;
                }
            }
            if (interfaceFound)
            {
                interfacePairList.RemoveAt(removedIndex);
            }
        }