/// <summary> /// Plot mean quality scores at the sequence-level /// </summary> /// <param name="filename">Filename of the output image file</param> /// <param name="height">Height of the plot in pixels</param> /// <param name="width">Width of the plot in pixels</param> public void PlotQualityScoreBySequence(string filename, int height = ShoHelper.HeightDefault, int width = ShoHelper.WidthDefault) { if (!this.Analyzer.HasRunContentBySequence) { throw new ArgumentException("Unable to plot. Need to process quality score data first."); } var bins = ShoHelper.CreateBins((int)this.Analyzer.BaseQualityScoreMin, (int)this.Analyzer.BaseQualityScoreMax, 2); var hist = new Histogram(this.Analyzer.QualityScoreBySequenceMeans, bins); ShoChart f = ShoHelper.CreateBasicShoChart( false, height, width, "Number of reads", "Mean quality score (" + this.Analyzer.FormatType.ToString() + ")", "Mean quality score by sequence " + titleBanner ); // set y-axis labels //f.SetYLabels(ShoHelper.GetIntegerAxisLabels(0, this.Analyzer.Count), null); f.Bar(bins, hist.Count); f.SaveImage(filename); }
/// <summary> /// Generate a histogram of GC content over all sequences. /// </summary> /// <param name="filename">Filename of the output image file</param> /// <param name="height">Height of the plot in pixels</param> /// <param name="width">Width of the plot in pixels</param> public void PlotGCContentBySequence(string filename, int height = ShoHelper.HeightDefault, int width = ShoHelper.WidthDefault) { if (this.Analyzer.GCContentBySequenceArray == null) { throw new ArgumentNullException("this.analyzer.SymbolCountByPositionTable"); } int binSize = 5; var bins = ShoHelper.CreateBins(0, 100, binSize); var hist = new Histogram(this.Analyzer.GCContentBySequenceArray, bins); ShoChart f = ShoHelper.CreateBasicShoChart( false, height, width, "Number of reads", "GC content (%; bin size = " + binSize + ")", "GC content by sequence " + titleBanner ); var xLabelPositions = ShoHelper.CreateBins(1, 21); f.SetXLabels(xLabelPositions, bins); f.Bar(bins, hist.Count); //f.DundasChart.Series[0].ChartType = SeriesChartType.Spline; f.SaveImage(filename); }
/// <summary> /// Plot the distribution of sequence lengths /// </summary> /// <param name="filename">Filename of the output image file</param> /// <param name="height">Height of the plot in pixels</param> /// <param name="width">Width of the plot in pixels</param> public void PlotSequenceLengthDistribution(string filename, int height = ShoHelper.HeightDefault, int width = ShoHelper.WidthDefault) { var hist = new Histogram(this.Analyzer.ReadLengths); ShoChart f = ShoHelper.CreateBasicShoChart( false, height, width, "Number of reads", "Length (bp)", "Sequence length distribution " + titleBanner ); f.HorizontalMinorGridlinesVisible = true; //f.SetYLabels(ShoHelper.CreateBins(0, (int)this.Analyzer.Count), null); f.Bar(hist.BinCenter, hist.Count); f.SaveImage(filename); }