/// <summary>
        /// Equals
        /// </summary>
        public bool Equals(Dna other)
        {
            if (ReferenceEquals(this, other))
            {
                return(true);
            }
            else if (null == other)
            {
                return(false);
            }

            return(Enumerable.SequenceEqual(m_Items, other.m_Items));
        }
        /// <summary>
        /// To Reverse Complement
        /// </summary>
        public Dna ToReverseComplement()
        {
            Dna result = new Dna()
            {
                m_Items = new List <DnaNuclearbase>(m_Items.Count)
            };

            for (int i = m_Items.Count - 1; i >= 0; --i)
            {
                result.m_Items.Add(m_Items[i].Complement());
            }

            return(result);
        }
Beispiel #3
0
        /// <summary>
        /// Standard Constructor
        /// </summary>
        public static Rna FromDna(Dna source)
        {
            if (source is null)
            {
                throw new ArgumentNullException(nameof(source));
            }

            Rna result = new() {
                m_Items = new List <RnaNuclearbase>(source.Count)
            };

            for (int i = 0; i < source.Count; ++i)
            {
                result.m_Items.Add(source[i].RnaComplement());
            }

            return(result);
        }