public static SequenceBuilder GetIISketches(int sketch_blocksize, BitmapFromList bitmap_builder = null) { if (bitmap_builder == null) { bitmap_builder = BitmapBuilders.GetSArray(); } return delegate (IList<int> seq, int sigma) { var iis = new InvIndexSketches (); iis.BitmapBuilder = bitmap_builder; iis.Build (seq, sigma, sketch_blocksize); return iis; }; }
public void Build(KnrSeqSearch knr, int min_occ, BitmapFromList bitmap_builder = null) { this.DB = knr.DB; this.K = knr.K; this.MINOCC = min_occ; // this.MAXCAND = knr.MAXCAND; this.R = knr.R; int sigma = this.R.DB.Count; if (bitmap_builder == null) { bitmap_builder = BitmapBuilders.GetDiffSetRL2(63, new EliasDelta()); } this.INVINDEX = new IRankSelect[sigma]; var list = new List<int>(); for (int i = 0; i < sigma; ++i) { list.Clear(); var unravel = knr.SEQ.Unravel(i); var count = unravel.Count1; for (int s = 1; s <= count; ++s) { list.Add (unravel.Select1(s) / this.K); } this.INVINDEX[i] = bitmap_builder(list); } }
public void Build(string sa_name, BitmapFromList create_bitmap) { using (var Input = new BinaryReader (File.OpenRead (sa_name + ".structs"))) { this.newF = RankSelectGenericIO.Load (Input); int len = this.newF.Count1; this.charT = new int[len]; // Console.WriteLine ("*****>> charT => {0} bytes", this.charT.Length * 4); PrimitiveIO<int>.ReadFromFile (Input, len, this.charT); } using (var Input = new BinaryReader (File.OpenRead (sa_name + ".psi"))) { this.InvIndex = new IRankSelect[this.AlphabetSize]; int curr = 0; for (int i = 1; i <= this.AlphabetSize; i++) { int next; if (i == this.AlphabetSize) { next = this.newF.Count; } else { next = this.newF.Select1 (i + 1); } int len = next - curr; var L = new int[len]; PrimitiveIO<int>.ReadFromFile (Input, len, L); this.InvIndex [i - 1] = create_bitmap (L); curr = next; } } using (var Input = new BinaryReader (File.OpenRead (sa_name + ".samples"))) { this.SA_sample_step = Input.ReadInt16 (); this.SA_marked = RankSelectGenericIO.Load (Input); var _samples = new ListIFS (); _samples.Load (Input); var _invsamples = new ListIFS (); _invsamples.Load (Input); this.SA_samples = _samples; this.SA_invsamples = _invsamples; } }
/// <summary> /// Builds the index for the sequence /// </summary> public void Build(IList<int> sequence, int alphabet_size, int t = 16, BitmapFromList rowbuilder = null, BitmapFromBitStream lenbuilder = null) { if (rowbuilder == null) { rowbuilder = BitmapBuilders.GetSArray (); } if (lenbuilder == null) { lenbuilder = BitmapBuilders.GetGGMN_wt (12); } var invindex = new IList<int>[alphabet_size]; for (int i = 0; i < alphabet_size; i++) { invindex [i] = new List<int> (); } int pos = 0; foreach (var c in sequence) { invindex [c].Add (pos); pos++; } pos = 0; this.N = sequence.Count; this.InvIndex = new Bitmap[alphabet_size]; var lens = new BitStream32 (); for (int i = 0; i < alphabet_size; i++) { if (i % 1000 == 0) { if (i % 10000 == 0) { Console.WriteLine (); Console.Write ("*** InvIndexXLBSeq {0}/{1}", i, alphabet_size); } else { Console.Write (", {0}", i); } } this.InvIndex [i] = rowbuilder (invindex [i]); lens.Write (true); lens.Write (false, invindex [i].Count); invindex [i] = null; } lens.Write (true); Console.WriteLine (); Console.WriteLine ("done, now saving permutation and the Len bitmap"); this.Lens = lenbuilder (new FakeBitmap (lens)); var p = new ListGen_MRRR (); p.Build (this.GetNotIdxPERM (), t, null); Console.WriteLine ("done"); this.Perm = p; }
public static SequenceBuilder GetInvIndexXLBSeq(short t = 16, BitmapFromList row_builder = null, BitmapFromBitStream len_builder = null) { if (row_builder == null) { row_builder = BitmapBuilders.GetSArray (); } if (len_builder == null) { len_builder = BitmapBuilders.GetGGMN_wt (12); } return delegate (IList<int> seq, int sigma) { var iis = new InvIndexXLBSeq(); iis.Build (seq, sigma, t, row_builder, len_builder); return iis; }; }
public static SequenceBuilder GetIISketches( BitmapFromList bitmap_builder, int sketch_blocksize ) { return delegate (IList<int> seq, int sigma) { var iis = new InvIndexSketches (); iis.BitmapBuilder = bitmap_builder; iis.Build (seq, sigma, sketch_blocksize); return iis; }; }
public static SequenceBuilder GetIISeq( BitmapFromList bitmap_builder ) { return delegate (IList<int> seq, int sigma) { var iis = new InvIndexSeq (); iis.BitmapBuilder = bitmap_builder; iis.Build (seq, sigma); return iis; }; }