oncoprintjs 6.0.4 → 6.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oncoprintjs",
3
- "version": "6.0.4",
3
+ "version": "6.0.5",
4
4
  "description": "A data visualization for cancer genomic data.",
5
5
  "types": "./dist/js/oncoprint.d.ts",
6
6
  "main": "dist/index.js",
@@ -60,5 +60,5 @@
60
60
  "tayden-clusterfck": "^0.7.0",
61
61
  "typescript": "4.0.3"
62
62
  },
63
- "gitHead": "00743bcfb9d752deabdcb1e8235cdb9cc0feb7c5"
63
+ "gitHead": "96b79a82694659deb1b06520d65e98633299055d"
64
64
  }
@@ -77,21 +77,25 @@ export default class OncoprintTrackInfoView {
77
77
  return;
78
78
  }
79
79
 
80
- const float = parseFloat(text);
80
+ const num = text.match(/^[\d\.]*/)?.[0];
81
+ let suffix = text.match(/[^\d]*$/)?.[0];
82
+
83
+ const float = parseFloat(num);
81
84
  let formattedPercent = '';
82
85
 
83
86
  if (isNaN(float)) {
84
87
  formattedPercent = 'N/P';
88
+ suffix = ''; // we don't want any suffix in this case
85
89
  } else if (isNumber(float)) {
86
90
  formattedPercent =
87
91
  float < 1 && float > 0
88
- ? '<1%'
89
- : Math.round(float) + '%';
92
+ ? '<1'
93
+ : Math.round(float).toString();
90
94
  } else {
91
95
  // do nothing
92
96
  }
93
97
 
94
- $new_label.text(formattedPercent);
98
+ $new_label.text(formattedPercent + suffix);
95
99
  $new_label.appendTo(self.$text_ctr);
96
100
  self.$label_elts.push($new_label);
97
101
  setTimeout(function() {