Skip to content

Commit

Permalink
Merge branch 'CollectQualityYieldMetricsFlowSpace-dev' of github.com:…
Browse files Browse the repository at this point in the history
…Ultimagen/picard into CollectQualityYieldMetricsFlowSpace-dev
  • Loading branch information
dror27 committed Jan 28, 2024
2 parents b1586b9 + e17dcc8 commit 4cc0e00
Showing 1 changed file with 47 additions and 2 deletions.
49 changes: 47 additions & 2 deletions src/main/java/picard/analysis/CollectQualityYieldMetricsSNVQ.java
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,10 @@ public void acceptRecord(final SAMRecord rec, final ReferenceSequence ref) {
}
} else if (q >= 30) {
metrics.Q20_SNVQ++;
metrics.Q30_BASES++;
metrics.Q30_SNVQ++;
if ( isPfRead ) {
metrics.PF_Q20_SNVQ++;
metrics.PF_Q30_BASES++;
metrics.PF_Q30_SNVQ++;
}
} else if (q >= 20) {
metrics.Q20_SNVQ++;
Expand Down Expand Up @@ -386,6 +386,42 @@ public QualityYieldMetrics(final boolean useOriginalQualities) {
@MergeByAdding
public long PF_Q40_BASES = 0;

/**
* The percentage of SNVQ values in all reads that achieve quality score 20 or higher
*/
@MergingIsManual
public double PCT_Q20_BASES = 0;

/**
* The percentage of SNVQ values in all reads that achieve quality score 30 or higher
*/
@MergingIsManual
public double PCT_Q30_BASES = 0;

/**
* The percentage of SNVQ values in all reads that achieve quality score 40 or higher
*/
@MergingIsManual
public double PCT_Q40_BASES = 0;

/**
* The percentage of SNVQ values in all reads that achieve quality score 20 or higher and pass filter
*/
@MergingIsManual
public double PCT_PF_Q20_BASES = 0;

/**
* The percentage of SNVQ values in all reads that achieve quality score 30 or higher and pass filter
*/
@MergingIsManual
public double PCT_PF_Q30_BASES = 0;

/**
* The percentage of SNVQ values in all reads that achieve quality score 40 or higher and pass filter
*/
@MergingIsManual
public double PCT_PF_Q40_BASES = 0;

/**
* The total number of SNVQ values in all reads
*/
Expand Down Expand Up @@ -478,6 +514,15 @@ public void calculateDerivedFields() {
super.calculateDerivedFields();
this.READ_LENGTH = this.TOTAL_READS == 0 ? 0 : (int) (this.TOTAL_BASES / this.TOTAL_READS);

this.PCT_Q20_BASES = this.TOTAL_BASES == 0 ? 0 : (double)this.Q20_BASES / this.TOTAL_BASES;
this.PCT_Q30_BASES = this.TOTAL_BASES == 0 ? 0 : (double)this.Q30_BASES / this.TOTAL_BASES;
this.PCT_Q40_BASES = this.TOTAL_BASES == 0 ? 0 : (double)this.Q40_BASES / this.TOTAL_BASES;

this.PCT_PF_Q20_BASES = this.PF_BASES == 0 ? 0 : (double)this.PF_Q20_BASES / this.PF_BASES;
this.PCT_PF_Q30_BASES = this.PF_BASES == 0 ? 0 : (double)this.PF_Q30_BASES / this.PF_BASES;
this.PCT_PF_Q40_BASES = this.PF_BASES == 0 ? 0 : (double)this.PF_Q40_BASES / this.PF_BASES;


this.PCT_Q20_SNVQ = this.TOTAL_SNVQ == 0 ? 0 : (double)this.Q20_SNVQ / this.TOTAL_SNVQ;
this.PCT_Q30_SNVQ = this.TOTAL_SNVQ == 0 ? 0 : (double)this.Q30_SNVQ / this.TOTAL_SNVQ;
this.PCT_Q40_SNVQ = this.TOTAL_SNVQ == 0 ? 0 : (double)this.Q40_SNVQ / this.TOTAL_SNVQ;
Expand Down

0 comments on commit 4cc0e00

Please sign in to comment.