Skip to content

Commit

Permalink
Bugfix: Coverage: fix display of ? and infinity when div by zero
Browse files Browse the repository at this point in the history
Computing on TOTAL line: Linkable Residues Coverage
Set totalLinkableResiduesCoverage to zero when totalLinkableResidues is
zero.
Computing: M+L+C Coverage
If NumLinkableResidues is zero, show zero

(Also update a .gitignore to exclude vs code .vscode dir)
  • Loading branch information
danjasuw committed Feb 20, 2020
1 parent c002e63 commit 765f623
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions proxl_web_app/front_end/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/handlebars_templates_precompiled/
/webpack_build_output/
/.gradle/
/.vscode/
/.settings/
.project
VS_Code_Workspace.code-workspace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ public String getLinkableResiduesCoverageFmt() {


public String getMLCSequenceCoverage() {
return coverageFormat.format( (double)this.getNumMLCResidues() / (double)this.getNumLinkableResidues() );

double numMLCResidues_Div_NumLinkableResidues = 0;
if ( this.getNumLinkableResidues() != 0 ) {
numMLCResidues_Div_NumLinkableResidues = (double)this.getNumMLCResidues() / (double)this.getNumLinkableResidues();
}
return coverageFormat.format( numMLCResidues_Div_NumLinkableResidues );
}

public String getLCSequenceCoverage() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ public int compare(ProteinCoverageData o1, ProteinCoverageData o2) {
pcd.setSequenceCoverage( sequenceCoverage );
pcd.setNumLinkableResidues( totalLinkableResidues );
double totalLinkableResiduesCoverage = 0;
if ( totalResidues != 0 ) {
if ( totalLinkableResidues != 0 ) {
totalLinkableResiduesCoverage = (double)totalLinkableResiduesCovered / (double)totalLinkableResidues;
}
pcd.setNumLinkableResiduesCovered( totalLinkableResiduesCovered );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public class Protein_Coverage_SingleSearch_MultipleSearches_PageData_Webservice
*
* Increment this value whenever change the resulting image since Caching the resulting JSON
*/
static final int VERSION_FOR_CACHING = 1;
static final int VERSION_FOR_CACHING = 2;


@POST
Expand Down

0 comments on commit 765f623

Please sign in to comment.