示例#1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="fastaDatabase"></param>
        public SearchableDatabase(FastaDatabase fastaDatabase)
        {
            FastaDatabase = fastaDatabase;
            _sequence     = fastaDatabase.GetSequence();
            _suffixArray  = new int[_sequence.Length];
            SAIS.sufsort(_sequence, _suffixArray, _sequence.Length);

            var neighboringLcps = new byte[_suffixArray.Length];

            neighboringLcps[0] = 0;

            for (var i = 1; i < _suffixArray.Length; i++)
            {
                var lcp = IndexedDatabase.GetLcp(_sequence, _suffixArray[i - 1], _suffixArray[i]);
                neighboringLcps[i] = lcp;
            }

            _leftLcps  = new byte[_suffixArray.Length];
            _rightLcps = new byte[_suffixArray.Length];

            InitializeLcps(neighboringLcps, _leftLcps, _rightLcps, 0, _suffixArray.Length - 1);
        }