コード例 #1
0
        /// <summary>
        ///     Get the lowest (minimum) and highest (maximum) residue sequence index (as found in the pdb file) in an interaction
        ///     proteinInterface.
        /// </summary>
        /// <param name="proteinInterface"></param>
        /// <param name="singularAaToAaInteractions"></param>
        /// <param name="chainIndex"></param>
        /// <returns></returns>
        public static MinMax MinMaxResidueSequenceIndex(ClusteringFullResultListContainer.Chain.Stage.Cluster proteinInterface, ProteinChainListContainer singularAaToAaInteractions, int chainIndex)
        {
            if (ParameterValidation.IsClusterNullOrEmpty(proteinInterface))
            {
                throw new ArgumentNullException(nameof(proteinInterface));
            }

            if (ParameterValidation.IsProteinChainListContainerNullOrEmpty(singularAaToAaInteractions))
            {
                throw new ArgumentNullException(nameof(singularAaToAaInteractions));
            }

            if (ParameterValidation.IsChainIndexInvalid(chainIndex))
            {
                throw new ArgumentOutOfRangeException(nameof(chainIndex));
            }

            int proteinInterfaceMin = 0;
            int proteinInterfaceMax = 0;

            for (int memberIndex = 0; memberIndex < proteinInterface.AtomIndexList.Count; memberIndex++)
            {
                int member = proteinInterface.AtomIndexList[memberIndex];

                ATOM_Record atom = singularAaToAaInteractions.ChainList[chainIndex].AtomList[member];

                var residueSequenceIndex = ProteinDataBankFileOperations.NullableTryParseInt32(atom.resSeq.FieldValue);

                if (residueSequenceIndex == null)
                {
                    continue;
                }

                if (memberIndex == 0 || residueSequenceIndex < proteinInterfaceMin)
                {
                    proteinInterfaceMin = residueSequenceIndex.Value;
                }

                if (memberIndex == 0 || residueSequenceIndex > proteinInterfaceMax)
                {
                    proteinInterfaceMax = residueSequenceIndex.Value;
                }
            }

            return(new MinMax(proteinInterfaceMin, proteinInterfaceMax));
        }