Example #1
0
    //
    //------------------------------------------------------------------------------

    public AllocationStatistics(SequenceDesignContext context, bool fTracingEnabled)
        {
        this.fTracingEnabled = fTracingEnabled;

        AddColumn(12, "iter",   "N0",          () => context.DesignIter);
        AddColumn(9, "best",    "",            () => context.ScaleScoreFormatted(this.scoring.designScoreBest.Score));
        AddColumn(9, "cur",     "",            () => context.ScaleScoreFormatted(this.scoring.designScoreCur.Score));
        AddColumn(13, "mut'ns",  "F2", "/iter", () => (double)this.cMutations / this.cScoringIter);
        AddColumn(10, "overall", "F1", "/s",   () => (this.cPrinted > cPrintedOmit) ? ((double)this.cTotalScoringIter / ((this.now-this.nowScoringTrialZero).TotalMilliseconds * 0.001)) : 0.0);
        AddColumn(10, "iters",   "F1", "/s",   () => (double)this.cScoringIter    / ((this.now - this.nowPrev).TotalMilliseconds * 0.001));
        AddColumn(10, "legal",  "F1", "/s",    () => (double)(this.cLegalUp+this.cDown) / ((this.now - this.nowPrev).TotalMilliseconds * 0.001));
        AddColumn(8, "temp",    "F1",          () => this.scoring.temperature);
        AddColumn(6, "n",       "D",           () => this.scoring.designScoreStatistics.N);
        //  AddColumn(9, "mean",    "F2",          () => context.ScaleScore(scoring.designScoreDistribution.Mean));
        //  AddColumn(9, "stddev",  "F2",          () => context.ScaleScore(scoring.designcoreDistribution.StdDev));
        AddColumn(8, "downs",   "F1", "%",     () => (double)this.cDown       / this.cScoringIter * 100); 
        AddColumn(9, "legalup",  "F1", "%",    () => (double)this.cLegalUp    / this.cScoringIter * 100);
        AddColumn(9, "illegal", "F1", "%",     () => (double)this.cIllegalUp  / this.cScoringIter * 100); 
        AddColumn(8, "ups",     "F1", "%",     () => (double)this.cUp         / this.cScoringIter * 100); 
        AddColumn(9, "abandon", "F1", "%",     () => (double)this.cAbandon    / this.cScoringIter * 100);
        AddColumn(9, "hillexp", "g3",          () => this.HillExpansion);
        AddColumn(8, "cMutd",   "F2",          () => (double)this.cChangedStrandsSinceScored / this.cScoringAttempts);
        AddColumn(5, "cTot",    "D",           () => this.cScoreable);
        AddColumn(10, "remain",  "",           () => 
            {
            System.TimeSpan elapsed = this.now - this.nowIterZero;
            if (context.DesignIter != 0 && elapsed.TotalMilliseconds > 0)
                {
                double itersPerSecond = context.DesignIter / (elapsed.TotalMilliseconds * 0.001);
                long itersRemaining = context.Program.DesignIterMax - context.DesignIter;
                return System.TimeSpan.FromSeconds(itersRemaining / itersPerSecond).ToString("dd':'hh':'mm");
                }
            else
                return "unk";
            });

        if (fTracingEnabled)
            { 
            this.fileWriter = context.Program.CreateWritableFile("-trace", out this.fileStream);
            }
        }
Example #2
0
 void OutputStrands(int resultNumber, SequenceDesignContext context, PrettyPrintContext pp, List<Strand> strands, long iteration)
     {
     List<string> prints = strands.ConvertAll<string>(s => pp.Cloned().PrettyPrint(BuiltIns.orient(s, Strand.Direction.FiveToThree)));
     //
     pp.NewLine();
     string strStrandsCaption   = context.Designer==null 
         ? $"#{resultNumber}: Strands:"
         : $"#{resultNumber}: Strands: score={context.ScaleScoreFormatted(context.Scoring.designScoreCur.Score)} iter={iteration:N0}";
     string strStrandsUnderline = new string('-', strStrandsCaption.Length);
     pp.AppendLine(strStrandsCaption);
     pp.AppendLine(strStrandsUnderline);
     pp.Indent();
     //
     AutoWidthTable formatter = new AutoWidthTable();
     List<string> formats = new List<string>();
     formatter.AddColumn(strands, s => s.DisplayName);                   formats.Add("{0}");
     formatter.AddColumn(strands, s => s.Length);                      formats.Add(" len={0}");
     if (context.Designer !=null)
         {
         formatter.AddColumn(strands, s => context.ScaleScoreFormatted(s.DesignScore)); formats.Add(" score={0}");
         formatter.AddColumn(strands, s => true 
             ? String.Format("{1}{0:F1}", (s.MeltInfo as IMeltInfo).TempCelsiusCur, (s.MeltInfo.hasGoal ? ":" : "="))
             : "=n/a"); 
         formats.Add(" Tm{0}");
         }
     formatter.AddColumn(prints, p => p);                                formats.Add(" {0}");
     // formatter.AddColumn(strands, s => s.ChunckedNucleotidesWithDecorations);   formats.Add(" {0}");
     formatter.FormatTo(pp, formats.ToArray());
     //
     if (context.Designer != null)
         {
         pp.NewLine();
         formatter = new AutoWidthTable();
         formats = new List<string>();
         formatter.AddColumn(strands, s => $"{s.DisplayName}.seed="); formats.Add("{0}");
         formatter.AddColumn(strands, s => $"\"{s.ChunckedNucleotidesWithDecorations}\";"); formats.Add("{0}");
         formatter.FormatTo(pp, formats.ToArray());
         }
     //
     pp.Outdent();
     }