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