From aede23f89e076da5daff0da4e817525ff620ffd1 Mon Sep 17 00:00:00 2001 From: Piero Dalle Pezze Date: Fri, 23 Feb 2018 10:06:44 +0000 Subject: [PATCH 1/6] Update .travis.yml --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index a2bcab4..55915ca 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,3 +11,4 @@ before_script: script: - java -classpath junit-4.11.jar:hamcrest-core-1.3.jar:log4j-1.2.16.jar:sam-1.103.jar:commons-math3-3.5.jar:commons-lang3-3.4.jar:. org.junit.runner.JUnitCore test.java.uk.ac.babraham.BamQC.Modules.AllTests - ./bamqc --version + From 55ab7760fc886259acb8c732fecbddc99bf261d1 Mon Sep 17 00:00:00 2001 From: Piero Dalle Pezze Date: Mon, 9 Apr 2018 16:58:20 +0000 Subject: [PATCH 2/6] added flags to `BasicStatistics`. ScatterGraph now uses SimpleRegression() class provided with Apache commons-math3.5 --- .settings/org.eclipse.jdt.core.prefs | 17 +- .settings/org.eclipse.jdt.ui.prefs | 2 +- Configuration/limits.txt | 96 +++++++----- uk/ac/babraham/BamQC/Graphs/ScatterGraph.java | 43 ++--- .../BamQC/Modules/BasicStatistics.java | 14 ++ .../BamQC/Utilities/LinearRegression.java | 148 ------------------ 6 files changed, 104 insertions(+), 216 deletions(-) delete mode 100644 uk/ac/babraham/BamQC/Utilities/LinearRegression.java diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs index b3cad60..c8ae3c3 100644 --- a/.settings/org.eclipse.jdt.core.prefs +++ b/.settings/org.eclipse.jdt.core.prefs @@ -11,18 +11,22 @@ org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource=error org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull +org.eclipse.jdt.core.compiler.annotation.nonnull.secondary= org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary= org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable +org.eclipse.jdt.core.compiler.annotation.nullable.secondary= org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.compliance=1.8 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.maxProblemPerUnit=100 +org.eclipse.jdt.core.compiler.problem.APILeak=warning org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.autoboxing=ignore @@ -60,12 +64,14 @@ org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning +org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error org.eclipse.jdt.core.compiler.problem.nullReference=error org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore @@ -82,12 +88,16 @@ org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore +org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled +org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore @@ -95,6 +105,7 @@ org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedImport=warning org.eclipse.jdt.core.compiler.problem.unusedLabel=warning org.eclipse.jdt.core.compiler.problem.unusedLocal=warning @@ -107,7 +118,7 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.7 +org.eclipse.jdt.core.compiler.source=1.8 org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX diff --git a/.settings/org.eclipse.jdt.ui.prefs b/.settings/org.eclipse.jdt.ui.prefs index 2528864..c88e147 100644 --- a/.settings/org.eclipse.jdt.ui.prefs +++ b/.settings/org.eclipse.jdt.ui.prefs @@ -31,7 +31,7 @@ cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=tru cleanup.qualify_static_member_accesses_with_declaring_class=true cleanup.qualify_static_method_accesses_with_declaring_class=false cleanup.remove_private_constructors=true -cleanup.remove_redundant_type_arguments=true +cleanup.remove_redundant_type_arguments=false cleanup.remove_trailing_whitespaces=false cleanup.remove_trailing_whitespaces_all=true cleanup.remove_trailing_whitespaces_ignore_empty=false diff --git a/Configuration/limits.txt b/Configuration/limits.txt index 345c732..47f6be2 100644 --- a/Configuration/limits.txt +++ b/Configuration/limits.txt @@ -1,43 +1,53 @@ -# For each of the modules you can choose to not run that -# module at all by setting the value below to 1 for the -# modules you want to remove. -ChromosomeReadDensity ignore 0 -FeatureCoverage ignore 0 -GenomeCoverage ignore 0 -IndelFrequencies ignore 0 -InsertLengthDistribution ignore 0 -MappingQualityDistribution ignore 0 -SequenceQualityDistribution ignore 1 -SNPFrequencies ignore 0 -SNPFrequenciesByType ignore 0 -SoftClipDistribution ignore 0 -# The following option switches off InsertFrequencies, SNPFrequencies, SNPFrequenciesByType and some statistics in BasicStatistics -VariantCallDetection ignore 0 - - -# Annotation Module. -AnnotationSet_annotation_cache_capacity ignore 50000 - -# Indel/SNP modules -VariantCallPosition_indel_seqpercent_xaxis_threshold ignore 5 -VariantCallPosition_indel_threshold warn 0.5 -VariantCallPosition_indel_threshold error 1 -VariantCallPosition_snp_seqpercent_xaxis_threshold ignore 5 -VariantCallPosition_snp_threshold warn 1 -VariantCallPosition_snp_threshold error 2 - -# Genome Coverage module -GenomeCoverage_plot_type_chromosomes_threshold ignore 50 -GenomeCoverage_plot_bins_all_chromosomes ignore 5000 -GenomeCoverage_plot_bins_per_chromosome ignore 500 - -# Insert Length Distribution module -InsertLengthDistribution_max_insert_size ignore 10000.0 -InsertLengthDistribution_bin_size ignore 1.0 -InsertLengthDistribution_percentage_deviation error 50.0 -InsertLengthDistribution_percentage_deviation warn 75.0 - -# MappingQualityDistribution module -MappingQualityDistribution_fraction error 0.50 -MappingQualityDistribution_fraction warn 0.75 - +# For each of the modules you can choose to not run that +# module at all by setting the value below to 1 for the +# modules you want to remove. +ChromosomeReadDensity ignore 0 +FeatureCoverage ignore 0 +GenomeCoverage ignore 0 +IndelFrequencies ignore 0 +InsertLengthDistribution ignore 0 +MappingQualityDistribution ignore 0 +SequenceQualityDistribution ignore 1 +SNPFrequencies ignore 0 +SNPFrequenciesByType ignore 0 +SoftClipDistribution ignore 0 +# The following option switches off InsertFrequencies, SNPFrequencies, SNPFrequenciesByType and some statistics in BasicStatistics +VariantCallDetection ignore 0 + + +# BasicStatistics module +BasicStatistics_tot_seq_threshold warn 0 +BasicStatistics_tot_seq_threshold error 0 +BasicStatistics_unmapped_percent_threshold warn 50 +BasicStatistics_unmapped_percent_threshold error 90 + + +# ChromosomeReadDensity Module +#ChromosomeReadDensity + +# Annotation Module +AnnotationSet_annotation_cache_capacity ignore 50000 + +# Indel/SNP modules +VariantCallPosition_indel_seqpercent_xaxis_threshold ignore 5 +VariantCallPosition_indel_threshold warn 0.5 +VariantCallPosition_indel_threshold error 1 +VariantCallPosition_snp_seqpercent_xaxis_threshold ignore 5 +VariantCallPosition_snp_threshold warn 1 +VariantCallPosition_snp_threshold error 2 + +# Genome Coverage module +GenomeCoverage_plot_type_chromosomes_threshold ignore 50 +GenomeCoverage_plot_bins_all_chromosomes ignore 5000 +GenomeCoverage_plot_bins_per_chromosome ignore 500 + +# Insert Length Distribution module +InsertLengthDistribution_max_insert_size ignore 10000.0 +InsertLengthDistribution_bin_size ignore 1.0 +InsertLengthDistribution_percentage_deviation error 50.0 +InsertLengthDistribution_percentage_deviation warn 75.0 + +# MappingQualityDistribution module +MappingQualityDistribution_fraction error 0.50 +MappingQualityDistribution_fraction warn 0.75 + diff --git a/uk/ac/babraham/BamQC/Graphs/ScatterGraph.java b/uk/ac/babraham/BamQC/Graphs/ScatterGraph.java index 0a4314d..1f9b94f 100644 --- a/uk/ac/babraham/BamQC/Graphs/ScatterGraph.java +++ b/uk/ac/babraham/BamQC/Graphs/ScatterGraph.java @@ -35,6 +35,7 @@ import java.awt.event.MouseEvent; import java.awt.geom.AffineTransform; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.Random; @@ -46,9 +47,9 @@ import javax.swing.UIManager; import javax.swing.event.MouseInputAdapter; +import org.apache.commons.math3.stat.regression.SimpleRegression; import org.apache.commons.math3.util.Precision; -import uk.ac.babraham.BamQC.Utilities.LinearRegression; /** * A class for drawing a scatter plot. @@ -328,15 +329,16 @@ protected void paintComponent(Graphics g) { double ovalSize = 5; // We distinguish two inputs since the x label does not start from 0. // used for computing the actual line points as if they were starting from 0. - double[] inputVar = new double[data.length]; - double[] responseVar = new double[data.length]; + double[][] dataMatrix = new double[data.length][2]; // (x1,y1), (x2, y2), .. + for (int d = 0; d < data.length; d++) { double x = getX(xCategories[d], xOffset)-ovalSize/2; double y = getY(data[d])-ovalSize/2; g.fillOval((int)x, (int)y, (int)(ovalSize), (int)(ovalSize)); g.drawString(toolTipLabels[d], (int)x+2, (int)y+16); - inputVar[d] = Double.valueOf(xCategories[d]); - responseVar[d] = data[d]; + + dataMatrix[d][0] = Double.valueOf(xCategories[d]); + dataMatrix[d][1] = data[d]; // Tool tips Rectangle r = new Rectangle((int)x, (int)y, (int)(ovalSize), (int)(ovalSize)); @@ -345,23 +347,21 @@ protected void paintComponent(Graphics g) { } g.setColor(Color.BLACK); - - - + // Draw the intercept - // WARNING: Is drawing a least squares regression line asserting that "the distribution follows a power law" correct? - // This is our case if we plot log-log.. - // It seems not in this paper (Appendix A) http://arxiv.org/pdf/0706.1062v2.pdf - - if(data.length > 1) { - LinearRegression linReg = new LinearRegression(inputVar, responseVar); - double intercept = linReg.intercept(); - double slope = linReg.slope(); - double rSquare = linReg.R2(); + if(data.length > 1) { + SimpleRegression linReg = new SimpleRegression(true); + linReg.addData(dataMatrix); + linReg.regress(); + double intercept = linReg.getIntercept(); + double slope = linReg.getSlope(); + double r = linReg.getR(); + // Let's now calculate the two points (x1, y1) and (xn, yn) // (x1, y1). We need to skip the areas where x1maxY + double x1 = minX; double y1 = slope*minX + intercept; if(y1 < minY) { @@ -371,10 +371,11 @@ protected void paintComponent(Graphics g) { x1 = (maxY - intercept)/slope; y1 = maxY; } - // (xn, yn). maxX which essentially is inputVar[inputVar.length-1] + // (xn, yn). maxX which essentially is dataMatrix[dataMatrix.length-1][0] double xn = maxX; double yn = slope*maxX + intercept; + if (g instanceof Graphics2D) { ((Graphics2D)g).setStroke(new BasicStroke(1.5f)); } @@ -405,7 +406,7 @@ protected void paintComponent(Graphics g) { // Now draw the legend label g.setColor(Color.RED); g.drawString(legendString, xOffset+13, 60); - g.drawString("R^2 = " + Precision.round(rSquare, 3), xOffset+13, 76); + g.drawString("r = " + Precision.round(r, 3), xOffset+13, 76); g.setColor(Color.BLACK); } @@ -498,8 +499,8 @@ public void run() { toolTipsLabels[i] = String.valueOf(i); } - String xLabel = "xLabel"; - String yLabel = "yLabel"; + String xLabel = "log x"; + String yLabel = "log y"; //String yLabel = null; String graphTitle = "Graph Title"; diff --git a/uk/ac/babraham/BamQC/Modules/BasicStatistics.java b/uk/ac/babraham/BamQC/Modules/BasicStatistics.java index 97e9cef..cacb3b0 100644 --- a/uk/ac/babraham/BamQC/Modules/BasicStatistics.java +++ b/uk/ac/babraham/BamQC/Modules/BasicStatistics.java @@ -50,7 +50,13 @@ * */ public class BasicStatistics extends AbstractQCModule { + + private static final double ERROR_ACTUAL_COUNT = ModuleConfig.getParam("BasicStatistics_tot_seq_threshold", "error"); + private static final double WARNING_ACTUAL_COUNT = ModuleConfig.getParam("BasicStatistics_tot_seq_threshold", "warn"); + private static final double ERROR_UNMAPPED_PERCENT = ModuleConfig.getParam("BasicStatistics_unmapped_percent_threshold", "error"); + private static final double WARNING_UNMAPPED_PERCENT = ModuleConfig.getParam("BasicStatistics_unmapped_percent_threshold", "warn"); + private String filename = ""; private boolean headerParsed = false; private String command = ""; @@ -196,11 +202,19 @@ public void processFile (SequenceFile file) { @Override public boolean raisesError() { + if(actualCount < ERROR_ACTUAL_COUNT || + 100.0f * unmappedCount/actualCount > ERROR_UNMAPPED_PERCENT) { + return true; + } return false; } @Override public boolean raisesWarning() { + if(actualCount < WARNING_ACTUAL_COUNT || + 100.0f * unmappedCount/actualCount > WARNING_UNMAPPED_PERCENT) { + return true; + } return false; } diff --git a/uk/ac/babraham/BamQC/Utilities/LinearRegression.java b/uk/ac/babraham/BamQC/Utilities/LinearRegression.java deleted file mode 100644 index b52f7b6..0000000 --- a/uk/ac/babraham/BamQC/Utilities/LinearRegression.java +++ /dev/null @@ -1,148 +0,0 @@ -package uk.ac.babraham.BamQC.Utilities; -/** - * The LinearRegression class performs a simple linear regression - * on an set of N data points (yi, xi). - * That is, it fits a straight line y = α + β x, - * (where y is the response variable, x is the predictor variable, - * α is the y-intercept, and β is the slope) - * that minimizes the sum of squared residuals of the linear regression model. - * It also computes associated statistics, including the coefficient of - * determination R2 and the standard deviation of the - * estimates for the slope and y-intercept. - * - * Source code: http://algs4.cs.princeton.edu/14analysis/LinearRegression.java - * (GPLv3 License) - * - * @author Robert Sedgewick - * @author Kevin Wayne - */ -public class LinearRegression { - private final int N; - private final double intercept, slope; - private final double R2; - private final double svar, svar0, svar1; - - /** - * Performs a linear regression on the data points (y[i], x[i]). - * - * @param x the values of the predictor variable - * @param y the corresponding values of the response variable - * @throws IllegalArgumentException if the lengths of the two arrays are not equal - */ - public LinearRegression(double[] x, double[] y) { - if (x.length != y.length) { - throw new IllegalArgumentException("Array lengths are not equal"); - } - N = x.length; - - // first pass - double sumx = 0.0, sumy = 0.0; - for (int i = 0; i < N; i++) - sumx += x[i]; - for (int i = 0; i < N; i++) { - } - for (int i = 0; i < N; i++) - sumy += y[i]; - double xbar = sumx / N; - double ybar = sumy / N; - - // second pass: compute summary statistics - double xxbar = 0.0, yybar = 0.0, xybar = 0.0; - for (int i = 0; i < N; i++) { - xxbar += (x[i] - xbar) * (x[i] - xbar); - yybar += (y[i] - ybar) * (y[i] - ybar); - xybar += (x[i] - xbar) * (y[i] - ybar); - } - slope = xybar / xxbar; - intercept = ybar - slope * xbar; - - // more statistical analysis - double rss = 0.0; // residual sum of squares - double ssr = 0.0; // regression sum of squares - for (int i = 0; i < N; i++) { - double fit = slope*x[i] + intercept; - rss += (fit - y[i]) * (fit - y[i]); - ssr += (fit - ybar) * (fit - ybar); - } - - int degreesOfFreedom = N-2; - R2 = ssr / yybar; - svar = rss / degreesOfFreedom; - svar1 = svar / xxbar; - svar0 = svar/N + xbar*xbar*svar1; - } - - /** - * Returns the y-intercept α of the best of the best-fit line y = α + β x. - * - * @return the y-intercept α of the best-fit line y = α + β x - */ - public double intercept() { - return intercept; - } - - /** - * Returns the slope β of the best of the best-fit line y = α + β x. - * - * @return the slope β of the best-fit line y = α + β x - */ - public double slope() { - return slope; - } - - /** - * Returns the coefficient of determination R2. - * - * @return the coefficient of determination R2, - * which is a real number between 0 and 1 - */ - public double R2() { - return R2; - } - - /** - * Returns the standard error of the estimate for the intercept. - * - * @return the standard error of the estimate for the intercept - */ - public double interceptStdErr() { - return Math.sqrt(svar0); - } - - /** - * Returns the standard error of the estimate for the slope. - * - * @return the standard error of the estimate for the slope - */ - public double slopeStdErr() { - return Math.sqrt(svar1); - } - - /** - * Returns the expected response y given the value of the predictor - * variable x. - * - * @param x the value of the predictor variable - * @return the expected response y given the value of the predictor - * variable x - */ - public double predict(double x) { - return slope*x + intercept; - } - - /** - * Returns a string representation of the simple linear regression model. - * - * @return a string representation of the simple linear regression model, - * including the best-fit line and the coefficient of determination - * R2 - */ - @Override - public String toString() { - String s = ""; - s += String.format("%.2f N + %.2f", slope(), intercept()); - return s + " (R^2 = " + String.format("%.3f", R2()) + ")"; - } - - -} From f5e8a8cca4dc835f4b5c93f72d40a1e7c9314e0e Mon Sep 17 00:00:00 2001 From: Piero Dalle Pezze Date: Tue, 10 Apr 2018 15:22:44 +0000 Subject: [PATCH 3/6] #5 added WARN/FAIL thresholds --- Configuration/limits.txt | 50 ++++++++++++----- uk/ac/babraham/BamQC/Graphs/ScatterGraph.java | 1 - .../BamQC/Modules/BasicStatistics.java | 4 +- .../BamQC/Modules/ChromosomeReadDensity.java | 9 +++ .../BamQC/Modules/FeatureCoverage.java | 4 +- .../BamQC/Modules/GenomeCoverage.java | 27 ++++++--- .../BamQC/Modules/IndelFrequencies.java | 55 ++++++++++++++++--- .../BamQC/Modules/SNPFrequencies.java | 32 +++++++++-- .../BamQC/Modules/SNPFrequenciesByType.java | 33 +++++++++-- .../BamQC/Modules/SoftClipDistribution.java | 23 ++++++++ 10 files changed, 191 insertions(+), 47 deletions(-) diff --git a/Configuration/limits.txt b/Configuration/limits.txt index 47f6be2..6da8c7d 100644 --- a/Configuration/limits.txt +++ b/Configuration/limits.txt @@ -7,47 +7,67 @@ GenomeCoverage ignore 0 IndelFrequencies ignore 0 InsertLengthDistribution ignore 0 MappingQualityDistribution ignore 0 +# deprecated SequenceQualityDistribution ignore 1 SNPFrequencies ignore 0 SNPFrequenciesByType ignore 0 SoftClipDistribution ignore 0 -# The following option switches off InsertFrequencies, SNPFrequencies, SNPFrequenciesByType and some statistics in BasicStatistics +# The following option switches off InsertFrequencies, SNPFrequencies, +# SNPFrequenciesByType and some statistics in BasicStatistics VariantCallDetection ignore 0 # BasicStatistics module -BasicStatistics_tot_seq_threshold warn 0 -BasicStatistics_tot_seq_threshold error 0 +BasicStatistics_min_tot_seq_threshold warn 0 +BasicStatistics_min_tot_seq_threshold error 0 BasicStatistics_unmapped_percent_threshold warn 50 BasicStatistics_unmapped_percent_threshold error 90 # ChromosomeReadDensity Module -#ChromosomeReadDensity +ChromosomeReadDensity_readNumber_threshold warn 25 +ChromosomeReadDensity_readNumber_threshold error 10 + + +# GenomeCoverage module +GenomeCoverage_plot_type_chromosomes_threshold ignore 50 +GenomeCoverage_plot_bins_all_chromosomes ignore 5000 +GenomeCoverage_plot_bins_per_chromosome ignore 500 +GenomeCoverage_uncovered_genome_percent_threshold error 10 +GenomeCoverage_uncovered_genome_percent_threshold warn 5 -# Annotation Module -AnnotationSet_annotation_cache_capacity ignore 50000 # Indel/SNP modules VariantCallPosition_indel_seqpercent_xaxis_threshold ignore 5 -VariantCallPosition_indel_threshold warn 0.5 -VariantCallPosition_indel_threshold error 1 +VariantCallPosition_indel_max_freq_threshold warn 5 +VariantCallPosition_indel_max_freq_threshold error 25 VariantCallPosition_snp_seqpercent_xaxis_threshold ignore 5 -VariantCallPosition_snp_threshold warn 1 -VariantCallPosition_snp_threshold error 2 +VariantCallPosition_snp_max_freq_threshold warn 5 +VariantCallPosition_snp_max_freq_threshold error 25 +VariantCallPosition_snp_max_freq_by_type_threshold warn 0.5 +VariantCallPosition_snp_max_freq_by_type_threshold error 2.5 -# Genome Coverage module -GenomeCoverage_plot_type_chromosomes_threshold ignore 50 -GenomeCoverage_plot_bins_all_chromosomes ignore 5000 -GenomeCoverage_plot_bins_per_chromosome ignore 500 # Insert Length Distribution module InsertLengthDistribution_max_insert_size ignore 10000.0 InsertLengthDistribution_bin_size ignore 1.0 InsertLengthDistribution_percentage_deviation error 50.0 InsertLengthDistribution_percentage_deviation warn 75.0 - + + # MappingQualityDistribution module MappingQualityDistribution_fraction error 0.50 MappingQualityDistribution_fraction warn 0.75 + +# SoftClipDistribution module +SoftClipDistribution_clip_number_threshold error 100 +SoftClipDistribution_clip_number_threshold warn 25 + + +# Annotation Module +AnnotationSet_annotation_cache_capacity ignore 50000 + + +# ------- EXPLICIT THRESHOLDS NOT YET IMPLEMENTED -------- # +# FeatureCoverage module diff --git a/uk/ac/babraham/BamQC/Graphs/ScatterGraph.java b/uk/ac/babraham/BamQC/Graphs/ScatterGraph.java index 1f9b94f..8f79f63 100644 --- a/uk/ac/babraham/BamQC/Graphs/ScatterGraph.java +++ b/uk/ac/babraham/BamQC/Graphs/ScatterGraph.java @@ -35,7 +35,6 @@ import java.awt.event.MouseEvent; import java.awt.geom.AffineTransform; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.Random; diff --git a/uk/ac/babraham/BamQC/Modules/BasicStatistics.java b/uk/ac/babraham/BamQC/Modules/BasicStatistics.java index cacb3b0..68f3f99 100644 --- a/uk/ac/babraham/BamQC/Modules/BasicStatistics.java +++ b/uk/ac/babraham/BamQC/Modules/BasicStatistics.java @@ -51,8 +51,8 @@ */ public class BasicStatistics extends AbstractQCModule { - private static final double ERROR_ACTUAL_COUNT = ModuleConfig.getParam("BasicStatistics_tot_seq_threshold", "error"); - private static final double WARNING_ACTUAL_COUNT = ModuleConfig.getParam("BasicStatistics_tot_seq_threshold", "warn"); + private static final double ERROR_ACTUAL_COUNT = ModuleConfig.getParam("BasicStatistics_min_tot_seq_threshold", "error"); + private static final double WARNING_ACTUAL_COUNT = ModuleConfig.getParam("BasicStatistics_min_tot_seq_threshold", "warn"); private static final double ERROR_UNMAPPED_PERCENT = ModuleConfig.getParam("BasicStatistics_unmapped_percent_threshold", "error"); private static final double WARNING_UNMAPPED_PERCENT = ModuleConfig.getParam("BasicStatistics_unmapped_percent_threshold", "warn"); diff --git a/uk/ac/babraham/BamQC/Modules/ChromosomeReadDensity.java b/uk/ac/babraham/BamQC/Modules/ChromosomeReadDensity.java index 75205eb..bf6dfa9 100644 --- a/uk/ac/babraham/BamQC/Modules/ChromosomeReadDensity.java +++ b/uk/ac/babraham/BamQC/Modules/ChromosomeReadDensity.java @@ -49,6 +49,9 @@ */ public class ChromosomeReadDensity extends AbstractQCModule { + private static final double ERROR_READ_NUMBER = ModuleConfig.getParam("ChromosomeReadDensity_readNumber_threshold", "error"); + private static final double WARNING_READ_NUMBER = ModuleConfig.getParam("ChromosomeReadDensity_readNumber_threshold", "warn"); + private String [] chromosomeNames; private double [] readNumber; private double [] chromosomeLength; @@ -175,11 +178,17 @@ public void reset() { } @Override public boolean raisesError() { + if(readNumber.length < ERROR_READ_NUMBER) { + return true; + } return false; } @Override public boolean raisesWarning() { + if(readNumber.length < WARNING_READ_NUMBER) { + return true; + } return false; } diff --git a/uk/ac/babraham/BamQC/Modules/FeatureCoverage.java b/uk/ac/babraham/BamQC/Modules/FeatureCoverage.java index f743348..3263d15 100644 --- a/uk/ac/babraham/BamQC/Modules/FeatureCoverage.java +++ b/uk/ac/babraham/BamQC/Modules/FeatureCoverage.java @@ -113,13 +113,13 @@ public void reset() { } @Override public boolean raisesError() { + if(datasetIsEmpty) + return true; return false; } @Override public boolean raisesWarning() { - if(datasetIsEmpty) - return true; return false; } diff --git a/uk/ac/babraham/BamQC/Modules/GenomeCoverage.java b/uk/ac/babraham/BamQC/Modules/GenomeCoverage.java index 318eae8..86edbba 100644 --- a/uk/ac/babraham/BamQC/Modules/GenomeCoverage.java +++ b/uk/ac/babraham/BamQC/Modules/GenomeCoverage.java @@ -48,17 +48,21 @@ public class GenomeCoverage extends AbstractQCModule { // logger private static Logger log = Logger.getLogger(GenomeCoverage.class); - private int plotTypeChromosomesThreshold = ModuleConfig.getParam("GenomeCoverage_plot_type_chromosomes_threshold", "ignore").intValue(); + private static final double ERROR_UNCOVERED_GENOME_PERCENT_THRESHOLD = ModuleConfig.getParam("GenomeCoverage_uncovered_genome_percent_threshold", "error"); + private static final double WARNING_UNCOVERED_GENOME_PERCENT_THRESHOLD = ModuleConfig.getParam("GenomeCoverage_uncovered_genome_percent_threshold", "warn"); + private static final int PLOT_TYPE_CHROMOSOMES_THRESHOLD = ModuleConfig.getParam("GenomeCoverage_plot_type_chromosomes_threshold", "ignore").intValue(); + + private long regionsWithNoCoverage = 0L; private String [] chromosomeNames = null; private double [][] binCounts = null; private long [] coverage = null; private double maxCoverage = 0.0; + private int binsToUse = 0; private int maxBins = 1; - @Override public void processSequence(SAMRecord read) { } @@ -84,11 +88,19 @@ public void reset() { @Override public boolean raisesError() { + long binCountsSize = chromosomeNames.length * binsToUse; + if(100.0d * regionsWithNoCoverage / binCountsSize > ERROR_UNCOVERED_GENOME_PERCENT_THRESHOLD) { + return true; + } return false; } @Override public boolean raisesWarning() { + long binCountsSize = chromosomeNames.length * binsToUse; + if(100.0d * regionsWithNoCoverage / binCountsSize > WARNING_UNCOVERED_GENOME_PERCENT_THRESHOLD) { + return true; + } return false; } @@ -107,7 +119,7 @@ public void processAnnotationSet(AnnotationSet annotation) { Chromosome [] chromosomes = annotation.chromosomeFactory().getAllChromosomes(); - if(chromosomes.length <= plotTypeChromosomesThreshold) { + if(chromosomes.length <= PLOT_TYPE_CHROMOSOMES_THRESHOLD) { // This will plot the chromosomes from 1 (top) to n (bottom) Arrays.sort(chromosomes, Collections.reverseOrder()); } else { @@ -133,7 +145,7 @@ public void processAnnotationSet(AnnotationSet annotation) { // configuration of how many bins per chromosome we want to plot. // This is the number of bins per chromosome for the official plot getResultsPanel() int plotBinsPerChromosome = 0; - if(chromosomeNames.length <= plotTypeChromosomesThreshold) { + if(chromosomeNames.length <= PLOT_TYPE_CHROMOSOMES_THRESHOLD) { plotBinsPerChromosome = ModuleConfig.getParam("GenomeCoverage_plot_bins_per_chromosome", "ignore").intValue(); } else { plotBinsPerChromosome = ModuleConfig.getParam("GenomeCoverage_plot_bins_all_chromosomes", "ignore").intValue(); @@ -144,7 +156,7 @@ public void processAnnotationSet(AnnotationSet annotation) { } } - int binsToUse = plotBinsPerChromosome; + binsToUse = plotBinsPerChromosome; double binRatio = maxBins/(double)plotBinsPerChromosome; @@ -154,7 +166,7 @@ public void processAnnotationSet(AnnotationSet annotation) { } log.debug("chromosomeNames.length: " + chromosomeNames.length); - log.debug("plotTypeChromosomesThreshold: " + plotTypeChromosomesThreshold); + log.debug("plotTypeChromosomesThreshold: " + PLOT_TYPE_CHROMOSOMES_THRESHOLD); log.debug("plotBinsPerChromosome: " + plotBinsPerChromosome); log.debug("maxBins: " + maxBins); log.debug("binRatio: " + binRatio); @@ -192,6 +204,7 @@ public void processAnnotationSet(AnnotationSet annotation) { if(binCounts[c][i] <= 0) { // Let's label these points having null coverage so that we don't miss them binCounts[c][i] = Double.NEGATIVE_INFINITY; + regionsWithNoCoverage++; continue; } // scale to log to enlarge the data differences. log_e makes it smaller than log_10. @@ -227,7 +240,7 @@ public JPanel getResultsPanel() { chromosomeNames[i] = chromosomeNames[i].substring(3); } - if(chromosomeNames.length <= plotTypeChromosomesThreshold) { + if(chromosomeNames.length <= PLOT_TYPE_CHROMOSOMES_THRESHOLD) { // plots the genome coverage for each chromosome separately return getSeparateChromosomeResultsPanel(); } diff --git a/uk/ac/babraham/BamQC/Modules/IndelFrequencies.java b/uk/ac/babraham/BamQC/Modules/IndelFrequencies.java index c73d215..a476a91 100644 --- a/uk/ac/babraham/BamQC/Modules/IndelFrequencies.java +++ b/uk/ac/babraham/BamQC/Modules/IndelFrequencies.java @@ -49,6 +49,9 @@ public class IndelFrequencies extends AbstractQCModule { private static Logger log = Logger.getLogger(IndelFrequencies.class); + private static final double ERROR_INDEL_MAX_FREQ = ModuleConfig.getParam("VariantCallPosition_indel_max_freq_threshold", "error"); + private static final double WARNING_INDEL_MAX_FREQ = ModuleConfig.getParam("VariantCallPosition_indel_max_freq_threshold", "warn"); + private String[] indelNames = {"Deletions", "Insertions"}; double[] dFirstDeletionPos = null; @@ -214,19 +217,55 @@ public void reset() { } @Override public boolean raisesError() { - double indelPercent = 100.0d*(variantCallDetection.getTotalDeletions() + variantCallDetection.getTotalInsertions() ) - / variantCallDetection.getTotal(); - if(indelPercent > ModuleConfig.getParam("VariantCallPosition_indel_threshold", "error").doubleValue()) - return true; + for(int i=0; i ERROR_INDEL_MAX_FREQ) { + return true; + } + } + for(int i=0; i ERROR_INDEL_MAX_FREQ) { + return true; + } + } + if(variantCallDetection.existPairedReads()) { + for(int i=0; i ERROR_INDEL_MAX_FREQ) { + return true; + } + } + for(int i=0; i ERROR_INDEL_MAX_FREQ) { + return true; + } + } + } return false; } @Override public boolean raisesWarning() { - double indelPercent = 100.0d*(variantCallDetection.getTotalDeletions() + variantCallDetection.getTotalInsertions() ) - / variantCallDetection.getTotal(); - if(indelPercent > ModuleConfig.getParam("VariantCallPosition_indel_threshold", "warn").doubleValue()) - return true; + for(int i=0; i WARNING_INDEL_MAX_FREQ) { + return true; + } + } + for(int i=0; i WARNING_INDEL_MAX_FREQ) { + return true; + } + } + if(variantCallDetection.existPairedReads()) { + for(int i=0; i WARNING_INDEL_MAX_FREQ) { + return true; + } + } + for(int i=0; i WARNING_INDEL_MAX_FREQ) { + return true; + } + } + } return false; } diff --git a/uk/ac/babraham/BamQC/Modules/SNPFrequencies.java b/uk/ac/babraham/BamQC/Modules/SNPFrequencies.java index 898bc8d..81d7832 100644 --- a/uk/ac/babraham/BamQC/Modules/SNPFrequencies.java +++ b/uk/ac/babraham/BamQC/Modules/SNPFrequencies.java @@ -49,6 +49,8 @@ public class SNPFrequencies extends AbstractQCModule { private static Logger log = Logger.getLogger(SNPFrequencies.class); + private static final double ERROR_SNP_MAX_FREQ = ModuleConfig.getParam("VariantCallPosition_snp_max_freq_threshold", "error"); + private static final double WARNING_SNP_MAX_FREQ = ModuleConfig.getParam("VariantCallPosition_snp_max_freq_threshold", "warn"); double[] dFirstSNPPos = null; double[] dSecondSNPPos = null; @@ -202,17 +204,35 @@ public void reset() { } @Override public boolean raisesError() { - double snpPercent = 100.0d*(variantCallDetection.getTotalMutations()) / variantCallDetection.getTotal(); - if(snpPercent > ModuleConfig.getParam("VariantCallPosition_snp_threshold", "error").doubleValue()) - return true; + for(int i=0; i ERROR_SNP_MAX_FREQ) { + return true; + } + } + if(variantCallDetection.existPairedReads()) { + for(int i=0; i ERROR_SNP_MAX_FREQ) { + return true; + } + } + } return false; } @Override public boolean raisesWarning() { - double snpPercent = 100.0d*(variantCallDetection.getTotalMutations()) / variantCallDetection.getTotal(); - if(snpPercent > ModuleConfig.getParam("VariantCallPosition_snp_threshold", "warn").doubleValue()) - return true; + for(int i=0; i WARNING_SNP_MAX_FREQ) { + return true; + } + } + if(variantCallDetection.existPairedReads()) { + for(int i=0; i WARNING_SNP_MAX_FREQ) { + return true; + } + } + } return false; } diff --git a/uk/ac/babraham/BamQC/Modules/SNPFrequenciesByType.java b/uk/ac/babraham/BamQC/Modules/SNPFrequenciesByType.java index 755bfc2..bf20ec8 100644 --- a/uk/ac/babraham/BamQC/Modules/SNPFrequenciesByType.java +++ b/uk/ac/babraham/BamQC/Modules/SNPFrequenciesByType.java @@ -57,6 +57,9 @@ public class SNPFrequenciesByType extends AbstractQCModule { //private static Logger log = Logger.getLogger(SNPFrequenciesByType.class); + private static final double ERROR_SNP_MAX_FREQ_BY_TYPE = ModuleConfig.getParam("VariantCallPosition_snp_max_freq_by_type_threshold", "error"); + private static final double WARNING_SNP_MAX_FREQ_BY_TYPE = ModuleConfig.getParam("VariantCallPosition_snp_max_freq_by_type_threshold", "warn"); + // original threshold for the plot x axis. private double firstMaxX=0.0d; private double secondMaxX=0.0d; @@ -171,17 +174,35 @@ public void reset() { } @Override public boolean raisesError() { - double snpPercent = 100.0d*(variantCallDetection.getTotalMutations()) / variantCallDetection.getTotal(); - if(snpPercent > ModuleConfig.getParam("VariantCallPosition_snp_threshold", "error").doubleValue()) - return true; + for(int i=0; i ERROR_SNP_MAX_FREQ_BY_TYPE) { + return true; + } + } + if(variantCallDetection.existPairedReads()) { + for(int i=0; i ERROR_SNP_MAX_FREQ_BY_TYPE) { + return true; + } + } + } return false; } @Override public boolean raisesWarning() { - double snpPercent = 100.0d*(variantCallDetection.getTotalMutations()) / variantCallDetection.getTotal(); - if(snpPercent > ModuleConfig.getParam("VariantCallPosition_snp_threshold", "warn").doubleValue()) - return true; + for(int i=0; i WARNING_SNP_MAX_FREQ_BY_TYPE) { + return true; + } + } + if(variantCallDetection.existPairedReads()) { + for(int i=0; i WARNING_SNP_MAX_FREQ_BY_TYPE) { + return true; + } + } + } return false; } diff --git a/uk/ac/babraham/BamQC/Modules/SoftClipDistribution.java b/uk/ac/babraham/BamQC/Modules/SoftClipDistribution.java index 3396e8a..f417013 100644 --- a/uk/ac/babraham/BamQC/Modules/SoftClipDistribution.java +++ b/uk/ac/babraham/BamQC/Modules/SoftClipDistribution.java @@ -52,6 +52,9 @@ public class SoftClipDistribution extends AbstractQCModule { // logger private static Logger log = Logger.getLogger(SoftClipDistribution.class); + private static final long ERROR_CLIP_NUMBER = ModuleConfig.getParam("SoftClipDistribution_clip_number_threshold", "error").longValue(); + private static final long WARNING_CLIP_NUMBER = ModuleConfig.getParam("SoftClipDistribution_clip_number_threshold", "warn").longValue(); + private long [] leftClipCounts = new long[1]; private long [] rightClipCounts = new long[1]; @@ -172,11 +175,31 @@ public void reset() { @Override public boolean raisesError() { + for(int i=0; i ERROR_CLIP_NUMBER) { + return true; + } + } + for(int i=0; i ERROR_CLIP_NUMBER) { + return true; + } + } return false; } @Override public boolean raisesWarning() { + for(int i=0; i WARNING_CLIP_NUMBER) { + return true; + } + } + for(int i=0; i WARNING_CLIP_NUMBER) { + return true; + } + } return false; } From 8fa1f1fe1c98dce9f79da9484a2756b3870e860a Mon Sep 17 00:00:00 2001 From: Piero Dalle Pezze Date: Tue, 10 Apr 2018 15:23:14 +0000 Subject: [PATCH 4/6] assert update --- .../uk/ac/babraham/BamQC/Modules/ChromosomeDensityTest.java | 4 ++-- .../java/uk/ac/babraham/BamQC/Modules/GenomeCoverageTest.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/java/uk/ac/babraham/BamQC/Modules/ChromosomeDensityTest.java b/test/java/uk/ac/babraham/BamQC/Modules/ChromosomeDensityTest.java index 450fc58..21581a5 100644 --- a/test/java/uk/ac/babraham/BamQC/Modules/ChromosomeDensityTest.java +++ b/test/java/uk/ac/babraham/BamQC/Modules/ChromosomeDensityTest.java @@ -143,8 +143,8 @@ public void testBooleans() { assertFalse(chromosomeReadDensity.ignoreInReport()); assertTrue(chromosomeReadDensity.needsToSeeAnnotation()); - assertFalse(chromosomeReadDensity.raisesError()); - assertFalse(chromosomeReadDensity.raisesWarning()); + assertTrue(chromosomeReadDensity.raisesError()); + assertTrue(chromosomeReadDensity.raisesWarning()); assertFalse(chromosomeReadDensity.needsToSeeSequences()); } diff --git a/test/java/uk/ac/babraham/BamQC/Modules/GenomeCoverageTest.java b/test/java/uk/ac/babraham/BamQC/Modules/GenomeCoverageTest.java index 8050429..fe66b15 100644 --- a/test/java/uk/ac/babraham/BamQC/Modules/GenomeCoverageTest.java +++ b/test/java/uk/ac/babraham/BamQC/Modules/GenomeCoverageTest.java @@ -126,8 +126,8 @@ public void testBooleans() { assertFalse(genomeCoverage.ignoreInReport()); assertTrue(genomeCoverage.needsToSeeAnnotation()); - assertFalse(genomeCoverage.raisesError()); - assertFalse(genomeCoverage.raisesWarning()); + assertTrue(genomeCoverage.raisesError()); + assertTrue(genomeCoverage.raisesWarning()); assertFalse(genomeCoverage.needsToSeeSequences()); } From a3dd9ded37dd25169f84630152c24d2feb727f07 Mon Sep 17 00:00:00 2001 From: Piero Dalle Pezze Date: Tue, 10 Apr 2018 15:52:40 +0000 Subject: [PATCH 5/6] increased height for the `About` dialogue. --- uk/ac/babraham/BamQC/BamQCApplication.java | 2 +- uk/ac/babraham/BamQC/Dialogs/AboutDialog.java | 154 +++++++++--------- 2 files changed, 78 insertions(+), 78 deletions(-) diff --git a/uk/ac/babraham/BamQC/BamQCApplication.java b/uk/ac/babraham/BamQC/BamQCApplication.java index 554cdf7..cc49a06 100644 --- a/uk/ac/babraham/BamQC/BamQCApplication.java +++ b/uk/ac/babraham/BamQC/BamQCApplication.java @@ -76,7 +76,7 @@ public class BamQCApplication extends JFrame implements ProgressListener { private static final long serialVersionUID = -1761781589885333860L; - public static final String VERSION = "0.1.25_devel"; + public static final String VERSION = "0.1.30_devel"; private BamQCMenuBar menu; diff --git a/uk/ac/babraham/BamQC/Dialogs/AboutDialog.java b/uk/ac/babraham/BamQC/Dialogs/AboutDialog.java index b26cd4a..e9b629e 100644 --- a/uk/ac/babraham/BamQC/Dialogs/AboutDialog.java +++ b/uk/ac/babraham/BamQC/Dialogs/AboutDialog.java @@ -1,77 +1,77 @@ -/** - * Copyright Copyright 2010-14 Simon Andrews - * - * This file is part of BamQC. - * - * BamQC is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * BamQC is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with BamQC; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ -/* - * Changelog: - * - Simon Andrews: Class creation. - */ -package uk.ac.babraham.BamQC.Dialogs; - -import javax.swing.*; - -import uk.ac.babraham.BamQC.BamQCApplication; - -import java.awt.*; -import java.awt.event.*; - -/** - * Shows the generic about dialog giving details of the current version - * and copyright assignments. This is just a thin shell around the - * BamQCTitlePanel which actually holds the relevant information and - * which is also used on the welcome screen. - * @author Simon Andrews - */ -public class AboutDialog extends JDialog { - private static final long serialVersionUID = 1L; - - /** - * Instantiates a new about dialog. - * - * @param a The BamQC application. - */ - public AboutDialog(BamQCApplication a) { - super(a); - setTitle("About BamQC..."); - Container cont = getContentPane(); - cont.setLayout(new BorderLayout()); - - add(new BamQCTitlePanel(),BorderLayout.CENTER); - - JPanel buttonPanel = new JPanel(); - - JButton closeButton = new JButton("Close"); - getRootPane().setDefaultButton(closeButton); - closeButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent arg0) { - setVisible(false); - dispose(); - } - }); - buttonPanel.add(closeButton); - - cont.add(buttonPanel,BorderLayout.SOUTH); - - setSize(650,280); - setLocationRelativeTo(a); - setResizable(false); - setVisible(true); - } - -} +/** + * Copyright Copyright 2010-14 Simon Andrews + * + * This file is part of BamQC. + * + * BamQC is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * BamQC is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with BamQC; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ +/* + * Changelog: + * - Simon Andrews: Class creation. + */ +package uk.ac.babraham.BamQC.Dialogs; + +import javax.swing.*; + +import uk.ac.babraham.BamQC.BamQCApplication; + +import java.awt.*; +import java.awt.event.*; + +/** + * Shows the generic about dialog giving details of the current version + * and copyright assignments. This is just a thin shell around the + * BamQCTitlePanel which actually holds the relevant information and + * which is also used on the welcome screen. + * @author Simon Andrews + */ +public class AboutDialog extends JDialog { + private static final long serialVersionUID = 1L; + + /** + * Instantiates a new about dialog. + * + * @param a The BamQC application. + */ + public AboutDialog(BamQCApplication a) { + super(a); + setTitle("About BamQC..."); + Container cont = getContentPane(); + cont.setLayout(new BorderLayout()); + + add(new BamQCTitlePanel(),BorderLayout.CENTER); + + JPanel buttonPanel = new JPanel(); + + JButton closeButton = new JButton("Close"); + getRootPane().setDefaultButton(closeButton); + closeButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent arg0) { + setVisible(false); + dispose(); + } + }); + buttonPanel.add(closeButton); + + cont.add(buttonPanel,BorderLayout.SOUTH); + + setSize(650,380); + setLocationRelativeTo(a); + setResizable(false); + setVisible(true); + } + +} From 8c1f01750e3f6f961bcf98ec608878238c554a31 Mon Sep 17 00:00:00 2001 From: Piero Dalle Pezze Date: Wed, 11 Apr 2018 13:46:03 +0000 Subject: [PATCH 6/6] updated descriptions about warning/failure --- Configuration/limits.txt | 78 ++++++++++--------- .../1 Basic Statistics.html | 7 +- .../10 Insert Length Distribution.html | 4 +- .../3 Analysis Modules/2 Genome Coverage.html | 6 +- .../3 Chromosome Read Density.html | 6 +- .../4 Feature Coverage.html | 8 +- .../5 Soft Clip Length Distributions.html | 9 ++- .../6 Indel Frequencies.html | 8 +- .../3 Analysis Modules/7 SNP Frequencies.html | 8 +- .../8 SNP Frequencies by Type.html | 8 +- .../BamQC/Modules/BasicStatistics.java | 9 +-- 11 files changed, 80 insertions(+), 71 deletions(-) diff --git a/Configuration/limits.txt b/Configuration/limits.txt index 6da8c7d..f422552 100644 --- a/Configuration/limits.txt +++ b/Configuration/limits.txt @@ -1,33 +1,41 @@ +# BamQC configuration file + +#################### +# MODULE SELECTION # +#################### + # For each of the modules you can choose to not run that # module at all by setting the value below to 1 for the # modules you want to remove. -ChromosomeReadDensity ignore 0 -FeatureCoverage ignore 0 -GenomeCoverage ignore 0 -IndelFrequencies ignore 0 -InsertLengthDistribution ignore 0 -MappingQualityDistribution ignore 0 +ChromosomeReadDensity ignore 0 +FeatureCoverage ignore 0 +GenomeCoverage ignore 0 +IndelFrequencies ignore 0 +InsertLengthDistribution ignore 0 +MappingQualityDistribution ignore 0 # deprecated -SequenceQualityDistribution ignore 1 -SNPFrequencies ignore 0 -SNPFrequenciesByType ignore 0 -SoftClipDistribution ignore 0 -# The following option switches off InsertFrequencies, SNPFrequencies, -# SNPFrequenciesByType and some statistics in BasicStatistics -VariantCallDetection ignore 0 +SequenceQualityDistribution ignore 1 +SNPFrequencies ignore 0 +SNPFrequenciesByType ignore 0 +SoftClipDistribution ignore 0 +# The following option turns off InsertFrequencies, +# SNPFrequencies, SNPFrequenciesByType, +# and some statistics in BasicStatistics +VariantCallDetection ignore 0 -# BasicStatistics module -BasicStatistics_min_tot_seq_threshold warn 0 -BasicStatistics_min_tot_seq_threshold error 0 -BasicStatistics_unmapped_percent_threshold warn 50 -BasicStatistics_unmapped_percent_threshold error 90 +############################## +# MODULE-SPECIFIC THRESHOLDS # +############################## -# ChromosomeReadDensity Module -ChromosomeReadDensity_readNumber_threshold warn 25 -ChromosomeReadDensity_readNumber_threshold error 10 +# BasicStatistics module +BasicStatistics_unmapped_percent_threshold warn 50 +BasicStatistics_unmapped_percent_threshold error 90 +# ChromosomeReadDensity Module +ChromosomeReadDensity_readNumber_threshold warn 25 +ChromosomeReadDensity_readNumber_threshold error 10 # GenomeCoverage module GenomeCoverage_plot_type_chromosomes_threshold ignore 50 @@ -36,7 +44,6 @@ GenomeCoverage_plot_bins_per_chromosome ignore 500 GenomeCoverage_uncovered_genome_percent_threshold error 10 GenomeCoverage_uncovered_genome_percent_threshold warn 5 - # Indel/SNP modules VariantCallPosition_indel_seqpercent_xaxis_threshold ignore 5 VariantCallPosition_indel_max_freq_threshold warn 5 @@ -47,27 +54,26 @@ VariantCallPosition_snp_max_freq_threshold error 25 VariantCallPosition_snp_max_freq_by_type_threshold warn 0.5 VariantCallPosition_snp_max_freq_by_type_threshold error 2.5 - # Insert Length Distribution module -InsertLengthDistribution_max_insert_size ignore 10000.0 -InsertLengthDistribution_bin_size ignore 1.0 -InsertLengthDistribution_percentage_deviation error 50.0 -InsertLengthDistribution_percentage_deviation warn 75.0 - +InsertLengthDistribution_max_insert_size ignore 10000.0 +InsertLengthDistribution_bin_size ignore 1.0 +InsertLengthDistribution_percentage_deviation error 75.0 +InsertLengthDistribution_percentage_deviation warn 50.0 # MappingQualityDistribution module -MappingQualityDistribution_fraction error 0.50 -MappingQualityDistribution_fraction warn 0.75 - +MappingQualityDistribution_fraction error 0.50 +MappingQualityDistribution_fraction warn 0.75 # SoftClipDistribution module -SoftClipDistribution_clip_number_threshold error 100 -SoftClipDistribution_clip_number_threshold warn 25 - +SoftClipDistribution_clip_number_threshold error 100 +SoftClipDistribution_clip_number_threshold warn 25 # Annotation Module -AnnotationSet_annotation_cache_capacity ignore 50000 +AnnotationSet_annotation_cache_capacity ignore 50000 + -# ------- EXPLICIT THRESHOLDS NOT YET IMPLEMENTED -------- # +################################################# +# MODULES WITH CURRENTLY NO EXPLICIT THRESHOLDS # +################################################# # FeatureCoverage module diff --git a/Help/3 Analysis Modules/1 Basic Statistics.html b/Help/3 Analysis Modules/1 Basic Statistics.html index 34846f0..fd6cce1 100644 --- a/Help/3 Analysis Modules/1 Basic Statistics.html +++ b/Help/3 Analysis Modules/1 Basic Statistics.html @@ -72,17 +72,18 @@

Summary

Warning

-Basic Statistics never raises a warning. +This module raises a warning if the unmapped sequences are above 50%.

Failure

-Basic Statistics never raises an error. +This module raises an error if the unmapped sequences are above 90%.

Common reasons for warnings

-This module never raises warnings or errors +This module raises warnings or errors if most of the sequences are unmapped. Unmapped +sequences are discarded during variant calling detection.

diff --git a/Help/3 Analysis Modules/10 Insert Length Distribution.html b/Help/3 Analysis Modules/10 Insert Length Distribution.html index f964859..26bfa8e 100644 --- a/Help/3 Analysis Modules/10 Insert Length Distribution.html +++ b/Help/3 Analysis Modules/10 Insert Length Distribution.html @@ -22,12 +22,12 @@

Summary

Warning

Insert Length Distribution raises a warning if the percent deviation is -above 75%. +above 50%.

Failure

-Insert Length Distribution raises a warning if the percent deviation is +Insert Length Distribution raises an error if the percent deviation is above 75%.

diff --git a/Help/3 Analysis Modules/2 Genome Coverage.html b/Help/3 Analysis Modules/2 Genome Coverage.html index 8d1e00d..a3518b7 100644 --- a/Help/3 Analysis Modules/2 Genome Coverage.html +++ b/Help/3 Analysis Modules/2 Genome Coverage.html @@ -27,17 +27,17 @@

Summary

Warning

-Genome Coverage never raises a warning. +This module raises a warning if more than 5% of the genome is uncovered.

Failure

-Genome Coverage never raises an error. +This module raises an error if more than 10% of the genome is uncovered.

Common reasons for warnings

-This module never raises warnings or errors +This module raises warnings or errors if a part of the genome is uncovered by the sequences.

diff --git a/Help/3 Analysis Modules/3 Chromosome Read Density.html b/Help/3 Analysis Modules/3 Chromosome Read Density.html index 7cac967..f6442e3 100644 --- a/Help/3 Analysis Modules/3 Chromosome Read Density.html +++ b/Help/3 Analysis Modules/3 Chromosome Read Density.html @@ -24,17 +24,17 @@

Summary

Warning

-Chromosome Read Density never raises a warning. +This module raises a warning if the number of chromosomes is less than 25.

Failure

-Chromosome Read Density never raises an error. +This module raises an error if the number of chromosomes is less than 10.

Common reasons for warnings

-This module never raises warnings or errors +This module raises warnings or errors if the number of chromosomes is small.

diff --git a/Help/3 Analysis Modules/4 Feature Coverage.html b/Help/3 Analysis Modules/4 Feature Coverage.html index d36dfd6..6c3eba1 100644 --- a/Help/3 Analysis Modules/4 Feature Coverage.html +++ b/Help/3 Analysis Modules/4 Feature Coverage.html @@ -22,18 +22,18 @@

Summary

Warning

-Feature Coverage can raise a warning. +This module never raises a warning.

Failure

-Feature Coverage never raises an error. +This module raises an error if no feature is covered.

Common reasons for warnings

-It can raise a warning if no feature is covered within the Sam/Bam file. -This module never raises an error. +This module can raise an error if no feature is covered within the Sam/Bam file. +This module never raises a warning.

diff --git a/Help/3 Analysis Modules/5 Soft Clip Length Distributions.html b/Help/3 Analysis Modules/5 Soft Clip Length Distributions.html index 2cb7a4f..5a200e2 100644 --- a/Help/3 Analysis Modules/5 Soft Clip Length Distributions.html +++ b/Help/3 Analysis Modules/5 Soft Clip Length Distributions.html @@ -20,17 +20,20 @@

Summary

Warning

-Soft Clip Length Distributions never raises a warning. +This module raises a warning if the number of clips is greater than 25 at any point +along the distribution.

Failure

-Soft Clip Length Distributions never raises an error. +This module raises an error if the number of clips is greater than 100 at any point +along the distribution.

Common reasons for warnings

-This module never raises warnings or errors +This module raises warnings or errors depending on the number of clips along the +distribution.

diff --git a/Help/3 Analysis Modules/6 Indel Frequencies.html b/Help/3 Analysis Modules/6 Indel Frequencies.html index 795daba..e6ce61d 100644 --- a/Help/3 Analysis Modules/6 Indel Frequencies.html +++ b/Help/3 Analysis Modules/6 Indel Frequencies.html @@ -20,17 +20,19 @@

Summary

Warning

-Indel Frequencies raises a warning if the total indel percent is above 0.5%. +This module raises a warning if the maximum frequency of indels is above 5% +at any position of the read. Deletion and insertions are evaluated separately.

Failure

-Indel Frequencies raises an error if the total indel percent is above 1%. +This module raises an error if the maximum frequency of indels is above 25% +at any position of the read. Deletion and insertions are evaluated separately.

Common reasons for warnings

-This module raises warnings or errors if the total indel percent is above a +This module raises warnings or errors if the maximum frequency is above a certain threshold.

diff --git a/Help/3 Analysis Modules/7 SNP Frequencies.html b/Help/3 Analysis Modules/7 SNP Frequencies.html index e448420..d01c5d9 100644 --- a/Help/3 Analysis Modules/7 SNP Frequencies.html +++ b/Help/3 Analysis Modules/7 SNP Frequencies.html @@ -20,17 +20,19 @@

Summary

Warning

-SNP Frequencies raises a warning if the total SNPs percent is above 1%. +This module raises a warning if the maximum frequency of SNPs is above 5% +at any position of the read.

Failure

-SNP Frequencies raises an error if the total SNPs percent is above 2%. +This module raises an error if the maximum frequency of SNPs is above 25% +at any position of the read.

Common reasons for warnings

-This module raises warnings or errors if the total SNPs percent is above a +This module raises warnings or errors if the maximum frequency is above a certain threshold.

diff --git a/Help/3 Analysis Modules/8 SNP Frequencies by Type.html b/Help/3 Analysis Modules/8 SNP Frequencies by Type.html index 0e3f1d9..ee9c50e 100644 --- a/Help/3 Analysis Modules/8 SNP Frequencies by Type.html +++ b/Help/3 Analysis Modules/8 SNP Frequencies by Type.html @@ -20,18 +20,18 @@

Summary

Warning

-SNP Frequencies by Type raises a warning if the total SNPs percent is above 1%. +This module raises a warning if the maximum frequency of at least one SNP is above 0.5%.

Failure

-SNP Frequencies by Type raises an error if the total SNPs percent is above 2%. +This module raises an error if the maximum frequency of at least one SNP is above 2.5%.

Common reasons for warnings

-This module raises warnings or errors if the total SNPs percent is above a -certain threshold. +This module raises warnings or errors if the maximum frequency of at least one SNP +is above a certain threshold.

diff --git a/uk/ac/babraham/BamQC/Modules/BasicStatistics.java b/uk/ac/babraham/BamQC/Modules/BasicStatistics.java index 68f3f99..3373889 100644 --- a/uk/ac/babraham/BamQC/Modules/BasicStatistics.java +++ b/uk/ac/babraham/BamQC/Modules/BasicStatistics.java @@ -51,9 +51,6 @@ */ public class BasicStatistics extends AbstractQCModule { - private static final double ERROR_ACTUAL_COUNT = ModuleConfig.getParam("BasicStatistics_min_tot_seq_threshold", "error"); - private static final double WARNING_ACTUAL_COUNT = ModuleConfig.getParam("BasicStatistics_min_tot_seq_threshold", "warn"); - private static final double ERROR_UNMAPPED_PERCENT = ModuleConfig.getParam("BasicStatistics_unmapped_percent_threshold", "error"); private static final double WARNING_UNMAPPED_PERCENT = ModuleConfig.getParam("BasicStatistics_unmapped_percent_threshold", "warn"); @@ -202,8 +199,7 @@ public void processFile (SequenceFile file) { @Override public boolean raisesError() { - if(actualCount < ERROR_ACTUAL_COUNT || - 100.0f * unmappedCount/actualCount > ERROR_UNMAPPED_PERCENT) { + if(100.0f * unmappedCount/actualCount > ERROR_UNMAPPED_PERCENT) { return true; } return false; @@ -211,8 +207,7 @@ public boolean raisesError() { @Override public boolean raisesWarning() { - if(actualCount < WARNING_ACTUAL_COUNT || - 100.0f * unmappedCount/actualCount > WARNING_UNMAPPED_PERCENT) { + if(100.0f * unmappedCount/actualCount > WARNING_UNMAPPED_PERCENT) { return true; } return false;