public FM_Matches Match(string q) { FM_Matches m = new FM_Matches(); m.top = 0; m.bot = length; string rq = Useful.StringReverse(q); foreach (char qc in rq) { m.top = LF(m.top, qc); m.bot = LF(m.bot, qc); } if (m.top < m.bot) { m.num = m.bot - m.top; m.qpos = new int[m.num]; for (int i = 0; i < m.num; i++) { m.qpos[i] = bwt.rps[m.top + i]; } } else { m.num = 0; m.qpos = null; }; return(m); }
static public void BWTTest() { string s = "attgccatgaaatggcgcgctttttttt$"; string q = "tg"; Console.WriteLine(s); Console.WriteLine(q); BWT bwt = new BWT(s); FM_Matches fm = bwt.Match(q); Console.WriteLine("{0}, {1}", fm.top, fm.bot); for (int i = 0; i < fm.num; i++) { Console.WriteLine("{0}", fm.qpos[i]); for (int j = 0; j < q.Length; j++) { Console.Write("{0}", s[fm.qpos[i] + j]); } Console.WriteLine(); } //s 안의 q의 갯수만큼 top과 bot의 차이가 생긴다. }