Skip to content

Commit 42d32c4

Browse files
committed
Fixed #159
1 parent 1a8763b commit 42d32c4

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

stitch/Reporting/HTMLReport/Asides.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,8 @@ public static void CreateTemplateAside(StringBuilder buffer, Template template,
123123
{CommonPieces.TagWithHelp("h2", "Consensus Sequence", HTMLHelp.ConsensusSequence)}
124124
<p class='aside-seq'>{AminoAcid.ArrayToString(consensus_sequence)}</p>");
125125
CreateAnnotatedSequence(buffer, human_id, template);
126-
buffer.Append(CommonPieces.TagWithHelp("h2", "Sequence Consensus Overview", HTMLHelp.SequenceConsensusOverview));
127126

128-
SequenceConsensusOverview(buffer, template);
127+
SequenceConsensusOverview(buffer, template, "Sequence Consensus Overview", HTMLHelp.SequenceConsensusOverview);
129128
buffer.Append("<div class='docplot'>");
130129
HTMLGraph.Bargraph(buffer, HTMLGraph.AnnotateDOCData(consensus_doc), "Depth of Coverage of the Consensus Sequence", HTMLHelp.DOCGraph, 10, template.ConsensusSequenceAnnotation());
131130
buffer.Append($@"</div>
@@ -778,7 +777,7 @@ static void SequenceMatchGraphic(StringBuilder buffer, SequenceMatch match)
778777
buffer.Append("</div>");
779778
}
780779

781-
static void SequenceConsensusOverview(StringBuilder buffer, Template template)
780+
static void SequenceConsensusOverview(StringBuilder buffer, Template template, string title = null, string help = null)
782781
{
783782
var consensus_sequence = template.CombinedSequence();
784783
var diversity = new List<Dictionary<string, double>>(consensus_sequence.Count * 2);
@@ -804,7 +803,7 @@ static void SequenceConsensusOverview(StringBuilder buffer, Template template)
804803
}
805804
}
806805
}
807-
HTMLTables.SequenceConsensusOverview(buffer, diversity, template.ConsensusSequenceAnnotation());
806+
HTMLTables.SequenceConsensusOverview(buffer, diversity, title, help, template.ConsensusSequenceAnnotation());
808807
}
809808
}
810809
}

stitch/Reporting/HTMLReport/Tables.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,12 +229,21 @@ string SortOn(int column, string type)
229229
buffer.AppendLine("</table></div>");
230230
}
231231

232-
public static void SequenceConsensusOverview(StringBuilder buffer, List<Dictionary<string, double>> diversity, HelperFunctionality.Annotation[] annotation = null)
232+
public static void SequenceConsensusOverview(StringBuilder buffer, List<Dictionary<string, double>> diversity, string title = null, string help = null, HelperFunctionality.Annotation[] annotation = null)
233233
{
234234
const double threshold = 0.05;
235235
const int height = 35;
236236
const int fontsize = 30;
237237

238+
var data_buffer = new StringBuilder();
239+
buffer.Append("<div class='graph'>");
240+
if (title != null)
241+
if (help != null)
242+
buffer.Append(CommonPieces.TagWithHelp("h2", title, help));
243+
else
244+
buffer.Append($"<h2 class='title'>{title}</h2>");
245+
if (title != null) // Bad way of only doing this in the asides and not in the CDR tables
246+
buffer.Append("<div class='copy-data' onclick='CopyGraphData()'>Copy Data</div>");
238247
buffer.Append($"<div class='sequence-logo' style='--sequence-logo-height:{height}px;--sequence-logo-fontsize:{fontsize}px;'>");
239248
for (int i = 0; i < diversity.Count; i++)
240249
{
@@ -244,6 +253,7 @@ public static void SequenceConsensusOverview(StringBuilder buffer, List<Dictiona
244253
double sum = diversity[i].Values.Sum();
245254
var sorted = diversity[i].ToList();
246255
sorted.Sort((a, b) => a.Value.CompareTo(b.Value));
256+
data_buffer.Append($"{i}");
247257

248258
bool placed = false;
249259
foreach (var item in sorted)
@@ -255,13 +265,18 @@ public static void SequenceConsensusOverview(StringBuilder buffer, List<Dictiona
255265
buffer.Append($"<span style='font-size:{size}px;transform:scaleX({inverse_size})'>{item.Key}</span>");
256266
placed = true;
257267
}
268+
data_buffer.Append($"\t{item.Key}\t{item.Value.ToString(System.Globalization.CultureInfo.GetCultureInfo("en-GB"))}");
258269
}
259270
if (!placed)
260271
buffer.Append($"<span>.</span>");
261272

262273
buffer.Append("</div>");
274+
data_buffer.Append("\n");
263275
}
264276
buffer.Append("</div>");
277+
if (title == null) // Bad way of only doing this in the CDR tables and not in the asides
278+
buffer.Append("<div class='copy-data' onclick='CopyGraphData()'>Copy Data</div>");
279+
buffer.Append($"<textarea type='text' class='graph-data' aria-hidden='true'>{data_buffer.ToString()}</textarea></div>");
265280
}
266281

267282
public static void TableHeader(StringBuilder buffer, List<Template> templates, int totalReads)

0 commit comments

Comments
 (0)