Exemplo n.º 1
0
 public SimpleGa(TextComparer posComparer, TextComparer negComparer, SimpleGaParams pars = null)
 {
     _pars = pars ?? new SimpleGaParams();
     _posComparer = posComparer;
     _negComparer = negComparer;
     _rnd = new Random(_pars.Seed);
     _pTotal = _posComparer.GetAllCites(new[] {(byte) Nucleotide.End}, 1).Count();
     _nTotal = _negComparer.GetAllCites(new[] { (byte)Nucleotide.End }, 1).Count();
 }
Exemplo n.º 2
0
 private static void TransTest(int origLen, IEnumerable<ElementGroup> groups, TextComparer cmp)
 {
     var cntOrig = 0;
     var cntTrans = 0;
     foreach (var gr in groups)
     {
         var cnt = cmp.GetAllCites(gr.Chain, gr.Chain.Length);
         Console.WriteLine(gr + ", otherCnt=" + cnt.Length);
         cntOrig += gr.Count;
         cntTrans += cnt.Length;
     }
     Console.WriteLine("origFactor=" + cntOrig + ", transFactor=" + Math.Round((double)origLen * cntTrans / cmp.StrokeSize, 3));
 }
Exemplo n.º 3
0
        private static void GetSfx(GetSfxParams pars, IEnumerable<Region> peaks, IEnumerable<Region> noises, 
            out TextComparer posComp, out TextComparer negComp)
        {
            var t = DateTime.Now;
            var chrDic = new Dictionary<ChromosomeEnum, Chromosome>();

            // peaks
            var peaksTmp = peaks.Select(p =>
            {
                if (!chrDic.ContainsKey(p.Chr))
                    chrDic.Add(p.Chr, ChrManager.GetChromosome(p.Chr));
                return chrDic[p.Chr].GetPack(p.Start, p.Size);
            }).ToArray();
            TextComparer sfxPeaks = SuffixBuilder.BuildMany2(peaksTmp, pars.MinGroupSize);
            Console.WriteLine("Peaks sfx build, dt=" + (DateTime.Now - t) + ", size=" + sfxPeaks.StrokeSize);
            // noise
            var noiseTmp = noises.Select(p =>
            {
                if (!chrDic.ContainsKey(p.Chr))
                    chrDic.Add(p.Chr, ChrManager.GetChromosome(p.Chr));
                return chrDic[p.Chr].GetPack(p.Start, p.Size);
            }).ToArray();
            TextComparer sfxNoise = SuffixBuilder.BuildMany2(noiseTmp, pars.MinGroupSize);
            Console.WriteLine("Noise sfx build, dt=" + (DateTime.Now - t) + ", size=" + sfxNoise.StrokeSize);
            posComp = sfxPeaks;
            negComp = sfxNoise;
        }