コード例 #1
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);
        }