/** * Copyright (c) 2020-2022 mol* contributors, licensed under MIT, See LICENSE file for more info. * * @author Alexander Rose */ import { mmCIF_Schema } from '../../../mol-io/reader/cif/schema/mmcif'; import { Table } from '../../../mol-data/db'; import { mmCIF_chemComp_schema } from '../../../mol-io/reader/cif/schema/mmcif-extras'; import { getNormalizedAtomSite } from './util'; // TODO split into conformation and hierarchy parts export type Entry = Table export type Struct = Table export type StructAsym = Table export type IhmModelList = Table export type IhmModelGroup = Table export type IhmModelGroupLink = Table export type Entity = Table export type EntityPoly = Table export type EntityPolySeq = Table export type EntityBranch = Table export type ChemComp = Table export type ChemCompIdentifier = Table export type AtomSite = Table export type IhmSphereObjSite = Table export type IhmGaussianObjSite = Table export type UnobsOrZeroOccResidues = Table export type Molecule = Table export const BasicSchema = { entry: mmCIF_Schema.entry, struct: mmCIF_Schema.struct, struct_asym: mmCIF_Schema.struct_asym, ihm_model_list: mmCIF_Schema.ihm_model_list, ihm_model_group: mmCIF_Schema.ihm_model_group, ihm_model_group_link: mmCIF_Schema.ihm_model_group_link, entity: mmCIF_Schema.entity, entity_poly: mmCIF_Schema.entity_poly, entity_poly_seq: mmCIF_Schema.entity_poly_seq, pdbx_entity_branch: mmCIF_Schema.pdbx_entity_branch, chem_comp: mmCIF_chemComp_schema, pdbx_chem_comp_identifier: mmCIF_Schema.pdbx_chem_comp_identifier, atom_site: mmCIF_Schema.atom_site, ihm_sphere_obj_site: mmCIF_Schema.ihm_sphere_obj_site, ihm_gaussian_obj_site: mmCIF_Schema.ihm_gaussian_obj_site, pdbx_unobs_or_zero_occ_residues: mmCIF_Schema.pdbx_unobs_or_zero_occ_residues, pdbx_molecule: mmCIF_Schema.pdbx_molecule, }; export interface BasicData { entry: Entry struct: Struct struct_asym: StructAsym ihm_model_list: IhmModelList ihm_model_group: IhmModelGroup ihm_model_group_link: IhmModelGroupLink entity: Entity entity_poly: EntityPoly entity_poly_seq: EntityPolySeq pdbx_entity_branch: EntityBranch chem_comp: ChemComp pdbx_chem_comp_identifier: ChemCompIdentifier atom_site: AtomSite ihm_sphere_obj_site: IhmSphereObjSite ihm_gaussian_obj_site: IhmGaussianObjSite pdbx_unobs_or_zero_occ_residues: UnobsOrZeroOccResidues pdbx_molecule: Molecule } export function createBasic(data: Partial, normalize = false): BasicData { const basic = Object.create(null); for (const name of Object.keys(BasicSchema)) { if (name in data) { basic[name] = data[name as keyof typeof BasicSchema]; } else { basic[name] = Table.ofUndefinedColumns(BasicSchema[name as keyof typeof BasicSchema], 0); } } if (normalize) { basic.atom_site = getNormalizedAtomSite(basic.atom_site); } return basic; }