molstar
Version:
A comprehensive macromolecular library.
40 lines • 1.68 kB
JavaScript
/**
* Copyright (c) 2018-2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
*
* @author David Sehnal <david.sehnal@gmail.com>
* @author Alexander Rose <alexander.rose@weirdbyte.de>
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.getSequence = void 0;
var sequence_1 = require("../../../mol-model/structure/model/properties/sequence");
var db_1 = require("../../../mol-data/db");
var sequence_2 = require("../../../mol-model/sequence");
function getSequence(data, entities, atomicHierarchy, coarseHierarchy) {
if (!data.entity_poly_seq || !data.entity_poly_seq._rowCount) {
return sequence_1.StructureSequence.fromHierarchy(entities, atomicHierarchy, coarseHierarchy);
}
var _a = data.entity_poly_seq, entity_id = _a.entity_id, num = _a.num, mon_id = _a.mon_id;
var byEntityKey = {};
var sequences = [];
var count = entity_id.rowCount;
var i = 0;
while (i < count) {
var start = i;
while (i < count - 1 && entity_id.areValuesEqual(i, i + 1))
i++;
i++;
var id = entity_id.value(start);
var compId = db_1.Column.window(mon_id, start, i);
var seqId = db_1.Column.window(num, start, i);
var entityKey = entities.getEntityIndex(id);
byEntityKey[entityKey] = {
entityId: id,
sequence: sequence_2.Sequence.ofResidueNames(compId, seqId)
};
sequences.push(byEntityKey[entityKey]);
}
return { byEntityKey: byEntityKey, sequences: sequences };
}
exports.getSequence = getSequence;
//# sourceMappingURL=sequence.js.map
;