Skip to content

Commit ab748fe

Browse files
committed
some tidying
1 parent 9f76f1a commit ab748fe

7 files changed

Lines changed: 28 additions & 29 deletions

File tree

dist/complexviewer.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.html

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,38 +44,38 @@
4444
<table class="symbols">
4545
<tr>
4646
<td>
47-
<img src="./src/imgs/key-svg/molecule-set.svg">
47+
<img src="./src/imgs/key-svg/molecule-set.svg" alt="molecule set">
4848
</td>
4949
<td>Molecule Set</td>
5050
</tr>
5151
<tr>
5252
<td>
53-
<img src="./src/imgs/key-svg/small-molecule.svg">
53+
<img src="./src/imgs/key-svg/small-molecule.svg" alt="small molecule">
5454
</td>
5555
<td>Bioactive Entity</td>
5656
</tr>
5757
<tr>
5858
<td>
59-
<img src="./src/imgs/key-svg/gene.svg">
59+
<img src="./src/imgs/key-svg/gene.svg" alt="gene">
6060
</td>
6161
<td>Gene</td>
6262
</tr>
6363
<tr>
6464
<td>
65-
<img src="./src/imgs/key-svg/dna.svg">
65+
<img src="./src/imgs/key-svg/dna.svg" alt="dna">
6666
</td>
6767
<td>DNA</td>
6868
</tr>
6969
<tr>
7070
<td>
71-
<img src="./src/imgs/key-svg/rna.svg">
71+
<img src="./src/imgs/key-svg/rna.svg" alt="rna">
7272
</td>
7373
<td>RNA</td>
7474
</tr>
7575
<tr>
7676
<td>
77-
<img src="./src/imgs/key-svg/protein-circle.svg">
78-
<img src="./src/imgs/key-svg/protein-bar.svg">
77+
<img src="./src/imgs/key-svg/protein-circle.svg" alt="protein circle">
78+
<img src="./src/imgs/key-svg/protein-bar.svg" alt="protein bar">
7979
</td>
8080
<td>Protein <br> (click to toggle)</td>
8181
</tr>
@@ -143,8 +143,8 @@
143143
<script type="text/javascript">
144144
//<![CDATA[
145145

146-
for (var i = 0; i < exampleIndex.length; i++) {
147-
var example = exampleIndex[i];
146+
for (let i = 0; i < exampleIndex.length; i++) {
147+
const example = exampleIndex[i];
148148
const dataSetsSelect = document.getElementById("dataSets");
149149
const opt = document.createElement("option");
150150
opt.value = example.ac;
@@ -178,7 +178,7 @@
178178
}
179179

180180
function setAnnotations(checkbox) {
181-
var json = cv.showAnnotations(checkbox.value, checkbox.checked);
181+
const json = cv.showAnnotations(checkbox.value, checkbox.checked);
182182
console.log(json);
183183
makeLegend(json);
184184
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "complexviewer",
3-
"version": "2.2.8",
3+
"version": "2.2.9",
44
"description": "A network visualisation that displays molecular interaction data, including detailed residue-level information such as binding sites. Used in EBI's Complex Portal and elsewhere.",
55
"author": {
66
"name": "Colin Combe",

src/js/viz/interactor/complex.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,15 @@ export class Complex extends Interactor {
100100
const args = cmd.slice(1).trim().split(/[\s,]+/).map(Number);
101101

102102
switch (type) {
103-
case 'M':
104-
case 'L':
103+
case "M":
104+
case "L":
105105
for (let i = 0; i < args.length; i += 2) {
106106
const [x, y] = [args[i], args[i + 1]];
107107
updateHighest(x, y);
108108
currentPoint = [x, y];
109109
}
110110
break;
111-
case 'C':
111+
case "C":
112112
for (let i = 0; i < args.length; i += 6) {
113113
const [x1, y1, x2, y2, x, y] = args.slice(i, i + 6);
114114
updateHighest(x1, y1);
@@ -117,21 +117,21 @@ export class Complex extends Interactor {
117117
currentPoint = [x, y];
118118
}
119119
break;
120-
case 'Q':
120+
case "Q":
121121
for (let i = 0; i < args.length; i += 4) {
122122
const [x1, y1, x, y] = args.slice(i, i + 4);
123123
updateHighest(x1, y1);
124124
updateHighest(x, y);
125125
currentPoint = [x, y];
126126
}
127127
break;
128-
case 'H':
128+
case "H":
129129
for (const x of args) {
130130
updateHighest(x, currentPoint[1]);
131131
currentPoint[0] = x;
132132
}
133133
break;
134-
case 'V':
134+
case "V":
135135
for (const y of args) {
136136
updateHighest(currentPoint[0], y);
137137
currentPoint[1] = y;
@@ -154,4 +154,9 @@ export class Complex extends Interactor {
154154
getResidueCoordinates () {
155155
return this.getPosition();
156156
}
157+
158+
setAllLinkCoordinates() {
159+
this.setLabelPosition();
160+
super.setAllLinkCoordinates();
161+
}
157162
}

src/js/viz/interactor/interactor.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export class Interactor {
5757
this.labelText = this.id;
5858
}
5959
if (this.labelText.length > 25) {
60-
this.labelText = `${this.labelText.substr(0, 16)}...`;
60+
this.labelText = `${this.labelText.substring(0, 16)}...`;
6161
}
6262
this.labelText = this.name;
6363
this.labelTextNode = document.createTextNode(this.labelText);
@@ -194,9 +194,6 @@ export class Interactor {
194194

195195
// update all lines (e.g after a move)
196196
setAllLinkCoordinates() {
197-
if (typeof this.setLabelPosition === "function") {
198-
this.setLabelPosition();
199-
}
200197
for (let link of this.naryLinks.values()) {
201198
link.setLinkCoordinates();
202199
if (link.complex){

src/js/viz/interactor/polymer.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,8 @@ export class Polymer extends Interactor {
202202
const labelTranslateInterpol = d3.interpolate(labelStartPoint, -(r + 5));
203203

204204
let xInterpol = null;//,
205-
// yInterpol = null;
206205
if (typeof svgP !== "undefined" && svgP !== null) {
207206
xInterpol = d3.interpolate(this.ix, svgP.x);
208-
// yInterpol = d3.interpolate(this.iy, svgP.y);
209207
}
210208

211209
const self = this;
@@ -255,7 +253,7 @@ export class Polymer extends Interactor {
255253
self.labelSVG.transform.baseVal.initialize(self.app.svgElement.createSVGTransformFromMatrix(k));
256254

257255
if (xInterpol !== null) {
258-
self.setPosition(xInterpol(cubicInOut(interp)), self.iy);//yInterpol(cubicInOut(interp)));
256+
self.setPosition(xInterpol(cubicInOut(interp)), self.iy);
259257
}
260258

261259
self.stickZoom = stickZoomInterpol(cubicInOut(interp));
@@ -625,8 +623,7 @@ export class Polymer extends Interactor {
625623
let top, bottom, rungHeight;
626624
const rung = annotation.rung;
627625
if (rung === -1) {
628-
bottom = 0;
629-
top = radius;
626+
console.error("Error: rung is -1 for annotation: " + annotation);
630627
} else if (startRes === "n-n") {
631628
rungHeight = radius / this.nTermFeatures.length;
632629
} else if (endRes === "c-c") {

src/js/viz/sequence-datum.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ export class SequenceDatum {
3434
const firstPart = sequenceDatumString.substring(0, dashPosition);
3535
const secondPart = sequenceDatumString.substring(dashPosition + 1);
3636

37-
if (firstPart == '?') {
37+
if (firstPart === "?") {
3838
this.uncertainBegin = 1;
3939
this.begin = tidyPosition(secondPart);
4040
this.end = null;
41-
} else if (secondPart == '?') {
41+
} else if (secondPart === "?") {
4242
this.uncertainEnd = participant.size;
4343
this.end = tidyPosition(firstPart);
4444
this.begin = null;

0 commit comments

Comments
 (0)