コード例 #1
0
ファイル: Output.cs プロジェクト: rgatkinson/nadir
 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();
     }