Exemple #1
0
        /// <summary>
        ///     This method splits a List of AtomPair into separate chains.
        /// </summary>
        /// <param name="atomPairList"></param>
        /// <param name="atomNumberInPair"></param>
        /// <param name="distinct"></param>
        /// <returns></returns>
        private static ProteinAtomListContainer GetListOfAtomFromAtomPair(List <AtomPair> atomPairList, int atomNumberInPair, bool distinct = false)
        {
            if (atomNumberInPair != 1 && atomNumberInPair != 2)
            {
                throw new ArgumentOutOfRangeException(nameof(atomNumberInPair));
            }

            if (atomPairList == null || atomPairList.Count <= 0)
            {
                //return null;
                throw new ArgumentOutOfRangeException(nameof(atomPairList));
            }

            var result = new ProteinAtomListContainer();

            for (int index = 0; index < atomPairList.Count; index++)
            {
                AtomPair atomPair = atomPairList[index];

                if (atomNumberInPair == 1)
                {
                    result.AtomList.Add(atomPair.Atom1);
                }
                else if (atomNumberInPair == 2)
                {
                    result.AtomList.Add(atomPair.Atom2);
                }
            }

            if (distinct)
            {
                result.AtomList = result.AtomList.Distinct().ToList();
            }

            return(result);
        }
 public ProteinInteractionRecord(string proteinId, int proteinInteractionCount, AtomPair atomPair)
 {
     ProteinId = proteinId;
     ProteinInteractionCount = proteinInteractionCount;
     InteractingAtomPair     = atomPair;
 }