biojs-vis-pdbviewer
Version:
A BioJS 2.0 component to view protein structures
23 lines (21 loc) • 1.05 kB
JavaScript
Clazz.declarePackage ("JM");
Clazz.load (["JM.ProteinStructure"], "JM.Helix", ["JU.Measure", "$.P3", "$.V3", "J.c.STR"], function () {
c$ = Clazz.declareType (JM, "Helix", JM.ProteinStructure);
Clazz.makeConstructor (c$,
function (apolymer, monomerIndex, monomerCount, subtype) {
Clazz.superConstructor (this, JM.Helix, []);
this.setupPS (apolymer, J.c.STR.HELIX, monomerIndex, monomerCount);
this.subtype = subtype;
}, "JM.AlphaPolymer,~N,~N,J.c.STR");
Clazz.overrideMethod (c$, "calcAxis",
function () {
if (this.axisA != null) return;
var points = new Array (this.nRes + 1);
for (var i = 0; i <= this.nRes; i++) this.apolymer.getLeadMidPoint (this.monomerIndexFirst + i, points[i] = new JU.P3 ());
this.axisA = new JU.P3 ();
this.axisUnitVector = new JU.V3 ();
JU.Measure.calcBestAxisThroughPoints (points, this.axisA, this.axisUnitVector, this.vectorProjection, 4);
this.axisB = JU.P3.newP (points[this.nRes]);
JU.Measure.projectOntoAxis (this.axisB, this.axisA, this.axisUnitVector, this.vectorProjection);
});
});