コード例 #1
0
 public void SetUp()
 {
     histo = new HistogramChar();
 }
コード例 #2
0
 public void TearDown()
 {
     this.histo = null;
 }
コード例 #3
0
        /// <summary>
        /// Recognizes the alphabet of the given character sequence. The method uses
        /// a simple heuristics which might fail especially when the sequence is
        /// short. Please note, that a DNA or RNA sequence can contain more than
        /// the symbols of the four bases.
        /// </summary>
        /// <param name="characters"> Character sequence. </param>
        /// <returns> Returns an alphabet. </returns>
       static public Alphabet Recognize(IEnumerable<char> characters)
        {
            HistogramChar histo = new HistogramChar();

            histo.Inc(characters);

            if ((
                histo.Get('F') + histo.Get('E') + histo.Get('P') + histo.Get('Q') +
                histo.Get('I') + histo.Get('L') + histo.Get('F') + histo.Get('E') +
                histo.Get('p') + histo.Get('q') + histo.Get('i') + histo.Get('l')) > 0)

                return (AlphabetAA.Instance());

            if (histo.GetRelative('U') > 0.1 || histo.GetRelative('u') > 0.1)
                return (AlphabetRNA.Instance());

            if (histo.GetRelative('a') > 0.1 || histo.GetRelative('A') > 0.1)
                return (AlphabetDNA.Instance());

            return (AlphabetAA.Instance());
        }