molstar
Version:
A comprehensive macromolecular library.
60 lines (59 loc) • 2.9 kB
JavaScript
/**
* Copyright (c) 2017-2018 mol* contributors, licensed under MIT, See LICENSE file for more info.
*
* @author David Sehnal <david.sehnal@gmail.com>
*/
import { Column } from '../../../../mol-data/db';
import { CifWriter } from '../../../../mol-io/writer/cif';
import { getModelMmCifCategory, getUniqueResidueNamesFromStructures } from './utils';
var CifCategory = CifWriter.Category;
export var _chem_comp = {
name: 'chem_comp',
instance: function (_a) {
var firstModel = _a.firstModel, structures = _a.structures, cache = _a.cache;
var chem_comp = getModelMmCifCategory(structures[0].model, 'chem_comp');
if (!chem_comp)
return CifCategory.Empty;
var id = chem_comp.id;
var names = cache.uniqueResidueNames || (cache.uniqueResidueNames = getUniqueResidueNamesFromStructures(structures));
var indices = Column.indicesOf(id, function (id) { return names.has(id); });
return CifCategory.ofTable(chem_comp, indices);
}
};
export var _chem_comp_bond = {
name: 'chem_comp_bond',
instance: function (_a) {
var firstModel = _a.firstModel, structures = _a.structures, cache = _a.cache;
var chem_comp_bond = getModelMmCifCategory(structures[0].model, 'chem_comp_bond');
if (!chem_comp_bond)
return CifCategory.Empty;
var comp_id = chem_comp_bond.comp_id;
var names = cache.uniqueResidueNames || (cache.uniqueResidueNames = getUniqueResidueNamesFromStructures(structures));
var indices = Column.indicesOf(comp_id, function (id) { return names.has(id); });
return CifCategory.ofTable(chem_comp_bond, indices);
}
};
export var _pdbx_chem_comp_identifier = {
name: 'pdbx_chem_comp_identifier',
instance: function (_a) {
var firstModel = _a.firstModel, structures = _a.structures, cache = _a.cache;
var pdbx_chem_comp_identifier = getModelMmCifCategory(firstModel, 'pdbx_chem_comp_identifier');
if (!pdbx_chem_comp_identifier)
return CifCategory.Empty;
var comp_id = pdbx_chem_comp_identifier.comp_id;
var names = cache.uniqueResidueNames || (cache.uniqueResidueNames = getUniqueResidueNamesFromStructures(structures));
var indices = Column.indicesOf(comp_id, function (id) { return names.has(id); });
return CifCategory.ofTable(pdbx_chem_comp_identifier, indices);
}
};
export var _pdbx_nonpoly_scheme = {
name: 'pdbx_nonpoly_scheme',
instance: function (_a) {
var firstModel = _a.firstModel, structures = _a.structures, cache = _a.cache;
var pdbx_nonpoly_scheme = getModelMmCifCategory(firstModel, 'pdbx_nonpoly_scheme');
if (!pdbx_nonpoly_scheme)
return CifCategory.Empty;
// TODO: filter?
return CifCategory.ofTable(pdbx_nonpoly_scheme);
}
};