Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CollectQualityYieldMetricsFlowSpace tool #1932

Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
29e9052
CollectQualityYieldMetricsFlowSpace dev
dror27 Dec 21, 2023
f1b69fe
add flow read params to test
dror27 Dec 26, 2023
9725c73
Minimimal reported error probability now calculated from the read.
ilyasoifer Dec 27, 2023
9264fab
removed unused flow code
dror27 Dec 28, 2023
b5a041d
remove FLOW_MODE from CollectQualityYieldMatrics
dror27 Dec 28, 2023
20856b9
FlowSpace -> Flow (simplify tool name)
dror27 Dec 28, 2023
8080de6
histograms added
dror27 Dec 31, 2023
65e46fa
histogram update
dror27 Jan 1, 2024
f6fc79f
Cleaner treatment of fillingValue + fixed a bug in parsing T0
ilyasoifer Jan 2, 2024
9893f06
restore test passing
dror27 Jan 2, 2024
9dd738b
Code cleanup + INCLUDE_BQ_HISTOGRAM parameter
dror27 Jan 2, 2024
e9996ed
MEAN_READ_NAME
dror27 Jan 2, 2024
8f4f5f1
remove @Hidden
dror27 Jan 2, 2024
ecdedfb
Fixed crash on unaligned reads, reads with no bases and a typing error
ilyasoifer Jan 3, 2024
a41401f
ceil -> round
ilyasoifer Jan 3, 2024
351988e
PCT_Q20/Q30_FLOWS added
dror27 Jan 7, 2024
da63a41
CollectSNVQualityYieldMetrics tool
dror27 Jan 14, 2024
d9579c5
SNVQ stats
dror27 Jan 15, 2024
f542c85
Quals taken from BQ
dror27 Jan 17, 2024
e78c84c
Small refactoring - PCT_Q20_FLOWS -> PCT_PF_Q20_FLOWS etc.
ilyasoifer Jan 23, 2024
8ed29f5
CollectQualityYieldMetricsFlow changes
dror27 Jan 24, 2024
5fada25
CollectQualityYieldMetricsSNVQTest changes
dror27 Jan 24, 2024
d806ff1
Typo fix
ilyasoifer Jan 24, 2024
aaa0c34
zero base BQ values
dror27 Jan 28, 2024
cd76c23
Update SeriesStats.java
dror27 Jan 28, 2024
14806b8
Cleaner treatment of fillingValue + fixed a bug in parsing T0
ilyasoifer Jan 31, 2024
1576d5b
qual range warnings added
dror27 Jan 31, 2024
8d188c5
code cleanup (of unused methods, etc)
dror27 Feb 12, 2024
7bd235b
various comments addressed
dror27 Feb 19, 2024
780c0da
Rename short name for USE_BQ_FOR_BASE_QUALITIES
dror27 Mar 3, 2024
411a75d
addressing pull request comments
dror27 Apr 25, 2024
59278aa
flow core code moved to picard
dror27 Apr 30, 2024
fd8b16d
test (double,double) assertions made compatible with future test fram…
dror27 Apr 30, 2024
bd50c59
Revert "test (double,double) assertions made compatible with future t…
dror27 Apr 30, 2024
e3d0557
FlowBasedHaplotype removed from picard
dror27 Apr 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 3 additions & 72 deletions src/main/java/picard/analysis/CollectQualityYieldMetrics.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,6 @@ public class CollectQualityYieldMetrics extends SinglePassSamProgram {
"of bases if there are supplemental alignments in the input file.")
public boolean INCLUDE_SUPPLEMENTAL_ALIGNMENTS = false;

@Argument(doc = "If true, calculates flow-specific READ_LENGTH_AVG_Q metrics.")
public boolean FLOW_MODE = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change won't be backwards compatible with the previous version of Picard. That's ok with me since you're probably aware of most Ultima users using this tool, but wanted to note it in case you'd rather throw an error message pointing them to CollectQualityYieldMetricsFlow if they provide FLOW_MODE.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good advice. Restored FLOW_MODE on CollectQualityYieldMetrics. When set, now throws an exception and points to CollectQualityYieldMetricsFlow


/**
* Ensure that we get all reads regardless of alignment status.
*/
Expand All @@ -106,7 +103,7 @@ protected boolean usesNoRefReads() {
@Override
protected void setup(final SAMFileHeader header, final File samFile) {
IOUtil.assertFileIsWritable(OUTPUT);
this.collector = new QualityYieldMetricsCollector(USE_ORIGINAL_QUALITIES, INCLUDE_SECONDARY_ALIGNMENTS, INCLUDE_SUPPLEMENTAL_ALIGNMENTS, FLOW_MODE);
this.collector = new QualityYieldMetricsCollector(USE_ORIGINAL_QUALITIES, INCLUDE_SECONDARY_ALIGNMENTS, INCLUDE_SUPPLEMENTAL_ALIGNMENTS);
}

@Override
Expand Down Expand Up @@ -135,30 +132,16 @@ public static class QualityYieldMetricsCollector {
// of bases if there are supplemental alignments in the input file.
public final boolean includeSupplementalAlignments;

// If true collects RLQ25/RLQ30
private final boolean flowMode;
// The metrics to be accumulated
private final QualityYieldMetrics metrics;

public QualityYieldMetricsCollector(final boolean useOriginalQualities,
final boolean includeSecondaryAlignments,
final boolean includeSupplementalAlignments){
this(useOriginalQualities, includeSecondaryAlignments, includeSupplementalAlignments, false);
}

public QualityYieldMetricsCollector(final boolean useOriginalQualities,
final boolean includeSecondaryAlignments,
final boolean includeSupplementalAlignments,
final boolean flowMode) {
final boolean includeSupplementalAlignments) {
this.useOriginalQualities = useOriginalQualities;
this.includeSecondaryAlignments = includeSecondaryAlignments;
this.includeSupplementalAlignments = includeSupplementalAlignments;
this.flowMode = flowMode;
if (flowMode){
this.metrics = new QualityYieldMetricsFlow(useOriginalQualities);
} else {
this.metrics = new QualityYieldMetrics(useOriginalQualities);
}
this.metrics = new QualityYieldMetrics(useOriginalQualities);
}

public void acceptRecord(final SAMRecord rec, final ReferenceSequence ref) {
Expand Down Expand Up @@ -205,10 +188,6 @@ public void acceptRecord(final SAMRecord rec, final ReferenceSequence ref) {
}
}
}

if (flowMode) {
((QualityYieldMetricsFlow)metrics).addRecordToHistogramGenerator(rec);
}
}

public void finish() {
Expand All @@ -222,54 +201,6 @@ public void addMetricsToFile(final MetricsFile<QualityYieldMetrics, Integer> met
}
}

public static class QualityYieldMetricsFlow extends QualityYieldMetrics{
/** The length of the longest interval on the reads where the average quality per-base is above (Q30) */
@NoMergingIsDerived
public long READ_LENGTH_AVG_Q_ABOVE_30 = 0;

/** The length of the longest interval on the reads where the average quality per-base is above (Q25) */
@NoMergingIsDerived
public long READ_LENGTH_AVG_Q_ABOVE_25 = 0;

@MergingIsManual
protected final HistogramGenerator histogramGenerator;

public QualityYieldMetricsFlow(){
this(false);
}

public QualityYieldMetricsFlow(final boolean useOriginalBaseQualities){

super(useOriginalBaseQualities);
histogramGenerator=new HistogramGenerator(useOriginalQualities);
}

public QualityYieldMetricsFlow(final boolean useOriginalBaseQualities, final HistogramGenerator hg) {
histogramGenerator=hg;
}

@Override
public void calculateDerivedFields() {
super.calculateDerivedFields();
this.READ_LENGTH_AVG_Q_ABOVE_25 = histogramGenerator.calculateLQ(25, 1, 5);
this.READ_LENGTH_AVG_Q_ABOVE_30 = histogramGenerator.calculateLQ(30, 1, 5);
}

@Override
public MergeableMetricBase merge(final MergeableMetricBase other) {
if (!(other instanceof QualityYieldMetricsFlow)){
throw new PicardException("Only objects of the same type can be merged");
}
this.histogramGenerator.addOtherHistogramGenerator(((QualityYieldMetricsFlow)other).histogramGenerator);
super.merge(other);
return this;
}

protected void addRecordToHistogramGenerator(final SAMRecord rec) {
histogramGenerator.addRecord(rec);
}

}
/**
* A set of metrics used to describe the general quality of a BAM file
*/
Expand Down
Loading
Loading