コード例 #1
0
        public static ATOM_Record FindAtomInsidePdbFileChain(ProteinChainListContainer pdbFileChains, int chainIndex, int residueSequenceIndex)
        {
            if (ParameterValidation.IsProteinChainListContainerNullOrEmpty(pdbFileChains))
            {
                return(null);
            }

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

            if (ParameterValidation.IsResidueSequenceIndexInvalid(residueSequenceIndex, true))
            {
                throw new ArgumentOutOfRangeException(nameof(residueSequenceIndex));
            }

            for (int memberIndex = 0; memberIndex < pdbFileChains.ChainList[chainIndex].AtomList.Count; memberIndex++)
            {
                ATOM_Record atom = pdbFileChains.ChainList[chainIndex].AtomList[memberIndex];

                if (ProteinDataBankFileOperations.NullableTryParseInt32(atom.resSeq.FieldValue) == residueSequenceIndex)
                {
                    return(atom);
                }
            }

            return(null);
        }
コード例 #2
0
        public static ATOM_Record FindAtomInsideSingularInteractionsChain(ProteinChainListContainer singularAaToAaInteractions, int chainIndex, int residueSequenceIndex)
        {
            if (ParameterValidation.IsProteinChainListContainerNullOrEmpty(singularAaToAaInteractions))
            {
                return(null);
            }

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

            if (ParameterValidation.IsResidueSequenceIndexInvalid(residueSequenceIndex, true))
            {
                throw new ArgumentOutOfRangeException(nameof(residueSequenceIndex));
            }

            // Loop through atoms in specified chain to find atom with given residue sequence index
            for (int atomIndex = 0; atomIndex < singularAaToAaInteractions.ChainList[chainIndex].AtomList.Count; atomIndex++)
            {
                ATOM_Record atom = singularAaToAaInteractions.ChainList[chainIndex].AtomList[atomIndex];

                if (ProteinDataBankFileOperations.NullableTryParseInt32(atom.resSeq.FieldValue) == residueSequenceIndex)
                {
                    return(atom);
                }
            }

            return(null);
        }