diff --git a/stitch/Reporting/FASTAReport.cs b/stitch/Reporting/FASTAReport.cs index 06f3f1a..89a0969 100644 --- a/stitch/Reporting/FASTAReport.cs +++ b/stitch/Reporting/FASTAReport.cs @@ -13,8 +13,8 @@ public class FASTAReport : Report { /// The parameters. /// The minimal score needed to be included in the file. public FASTAReport(ReportInputParameters parameters, int min_score, RunParameters.Report.OutputType outputType, int maxThreads) : base(parameters, maxThreads) { - MinScore = min_score; - OutputType = outputType; + this.MinScore = min_score; + this.OutputType = outputType; } /// Creates a FASTA file with a score for each path through the graph. The lines will be sorted and the lines can be filtered for a minimal score. @@ -22,19 +22,23 @@ public FASTAReport(ReportInputParameters parameters, int min_score, RunParameter public override string Create() { var sequences = new List<(double, string)>(); - if (OutputType == RunParameters.Report.OutputType.Recombine) { - sequences.EnsureCapacity(Parameters.RecombinedSegment.Select(a => a.Templates.Count).Sum()); - foreach (var template in Parameters.RecombinedSegment.SelectMany(a => a.Templates)) { - if (template.Score >= MinScore) - sequences.Add((template.Score, $">{template.MetaData.Identifier} score:{template.Score}\n{AminoAcid.ArrayToString(template.ConsensusSequence().Item1.SelectMany(i => i.Sequence))}")); + if (this.OutputType == RunParameters.Report.OutputType.Recombine) { + sequences.EnsureCapacity(this.Parameters.RecombinedSegment.Select(a => a.Templates.Count).Sum()); + foreach (var template in this.Parameters.RecombinedSegment.SelectMany(a => a.Templates)) { + if (template.Score >= this.MinScore) { + var doc = System.String.Join(',', template.ConsensusSequence().Item2.Select(i => i.ToString("F2"))); + sequences.Add((template.Score, $">{template.MetaData.Identifier} score:{template.Score} depth_of_coverage:{doc}\n{AminoAcid.ArrayToString(template.ConsensusSequence().Item1.SelectMany(i => i.Sequence))}")); + } } } else // TemplateMatching { - sequences.EnsureCapacity(Parameters.Groups.Select(a => a.Item2.Count).Sum()); - foreach (var (group, dbs) in Parameters.Groups) { + sequences.EnsureCapacity(this.Parameters.Groups.Select(a => a.Segments.Count).Sum()); + foreach (var (group, dbs) in this.Parameters.Groups) { foreach (var template in dbs.SelectMany(a => a.Templates)) { - if (template.Score >= MinScore) - sequences.Add((template.Score, $">{template.MetaData.Identifier} id:{group}-{template.Location.TemplateIndex} score:{template.Score}\n{AminoAcid.ArrayToString(template.ConsensusSequence().Item1.SelectMany(i => i.Sequence))}")); + if (template.Score >= this.MinScore) { + var doc = System.String.Join(',', template.ConsensusSequence().Item2.Select(i => i.ToString("F2"))); + sequences.Add((template.Score, $">{template.MetaData.Identifier} id:{group}-{template.Location.TemplateIndex} score:{template.Score} depth_of_coverage:{doc}\n{AminoAcid.ArrayToString(template.ConsensusSequence().Item1.SelectMany(i => i.Sequence))}")); + } } } }