in packages/miew/src/io/parsers/PDBParser.js [312:382]
_parseSTRUCTURE(stream, pars, adder) {
const startId = 0;
const startIndex = 1;
const endId = 2;
const endIndex = 3;
// identify fields: debugging and stuff
/* eslint-disable no-magic-numbers */
const codeOfS = 0x53;
const serialNumber = stream.readInt(8, 10);
const structureName = stream.readString(12, 14).trim(); // FIXME: LString(3) forbids trim()
const comment = stream.readString(41, 70).trim();
const helLength = stream.readInt(72, 76);
const helixClass = stream.readInt(39, 40);
const shWidth = stream.readInt(15, 16);
const shCur = stream.readInt(42, 45);
const shPrev = stream.readInt(57, 60);
/* eslint-enable no-magic-numbers */
// file fields
const startChainID = stream.readString(pars[startId], pars[endId] + 1).charCodeAt(0);
const endChainID = stream.readString(pars[endId], pars[endId] + 1).charCodeAt(0);
const startSequenceNumber = stream.readInt(pars[startIndex], pars[startIndex] + 3);
let iCodeStr = stream.readString(pars[startIndex] + 4, pars[startIndex] + 4);
let startICode = 0;
if (iCodeStr.length > 0) {
startICode = iCodeStr.charCodeAt(0);
}
const endSequenceNumber = stream.readInt(pars[endIndex], pars[endIndex] + 3);
iCodeStr = stream.readString(pars[endIndex] + 4, pars[endIndex] + 4);
let endICode = 0;
if (iCodeStr.length > 0) {
endICode = iCodeStr.charCodeAt(0);
}
let obj;
let cs = this._sheet;
if (stream.readCharCode(1) === codeOfS) {
if (cs !== null && cs.getName() !== structureName) {
cs = null;
this._sheet = null;
}
if (cs === null) {
this._sheet = obj = new Sheet(structureName, shWidth);
adder(obj);
} else {
obj = cs;
}
const strand = new Strand(
obj,
this._complex.getUnifiedSerial(startChainID, startSequenceNumber, startICode),
this._complex.getUnifiedSerial(endChainID, endSequenceNumber, endICode),
helixClass,
shCur,
shPrev,
);
obj.addStrand(strand);
this._complex.structures.push(strand);
} else {
obj = new Helix(
helixClass,
this._complex.getUnifiedSerial(startChainID, startSequenceNumber, startICode),
this._complex.getUnifiedSerial(endChainID, endSequenceNumber, endICode),
serialNumber,
structureName,
comment,
helLength,
);
adder(obj);
}
}