Ejemplo n.º 1
0
        public static decimal CalculateProteinInterfaceAverageResidueSequenceIndex(ClusteringResultProteinInterfaceListContainer.Chain.ProteinInterface proteinInterface)
        {
            if (ParameterValidation.IsProteinInterfaceNullOrEmpty(proteinInterface))
            {
                throw new ArgumentOutOfRangeException(nameof(proteinInterface));
            }

            decimal sumTotal = 0.0m;
            int     sumAtoms = 0;

            foreach (ATOM_Record atom in proteinInterface.AtomList)
            {
                int residueSequenceIndex;
                if (int.TryParse(atom.resSeq.FieldValue, out residueSequenceIndex))
                {
                    sumTotal += residueSequenceIndex;
                    sumAtoms++;
                }
            }

            decimal average = -1m;

            if (sumAtoms > 0)
            {
                average = sumTotal / sumAtoms;
            }

            return(average);
        }
Ejemplo n.º 2
0
 public static bool IsProteinInterfaceNullOrEmpty(ClusteringResultProteinInterfaceListContainer.Chain.ProteinInterface proteinInterface)
 {
     if (proteinInterface == null || proteinInterface.AtomList == null || proteinInterface.AtomList.Count == 0)
     {
         return(true);
     }
     return(false);
 }
Ejemplo n.º 3
0
        public static ClusteringResultProteinInterfaceListContainer SortProteinInterfacesByResidueSequenceIndexAverage(ClusteringResultProteinInterfaceListContainer interactionProteinInterfaces)
        {
            if (ParameterValidation.IsClusteringResultProteinInterfaceListContainerNullOrEmpty(interactionProteinInterfaces))
            {
                throw new ArgumentOutOfRangeException(nameof(interactionProteinInterfaces));
            }

            bool outOfOrder = true;

            while (outOfOrder)
            {
                outOfOrder = false;
                for (int chainIndex = 0; chainIndex < interactionProteinInterfaces.ChainList.Count; chainIndex++)
                {
                    for (int proteinInterfaceIndex = 1; proteinInterfaceIndex < interactionProteinInterfaces.ChainList[chainIndex].ProteinInterfaceList.Count; proteinInterfaceIndex++)
                    {
                        ClusteringResultProteinInterfaceListContainer.Chain.ProteinInterface proteinInterface     = interactionProteinInterfaces.ChainList[chainIndex].ProteinInterfaceList[proteinInterfaceIndex];
                        ClusteringResultProteinInterfaceListContainer.Chain.ProteinInterface lastProteinInterface = interactionProteinInterfaces.ChainList[chainIndex].ProteinInterfaceList[proteinInterfaceIndex - 1];

                        decimal proteinInterfaceAverage     = CalculateProteinInterfaceAverageResidueSequenceIndex(proteinInterface);
                        decimal lastProteinInterfaceAverage = CalculateProteinInterfaceAverageResidueSequenceIndex(lastProteinInterface);

                        if (proteinInterfaceAverage < lastProteinInterfaceAverage)
                        {
                            interactionProteinInterfaces.ChainList[chainIndex].ProteinInterfaceList[proteinInterfaceIndex]     = lastProteinInterface;
                            interactionProteinInterfaces.ChainList[chainIndex].ProteinInterfaceList[proteinInterfaceIndex - 1] = proteinInterface;
                            outOfOrder = true;
                        }
                    }
                }
            }

            return(interactionProteinInterfaces);
        }