diff --git a/src/cli/cifschema/util/cif-dic.ts b/src/cli/cifschema/util/cif-dic.ts index 3066da8257b9593c5fe736817169dcf393a507c1..0036ba01cb836839b203bf15a219cd4fa52e9b2e 100644 --- a/src/cli/cifschema/util/cif-dic.ts +++ b/src/cli/cifschema/util/cif-dic.ts @@ -1,5 +1,5 @@ /** - * Copyright (c) 2017-2018 mol* contributors, licensed under MIT, See LICENSE file for more info. + * Copyright (c) 2017-2022 mol* contributors, licensed under MIT, See LICENSE file for more info. * * @author Alexander Rose <alexander.rose@weirdbyte.de> */ @@ -13,15 +13,17 @@ export function getFieldType(type: string, description: string, values?: string[ switch (type) { // mmCIF case 'code': - case 'ucode': case 'line': - case 'uline': case 'text': case 'char': - case 'uchar3': - case 'uchar1': case 'boolean': return values && values.length ? EnumCol(values, 'str', description) : StrCol(description); + case 'ucode': + case 'uline': + case 'uchar3': + case 'uchar1': + // only force upper-case for enums + return values && values.length ? EnumCol(values.map(x => x.toUpperCase()), 'ustr', description) : StrCol(description); case 'aliasname': case 'name': case 'idname': diff --git a/src/cli/cifschema/util/generate.ts b/src/cli/cifschema/util/generate.ts index 96bdd5bfd8ebab38e3f7066962c36272897b7a95..1b2ac6e2c2c337fdbecb0447c13fcbc0213db634 100644 --- a/src/cli/cifschema/util/generate.ts +++ b/src/cli/cifschema/util/generate.ts @@ -1,5 +1,5 @@ /** - * Copyright (c) 2017-2019 mol* contributors, licensed under MIT, See LICENSE file for more info. + * Copyright (c) 2017-2022 mol* contributors, licensed under MIT, See LICENSE file for more info. * * @author Alexander Rose <alexander.rose@weirdbyte.de> */ @@ -10,7 +10,7 @@ import { FieldPath } from '../../../mol-io/reader/cif/schema'; function header(name: string, info: string, moldataImportPath: string) { return `/** - * Copyright (c) 2017-2020 mol* contributors, licensed under MIT, See LICENSE file for more info. + * Copyright (c) 2017-2022 mol* contributors, licensed under MIT, See LICENSE file for more info. * * Code-generated '${name}' schema file. ${info} * @@ -35,13 +35,16 @@ function getTypeShorthands(schema: Database, fields?: Filter) { const { columns } = schema.tables[table]; Object.keys(columns).forEach(columnName => { if (fields && !fields[table][columnName]) return; - types.add(schema.tables[table].columns[columnName].type); + const col = schema.tables[table].columns[columnName]; + if (col.type === 'enum') types.add(col.subType); + types.add(col.type); }); }); const shorthands: string[] = []; types.forEach(type => { switch (type) { case 'str': shorthands.push('const str = Schema.str;'); break; + case 'ustr': shorthands.push('const ustr = Schema.ustr;'); break; case 'int': shorthands.push('const int = Schema.int;'); break; case 'float': shorthands.push('const float = Schema.float;'); break; case 'coord': shorthands.push('const coord = Schema.coord;'); break; diff --git a/src/cli/cifschema/util/schema.ts b/src/cli/cifschema/util/schema.ts index 38081d104f9d1e7c651ac0589bc9a5349933cec1..d22513104ec8afb9977ece1e7d4239f67b62f72f 100644 --- a/src/cli/cifschema/util/schema.ts +++ b/src/cli/cifschema/util/schema.ts @@ -1,5 +1,5 @@ /** - * Copyright (c) 2017-2019 mol* contributors, licensed under MIT, See LICENSE file for more info. + * Copyright (c) 2017-2022 mol* contributors, licensed under MIT, See LICENSE file for more info. * * @author Alexander Rose <alexander.rose@weirdbyte.de> */ @@ -29,8 +29,8 @@ export function FloatCol(description: string): FloatCol { return { type: 'float' export type CoordCol = { type: 'coord' } & BaseCol export function CoordCol(description: string): CoordCol { return { type: 'coord', description }; } -export type EnumCol = { type: 'enum', subType: 'int' | 'str', values: string[] } & BaseCol -export function EnumCol(values: string[], subType: 'int' | 'str', description: string): EnumCol { +export type EnumCol = { type: 'enum', subType: 'int' | 'str' | 'ustr', values: string[] } & BaseCol +export function EnumCol(values: string[], subType: 'int' | 'str' | 'ustr', description: string): EnumCol { return { type: 'enum', description, values, subType }; } diff --git a/src/examples/proteopedia-wrapper/helpers.ts b/src/examples/proteopedia-wrapper/helpers.ts index aad918fd23b9398ef90b4ad87dfc553ea3b63f52..65522e9d985024d7a5c65ecc6dd886bf401c040a 100644 --- a/src/examples/proteopedia-wrapper/helpers.ts +++ b/src/examples/proteopedia-wrapper/helpers.ts @@ -56,7 +56,7 @@ export namespace ModelInfo { const cI = chainIndex[residueOffsets[rI]]; const eI = model.atomicHierarchy.index.getEntityFromChain(cI); const entityType = model.entities.data.type.value(eI); - if (entityType !== 'non-polymer' && entityType !== 'branched') continue; + if (entityType !== 'NON-POLYMER' && entityType !== 'BRANCHED') continue; const comp_id = model.atomicHierarchy.atoms.label_comp_id.value(residueOffsets[rI]); diff --git a/src/mol-data/db/_spec/table.spec.ts b/src/mol-data/db/_spec/table.spec.ts index 7a39eebd46b5539e79e2ba944ebe16c50f127808..97794f9571c095c0329ead34168a8f6d1ff90fb4 100644 --- a/src/mol-data/db/_spec/table.spec.ts +++ b/src/mol-data/db/_spec/table.spec.ts @@ -1,5 +1,5 @@ /** - * Copyright (c) 2017-2018 mol* contributors, licensed under MIT, See LICENSE file for more info. + * Copyright (c) 2017-2022 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> @@ -66,8 +66,8 @@ describe('string column', () => { const xsArr = xs.map(x => x ?? ''); const xsLC = xs.map(x => (x ?? '').toLowerCase()); const arr = Column.ofArray({ array: xs as any, schema: Column.Schema.str }); - const arrLC = Column.ofArray({ array: xs as any, schema: Column.Schema.Str({ lowerCase: true }) }); - const aliasedLC = Column.ofArray({ array: xs as any, schema: Column.Schema.Aliased<'a' | 'b'>(Column.Schema.lowerCaseStr) }); + const arrLC = Column.ofArray({ array: xs as any, schema: Column.Schema.Str({ transform: 'lowercase' }) }); + const aliasedLC = Column.ofArray({ array: xs as any, schema: Column.Schema.Aliased<'a' | 'b'>(Column.Schema.lstr) }); it('value', () => { for (let i = 0; i < xs.length; i++) { diff --git a/src/mol-data/db/column.ts b/src/mol-data/db/column.ts index c31ffafe71c424694d828055613e0cfc907e82b8..c65d7552b6553d7393bfb8a0c4e16343784e4f23 100644 --- a/src/mol-data/db/column.ts +++ b/src/mol-data/db/column.ts @@ -1,5 +1,5 @@ /** - * Copyright (c) 2017-2019 mol* contributors, licensed under MIT, See LICENSE file for more info. + * Copyright (c) 2017-2022 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> @@ -31,22 +31,23 @@ namespace Column { // T also serves as a default value for undefined columns type Base<T extends string> = { valueType: T } - export type Str = { '@type': 'str', T: string, lowerCase?: boolean } & Base<'str'> + export type Str = { '@type': 'str', T: string, transform?: 'uppercase' | 'lowercase' } & Base<'str'> export type Int = { '@type': 'int', T: number } & Base<'int'> export type Float = { '@type': 'float', T: number } & Base<'float'> export type Coordinate = { '@type': 'coord', T: number } & Base<'float'> export type Tensor = { '@type': 'tensor', T: Tensors.Data, space: Tensors.Space, baseType: Int | Float } & Base<'tensor'> - export type Aliased<T> = { '@type': 'aliased', T: T } & Base<T extends string ? 'str' : 'int'> + export type Aliased<T> = { '@type': 'aliased', T: T, transform?: T extends string ? 'uppercase' | 'lowercase' : never } & Base<T extends string ? 'str' : 'int'> export type List<T extends number | string> = { '@type': 'list', T: T[], separator: string, itemParse: (x: string) => T } & Base<'list'> - export const str: Str = { '@type': 'str', T: '', valueType: 'str', lowerCase: false }; - export const lowerCaseStr: Str = { '@type': 'str', T: '', valueType: 'str', lowerCase: true }; + export const str: Str = { '@type': 'str', T: '', valueType: 'str' }; + export const ustr: Str = { '@type': 'str', T: '', valueType: 'str', transform: 'uppercase' }; + export const lstr: Str = { '@type': 'str', T: '', valueType: 'str', transform: 'lowercase' }; export const int: Int = { '@type': 'int', T: 0, valueType: 'int' }; export const coord: Coordinate = { '@type': 'coord', T: 0, valueType: 'float' }; export const float: Float = { '@type': 'float', T: 0, valueType: 'float' }; - export function Str(options?: { defaultValue?: string, lowerCase?: boolean }): Str { return { '@type': 'str', T: options?.defaultValue ?? '', lowerCase: !!options?.lowerCase, valueType: 'str' }; }; + export function Str(options?: { defaultValue?: string, transform?: 'uppercase' | 'lowercase' }): Str { return { '@type': 'str', T: options?.defaultValue ?? '', transform: options?.transform, valueType: 'str' }; }; export function Int(defaultValue = 0): Int { return { '@type': 'int', T: defaultValue, valueType: 'int' }; }; export function Float(defaultValue = 0): Float { return { '@type': 'float', T: defaultValue, valueType: 'float' }; }; export function Tensor(space: Tensors.Space, baseType: Int | Float = float): Tensor { return { '@type': 'tensor', T: space.create(), space, valueType: 'tensor', baseType }; } @@ -289,9 +290,11 @@ function arrayColumn<T extends Column.Schema>({ array, schema, valueKind }: Colu const rowCount = array.length; const defaultValue = schema.T; const value: Column<T['T']>['value'] = schema.valueType === 'str' - ? (schema as Column.Schema.Str).lowerCase + ? (schema as Column.Schema.Str).transform === 'lowercase' ? row => { const v = array[row]; return typeof v === 'string' ? v.toLowerCase() : `${v ?? defaultValue}`.toLowerCase(); } - : row => { const v = array[row]; return typeof v === 'string' ? v : `${v ?? defaultValue}`; } + : (schema as Column.Schema.Str).transform === 'uppercase' + ? row => { const v = array[row]; return typeof v === 'string' ? v.toUpperCase() : `${v ?? defaultValue}`.toUpperCase(); } + : row => { const v = array[row]; return typeof v === 'string' ? v : `${v ?? defaultValue}`; } : row => array[row]; const isTyped = ColumnHelpers.isTypedArray(array); @@ -303,7 +306,7 @@ function arrayColumn<T extends Column.Schema>({ array, schema, valueKind }: Colu value, valueKind: valueKind ? valueKind : row => Column.ValueKind.Present, toArray: schema.valueType === 'str' - ? (schema as Column.Schema.Str).lowerCase + ? (schema as Column.Schema.Str).transform === 'lowercase' ? params => { const { start, end } = ColumnHelpers.getArrayBounds(rowCount, params); const ret = new (params && typeof params.array !== 'undefined' ? params.array : (array as any).constructor)(end - start) as any; @@ -313,15 +316,25 @@ function arrayColumn<T extends Column.Schema>({ array, schema, valueKind }: Colu } return ret; } - : params => { - const { start, end } = ColumnHelpers.getArrayBounds(rowCount, params); - const ret = new (params && typeof params.array !== 'undefined' ? params.array : (array as any).constructor)(end - start) as any; - for (let i = 0, _i = end - start; i < _i; i++) { - const v = array[start + i]; - ret[i] = typeof v === 'string' ? v : `${v ?? defaultValue}`; + : (schema as Column.Schema.Str).transform === 'uppercase' + ? params => { + const { start, end } = ColumnHelpers.getArrayBounds(rowCount, params); + const ret = new (params && typeof params.array !== 'undefined' ? params.array : (array as any).constructor)(end - start) as any; + for (let i = 0, _i = end - start; i < _i; i++) { + const v = array[start + i]; + ret[i] = typeof v === 'string' ? v.toUpperCase() : `${v ?? defaultValue}`.toUpperCase(); + } + return ret; + } + : params => { + const { start, end } = ColumnHelpers.getArrayBounds(rowCount, params); + const ret = new (params && typeof params.array !== 'undefined' ? params.array : (array as any).constructor)(end - start) as any; + for (let i = 0, _i = end - start; i < _i; i++) { + const v = array[start + i]; + ret[i] = typeof v === 'string' ? v : `${v ?? defaultValue}`; + } + return ret; } - return ret; - } : isTyped ? params => ColumnHelpers.typedArrayWindow(array, params) as any as ReadonlyArray<T> : params => { diff --git a/src/mol-io/reader/cif/schema.ts b/src/mol-io/reader/cif/schema.ts index e9e6f1f251188d088376c6ddc1f8e24c4b355275..d5d809d139e7b00a987f2fe3d6bfe30fd94686bb 100644 --- a/src/mol-io/reader/cif/schema.ts +++ b/src/mol-io/reader/cif/schema.ts @@ -1,5 +1,5 @@ /** - * Copyright (c) 2017-2019 mol* contributors, licensed under MIT, See LICENSE file for more info. + * Copyright (c) 2017-2022 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> @@ -45,7 +45,7 @@ type ColumnCtor = (field: Data.CifField, category: Data.CifCategory, key: string function getColumnCtor(t: Column.Schema): ColumnCtor { switch (t.valueType) { - case 'str': return (f, c, k) => createColumn(t, f, f.str, f.toStringArray); + case 'str': return (f, c, k) => createStringColumn(t, f, f.str, f.toStringArray); case 'int': return (f, c, k) => createColumn(t, f, f.int, f.toIntArray); case 'float': return (f, c, k) => createColumn(t, f, f.float, f.toFloatArray); case 'list': throw new Error('Use createListColumn instead.'); @@ -53,6 +53,27 @@ function getColumnCtor(t: Column.Schema): ColumnCtor { } } +function createStringColumn<T extends string>(schema: Column.Schema.Str | Column.Schema.Aliased<T>, field: Data.CifField, value: (row: number) => T, toArray: Column<T>['toArray']): Column<T> { + return { + schema, + __array: field.__array, + isDefined: field.isDefined, + rowCount: field.rowCount, + value: schema.transform === 'lowercase' + ? row => value(row).toLowerCase() as T + : schema.transform === 'uppercase' + ? row => value(row).toUpperCase() as T + : value, + valueKind: field.valueKind, + areValuesEqual: field.areValuesEqual, + toArray: schema.transform === 'lowercase' + ? p => Array.from(toArray(p)).map(x => x.toLowerCase() as T) + : schema.transform === 'uppercase' + ? p => Array.from(toArray(p)).map(x => x.toUpperCase() as T) + : toArray, + }; +} + function createColumn<T>(schema: Column.Schema, field: Data.CifField, value: (row: number) => T, toArray: Column<T>['toArray']): Column<T> { return { schema, diff --git a/src/mol-io/reader/cif/schema/bird.ts b/src/mol-io/reader/cif/schema/bird.ts index f64c01091963bac83a5ad3f4886918a5584ffb2c..ef09ca999adfa2789c18f8016ddf479beba9aa05 100644 --- a/src/mol-io/reader/cif/schema/bird.ts +++ b/src/mol-io/reader/cif/schema/bird.ts @@ -1,7 +1,7 @@ /** - * Copyright (c) 2017-2020 mol* contributors, licensed under MIT, See LICENSE file for more info. + * Copyright (c) 2017-2022 mol* contributors, licensed under MIT, See LICENSE file for more info. * - * Code-generated 'BIRD' schema file. Dictionary versions: mmCIF 5.356, IHM 1.17, MA 1.3.5. + * Code-generated 'BIRD' schema file. Dictionary versions: mmCIF 5.357, IHM 1.17, MA 1.3.6. * * @author molstar/ciftools package */ @@ -12,6 +12,7 @@ import Schema = Column.Schema; const str = Schema.str; const float = Schema.float; +const ustr = Schema.ustr; const Aliased = Schema.Aliased; const int = Schema.int; @@ -58,7 +59,7 @@ export const BIRD_Schema = { /** * Defines the structural classification of the entity. */ - type: Aliased<'Amino acid' | 'Aminoglycoside' | 'Anthracycline' | 'Anthraquinone' | 'Ansamycin' | 'Chalkophore' | 'Chromophore' | 'Glycopeptide' | 'Cyclic depsipeptide' | 'Cyclic lipopeptide' | 'Cyclic peptide' | 'Heterocyclic' | 'Imino sugar' | 'Keto acid' | 'Lipoglycopeptide' | 'Lipopeptide' | 'Macrolide' | 'Non-polymer' | 'Nucleoside' | 'Oligopeptide' | 'Oligosaccharide' | 'Peptaibol' | 'Peptide-like' | 'Polycyclic' | 'Polypeptide' | 'Polysaccharide' | 'Quinolone' | 'Thiolactone' | 'Thiopeptide' | 'Siderophore' | 'Unknown' | 'Chalkophore, Polypeptide'>(str), + type: Aliased<'AMINO ACID' | 'AMINOGLYCOSIDE' | 'ANTHRACYCLINE' | 'ANTHRAQUINONE' | 'ANSAMYCIN' | 'CHALKOPHORE' | 'CHROMOPHORE' | 'GLYCOPEPTIDE' | 'CYCLIC DEPSIPEPTIDE' | 'CYCLIC LIPOPEPTIDE' | 'CYCLIC PEPTIDE' | 'HETEROCYCLIC' | 'IMINO SUGAR' | 'KETO ACID' | 'LIPOGLYCOPEPTIDE' | 'LIPOPEPTIDE' | 'MACROLIDE' | 'NON-POLYMER' | 'NUCLEOSIDE' | 'OLIGOPEPTIDE' | 'OLIGOSACCHARIDE' | 'PEPTAIBOL' | 'PEPTIDE-LIKE' | 'POLYCYCLIC' | 'POLYPEPTIDE' | 'POLYSACCHARIDE' | 'QUINOLONE' | 'THIOLACTONE' | 'THIOPEPTIDE' | 'SIDEROPHORE' | 'UNKNOWN' | 'CHALKOPHORE, POLYPEPTIDE'>(ustr), /** * Evidence for the assignment of _pdbx_reference_molecule.type */ @@ -66,7 +67,7 @@ export const BIRD_Schema = { /** * Broadly defines the function of the entity. */ - class: Aliased<'Antagonist' | 'Antibiotic' | 'Anticancer' | 'Anticoagulant' | 'Antifungal' | 'Antigen' | 'Antiinflammatory' | 'Antimicrobial' | 'Antineoplastic' | 'Antiparasitic' | 'Antiretroviral' | 'Anthelmintic' | 'Antithrombotic' | 'Antitumor' | 'Antiviral' | 'CASPASE inhibitor' | 'Chaperone binding' | 'Enzyme inhibitor' | 'Drug delivery' | 'Glycan component' | 'Growth factor' | 'Immunosuppressant' | 'Inducer' | 'Inhibitor' | 'Lantibiotic' | 'Metabolism' | 'Metal transport' | 'Nutrient' | 'Oxidation-reduction' | 'Protein binding' | 'Receptor' | 'Substrate analog' | 'Synthetic opioid' | 'Thrombin inhibitor' | 'Transition state mimetic' | 'Transport activator' | 'Trypsin inhibitor' | 'Toxin' | 'Unknown' | 'Water retention' | 'Anticoagulant, Antithrombotic' | 'Antibiotic, Antimicrobial' | 'Antibiotic, Anthelmintic' | 'Antibiotic, Antineoplastic' | 'Antimicrobial, Antiretroviral' | 'Antimicrobial, Antitumor' | 'Antimicrobial, Antiparasitic, Antibiotic' | 'Thrombin inhibitor, Trypsin inhibitor'>(str), + class: Aliased<'ANTAGONIST' | 'ANTIBIOTIC' | 'ANTICANCER' | 'ANTICOAGULANT' | 'ANTIFUNGAL' | 'ANTIGEN' | 'ANTIINFLAMMATORY' | 'ANTIMICROBIAL' | 'ANTINEOPLASTIC' | 'ANTIPARASITIC' | 'ANTIRETROVIRAL' | 'ANTHELMINTIC' | 'ANTITHROMBOTIC' | 'ANTITUMOR' | 'ANTIVIRAL' | 'CASPASE INHIBITOR' | 'CHAPERONE BINDING' | 'ENZYME INHIBITOR' | 'DRUG DELIVERY' | 'GLYCAN COMPONENT' | 'GROWTH FACTOR' | 'IMMUNOSUPPRESSANT' | 'INDUCER' | 'INHIBITOR' | 'LANTIBIOTIC' | 'METABOLISM' | 'METAL TRANSPORT' | 'NUTRIENT' | 'OXIDATION-REDUCTION' | 'PROTEIN BINDING' | 'RECEPTOR' | 'SUBSTRATE ANALOG' | 'SYNTHETIC OPIOID' | 'THROMBIN INHIBITOR' | 'TRANSITION STATE MIMETIC' | 'TRANSPORT ACTIVATOR' | 'TRYPSIN INHIBITOR' | 'TOXIN' | 'UNKNOWN' | 'WATER RETENTION' | 'ANTICOAGULANT, ANTITHROMBOTIC' | 'ANTIBIOTIC, ANTIMICROBIAL' | 'ANTIBIOTIC, ANTHELMINTIC' | 'ANTIBIOTIC, ANTINEOPLASTIC' | 'ANTIMICROBIAL, ANTIRETROVIRAL' | 'ANTIMICROBIAL, ANTITUMOR' | 'ANTIMICROBIAL, ANTIPARASITIC, ANTIBIOTIC' | 'THROMBIN INHIBITOR, TRYPSIN INHIBITOR'>(ustr), /** * Evidence for the assignment of _pdbx_reference_molecule.class */ @@ -78,7 +79,7 @@ export const BIRD_Schema = { /** * Defines how this entity is represented in PDB data files. */ - represent_as: Aliased<'polymer' | 'single molecule' | 'branched'>(str), + represent_as: Aliased<'POLYMER' | 'SINGLE MOLECULE' | 'BRANCHED'>(ustr), /** * For entities represented as single molecules, the identifier * corresponding to the chemical definition for the molecule. @@ -99,7 +100,7 @@ export const BIRD_Schema = { /** * Defines the current PDB release status for this molecule definition. */ - release_status: Aliased<'REL' | 'HOLD' | 'OBS' | 'WAIT'>(str), + release_status: Aliased<'REL' | 'HOLD' | 'OBS' | 'WAIT'>(ustr), /** * Assigns the identifier for the reference molecule which have been replaced * by this reference molecule. @@ -129,7 +130,7 @@ export const BIRD_Schema = { /** * Defines the polymer characteristic of the entity. */ - type: Aliased<'polymer' | 'polymer-like' | 'non-polymer' | 'branched'>(str), + type: Aliased<'POLYMER' | 'POLYMER-LIKE' | 'NON-POLYMER' | 'BRANCHED'>(ustr), /** * Additional details about this entity. */ @@ -249,7 +250,7 @@ export const BIRD_Schema = { /** * The bond order target for the chemical linkage. */ - value_order: Aliased<'sing' | 'doub' | 'trip' | 'quad' | 'arom' | 'poly' | 'delo' | 'pi'>(str), + value_order: Aliased<'SING' | 'DOUB' | 'TRIP' | 'QUAD' | 'AROM' | 'POLY' | 'DELO' | 'PI'>(ustr), /** * The entity component identifier for the first of two entities containing the linkage. */ @@ -335,7 +336,7 @@ export const BIRD_Schema = { /** * The bond order target for the non-standard linkage. */ - value_order: Aliased<'sing' | 'doub' | 'trip' | 'quad' | 'arom' | 'poly' | 'delo' | 'pi'>(str), + value_order: Aliased<'SING' | 'DOUB' | 'TRIP' | 'QUAD' | 'AROM' | 'POLY' | 'DELO' | 'PI'>(ustr), }, /** * Data items in the PDBX_REFERENCE_ENTITY_POLY category record details about @@ -400,11 +401,11 @@ export const BIRD_Schema = { /** * A flag to indicate that this monomer is observed in the instance example. */ - observed: Aliased<'Y' | 'N'>(str), + observed: Aliased<'Y' | 'N'>(ustr), /** * A flag to indicate that sequence heterogeneity at this monomer position. */ - hetero: Aliased<'Y' | 'N'>(str), + hetero: Aliased<'Y' | 'N'>(ustr), }, /** * Additional features associated with the reference entity. diff --git a/src/mol-io/reader/cif/schema/ccd.ts b/src/mol-io/reader/cif/schema/ccd.ts index ea509f5c1faf8437e45d8bf057ec5ab35acb5ae0..fe01aeba98d796f8ff08aee8e0d22acecb8582b8 100644 --- a/src/mol-io/reader/cif/schema/ccd.ts +++ b/src/mol-io/reader/cif/schema/ccd.ts @@ -1,7 +1,7 @@ /** - * Copyright (c) 2017-2020 mol* contributors, licensed under MIT, See LICENSE file for more info. + * Copyright (c) 2017-2022 mol* contributors, licensed under MIT, See LICENSE file for more info. * - * Code-generated 'CCD' schema file. Dictionary versions: mmCIF 5.356, IHM 1.17, MA 1.3.5. + * Code-generated 'CCD' schema file. Dictionary versions: mmCIF 5.357, IHM 1.17, MA 1.3.6. * * @author molstar/ciftools package */ @@ -13,6 +13,7 @@ import Schema = Column.Schema; const str = Schema.str; const float = Schema.float; const List = Schema.List; +const ustr = Schema.ustr; const Aliased = Schema.Aliased; const int = Schema.int; const coord = Schema.coord; @@ -103,7 +104,7 @@ export const CCD_Schema = { * linking monomers, monomers with some type of N-terminal (or 5') * cap and monomers with some type of C-terminal (or 3') cap. */ - type: Aliased<'D-peptide linking' | 'L-peptide linking' | 'D-peptide NH3 amino terminus' | 'L-peptide NH3 amino terminus' | 'D-peptide COOH carboxy terminus' | 'L-peptide COOH carboxy terminus' | 'DNA linking' | 'RNA linking' | 'L-RNA linking' | 'L-DNA linking' | 'DNA OH 5 prime terminus' | 'RNA OH 5 prime terminus' | 'DNA OH 3 prime terminus' | 'RNA OH 3 prime terminus' | 'D-saccharide, beta linking' | 'D-saccharide, alpha linking' | 'L-saccharide, beta linking' | 'L-saccharide, alpha linking' | 'L-saccharide' | 'D-saccharide' | 'saccharide' | 'non-polymer' | 'peptide linking' | 'peptide-like' | 'L-gamma-peptide, C-delta linking' | 'D-gamma-peptide, C-delta linking' | 'L-beta-peptide, C-gamma linking' | 'D-beta-peptide, C-gamma linking' | 'other'>(str), + type: Aliased<'D-PEPTIDE LINKING' | 'L-PEPTIDE LINKING' | 'D-PEPTIDE NH3 AMINO TERMINUS' | 'L-PEPTIDE NH3 AMINO TERMINUS' | 'D-PEPTIDE COOH CARBOXY TERMINUS' | 'L-PEPTIDE COOH CARBOXY TERMINUS' | 'DNA LINKING' | 'RNA LINKING' | 'L-RNA LINKING' | 'L-DNA LINKING' | 'DNA OH 5 PRIME TERMINUS' | 'RNA OH 5 PRIME TERMINUS' | 'DNA OH 3 PRIME TERMINUS' | 'RNA OH 3 PRIME TERMINUS' | 'D-SACCHARIDE, BETA LINKING' | 'D-SACCHARIDE, ALPHA LINKING' | 'L-SACCHARIDE, BETA LINKING' | 'L-SACCHARIDE, ALPHA LINKING' | 'L-SACCHARIDE' | 'D-SACCHARIDE' | 'SACCHARIDE' | 'NON-POLYMER' | 'PEPTIDE LINKING' | 'PEPTIDE-LIKE' | 'L-GAMMA-PEPTIDE, C-DELTA LINKING' | 'D-GAMMA-PEPTIDE, C-DELTA LINKING' | 'L-BETA-PEPTIDE, C-GAMMA LINKING' | 'D-BETA-PEPTIDE, C-GAMMA LINKING' | 'OTHER'>(ustr), /** * Synonym list for the component. */ @@ -154,11 +155,11 @@ export const CCD_Schema = { /** * This data item identifies if ideal coordinates are missing in this definition. */ - pdbx_ideal_coordinates_missing_flag: Aliased<'Y' | 'N'>(str), + pdbx_ideal_coordinates_missing_flag: Aliased<'Y' | 'N'>(ustr), /** * This data item identifies if model coordinates are missing in this definition. */ - pdbx_model_coordinates_missing_flag: Aliased<'Y' | 'N'>(str), + pdbx_model_coordinates_missing_flag: Aliased<'Y' | 'N'>(ustr), /** * Date component was added to database. */ @@ -279,15 +280,15 @@ export const CCD_Schema = { /** * The chiral configuration of the atom that is a chiral center. */ - pdbx_stereo_config: Aliased<'R' | 'S' | 'N'>(str), + pdbx_stereo_config: Aliased<'R' | 'S' | 'N'>(ustr), /** * A flag indicating an aromatic atom. */ - pdbx_aromatic_flag: Aliased<'Y' | 'N'>(str), + pdbx_aromatic_flag: Aliased<'Y' | 'N'>(ustr), /** * A flag indicating a leaving atom. */ - pdbx_leaving_atom_flag: Aliased<'Y' | 'N'>(str), + pdbx_leaving_atom_flag: Aliased<'Y' | 'N'>(ustr), }, /** * Data items in the CHEM_COMP_BOND category record details about @@ -320,7 +321,7 @@ export const CCD_Schema = { * bond associated with the specified atoms, expressed as a bond * order. */ - value_order: Aliased<'sing' | 'doub' | 'trip' | 'quad' | 'arom' | 'poly' | 'delo' | 'pi'>(str), + value_order: Aliased<'SING' | 'DOUB' | 'TRIP' | 'QUAD' | 'AROM' | 'POLY' | 'DELO' | 'PI'>(ustr), /** * Ordinal index for the component bond list. */ @@ -328,11 +329,11 @@ export const CCD_Schema = { /** * Stereochemical configuration across a double bond. */ - pdbx_stereo_config: Aliased<'E' | 'Z' | 'N'>(str), + pdbx_stereo_config: Aliased<'E' | 'Z' | 'N'>(ustr), /** * A flag indicating an aromatic bond. */ - pdbx_aromatic_flag: Aliased<'Y' | 'N'>(str), + pdbx_aromatic_flag: Aliased<'Y' | 'N'>(ustr), }, /** * Data items in the CHEM_COMP_DESCRIPTOR category provide @@ -352,7 +353,7 @@ export const CCD_Schema = { /** * This data item contains the descriptor type. */ - type: Aliased<'SMILES_CANNONICAL' | 'SMILES_CANONICAL' | 'SMILES' | 'InChI' | 'InChI_MAIN' | 'InChI_MAIN_FORMULA' | 'InChI_MAIN_CONNECT' | 'InChI_MAIN_HATOM' | 'InChI_CHARGE' | 'InChI_STEREO' | 'InChI_ISOTOPE' | 'InChI_FIXEDH' | 'InChI_RECONNECT' | 'InChIKey'>(str), + type: Aliased<'SMILES_CANNONICAL' | 'SMILES_CANONICAL' | 'SMILES' | 'INCHI' | 'INCHI_MAIN' | 'INCHI_MAIN_FORMULA' | 'INCHI_MAIN_CONNECT' | 'INCHI_MAIN_HATOM' | 'INCHI_CHARGE' | 'INCHI_STEREO' | 'INCHI_ISOTOPE' | 'INCHI_FIXEDH' | 'INCHI_RECONNECT' | 'INCHIKEY'>(ustr), /** * This data item contains the name of the program * or library used to compute the descriptor. diff --git a/src/mol-io/reader/cif/schema/mmcif-extras.ts b/src/mol-io/reader/cif/schema/mmcif-extras.ts index 9c41241a78674dabef68d4ad1f7ead207017fdf2..d79384b88396afeaa13599ebfb8011e896327d60 100644 --- a/src/mol-io/reader/cif/schema/mmcif-extras.ts +++ b/src/mol-io/reader/cif/schema/mmcif-extras.ts @@ -1,5 +1,5 @@ /** - * Copyright (c) 2018-2020 mol* contributors, licensed under MIT, See LICENSE file for more info. + * Copyright (c) 2018-2022 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> @@ -25,9 +25,9 @@ export const mmCIF_chemCompBond_schema = { molstar_protonation_variant: Column.Schema.Str() }; -/** Has `type` extended with 'Ion' and 'Lipid' */ +/** Has `type` extended with 'ION' and 'LIPID' */ export const mmCIF_chemComp_schema = { ...mmCIF_Schema.chem_comp, - type: Column.Schema.Aliased<mmCIF_Schema['chem_comp']['type']['T'] | 'Ion' | 'Lipid'>(Column.Schema.str) + type: Column.Schema.Aliased<mmCIF_Schema['chem_comp']['type']['T'] | 'ION' | 'LIPID'>(Column.Schema.str) }; export type mmCIF_chemComp_schema = typeof mmCIF_chemComp_schema; diff --git a/src/mol-io/reader/cif/schema/mmcif.ts b/src/mol-io/reader/cif/schema/mmcif.ts index 478eadb41b1fc1c2ebfec7c885fd77b54a97c497..4a797b847d9ad0e4e99f3a0d0be3dbd9af2397af 100644 --- a/src/mol-io/reader/cif/schema/mmcif.ts +++ b/src/mol-io/reader/cif/schema/mmcif.ts @@ -1,7 +1,7 @@ /** - * Copyright (c) 2017-2020 mol* contributors, licensed under MIT, See LICENSE file for more info. + * Copyright (c) 2017-2022 mol* contributors, licensed under MIT, See LICENSE file for more info. * - * Code-generated 'mmCIF' schema file. Dictionary versions: mmCIF 5.356, IHM 1.17, MA 1.3.5. + * Code-generated 'mmCIF' schema file. Dictionary versions: mmCIF 5.357, IHM 1.17, MA 1.3.6. * * @author molstar/ciftools package */ @@ -17,6 +17,7 @@ const coord = Schema.coord; const Aliased = Schema.Aliased; const Matrix = Schema.Matrix; const Vector = Schema.Vector; +const ustr = Schema.ustr; const List = Schema.List; export const mmCIF_Schema = { @@ -512,7 +513,7 @@ export const mmCIF_Schema = { * _chem_comp.mon_nstd_parent, _chem_comp.mon_nstd_class and * _chem_comp.mon_nstd_details data items. */ - mon_nstd_flag: Aliased<'no' | 'n' | 'yes' | 'y'>(str), + mon_nstd_flag: Aliased<'NO' | 'N' | 'YES' | 'Y'>(ustr), /** * The full name of the component. */ @@ -523,7 +524,7 @@ export const mmCIF_Schema = { * linking monomers, monomers with some type of N-terminal (or 5') * cap and monomers with some type of C-terminal (or 3') cap. */ - type: Aliased<'D-peptide linking' | 'L-peptide linking' | 'D-peptide NH3 amino terminus' | 'L-peptide NH3 amino terminus' | 'D-peptide COOH carboxy terminus' | 'L-peptide COOH carboxy terminus' | 'DNA linking' | 'RNA linking' | 'L-RNA linking' | 'L-DNA linking' | 'DNA OH 5 prime terminus' | 'RNA OH 5 prime terminus' | 'DNA OH 3 prime terminus' | 'RNA OH 3 prime terminus' | 'D-saccharide, beta linking' | 'D-saccharide, alpha linking' | 'L-saccharide, beta linking' | 'L-saccharide, alpha linking' | 'L-saccharide' | 'D-saccharide' | 'saccharide' | 'non-polymer' | 'peptide linking' | 'peptide-like' | 'L-gamma-peptide, C-delta linking' | 'D-gamma-peptide, C-delta linking' | 'L-beta-peptide, C-gamma linking' | 'D-beta-peptide, C-gamma linking' | 'other'>(str), + type: Aliased<'D-PEPTIDE LINKING' | 'L-PEPTIDE LINKING' | 'D-PEPTIDE NH3 AMINO TERMINUS' | 'L-PEPTIDE NH3 AMINO TERMINUS' | 'D-PEPTIDE COOH CARBOXY TERMINUS' | 'L-PEPTIDE COOH CARBOXY TERMINUS' | 'DNA LINKING' | 'RNA LINKING' | 'L-RNA LINKING' | 'L-DNA LINKING' | 'DNA OH 5 PRIME TERMINUS' | 'RNA OH 5 PRIME TERMINUS' | 'DNA OH 3 PRIME TERMINUS' | 'RNA OH 3 PRIME TERMINUS' | 'D-SACCHARIDE, BETA LINKING' | 'D-SACCHARIDE, ALPHA LINKING' | 'L-SACCHARIDE, BETA LINKING' | 'L-SACCHARIDE, ALPHA LINKING' | 'L-SACCHARIDE' | 'D-SACCHARIDE' | 'SACCHARIDE' | 'NON-POLYMER' | 'PEPTIDE LINKING' | 'PEPTIDE-LIKE' | 'L-GAMMA-PEPTIDE, C-DELTA LINKING' | 'D-GAMMA-PEPTIDE, C-DELTA LINKING' | 'L-BETA-PEPTIDE, C-GAMMA LINKING' | 'D-BETA-PEPTIDE, C-GAMMA LINKING' | 'OTHER'>(ustr), /** * Synonym list for the component. */ @@ -560,7 +561,7 @@ export const mmCIF_Schema = { * bond associated with the specified atoms, expressed as a bond * order. */ - value_order: Aliased<'sing' | 'doub' | 'trip' | 'quad' | 'arom' | 'poly' | 'delo' | 'pi'>(str), + value_order: Aliased<'SING' | 'DOUB' | 'TRIP' | 'QUAD' | 'AROM' | 'POLY' | 'DELO' | 'PI'>(ustr), /** * Ordinal index for the component bond list. */ @@ -568,11 +569,11 @@ export const mmCIF_Schema = { /** * Stereochemical configuration across a double bond. */ - pdbx_stereo_config: Aliased<'E' | 'Z' | 'N'>(str), + pdbx_stereo_config: Aliased<'E' | 'Z' | 'N'>(ustr), /** * A flag indicating an aromatic bond. */ - pdbx_aromatic_flag: Aliased<'Y' | 'N'>(str), + pdbx_aromatic_flag: Aliased<'Y' | 'N'>(ustr), }, /** * Data items in the CITATION category record details about the @@ -704,7 +705,7 @@ export const mmCIF_Schema = { /** * An abbreviation that identifies the database. */ - database_id: Aliased<'AlphaFoldDB' | 'CAS' | 'CSD' | 'EMDB' | 'ICSD' | 'ModelArchive' | 'MDF' | 'MODBASE' | 'NDB' | 'NBS' | 'PDB' | 'PDF' | 'RCSB' | 'SWISS-MODEL_REPOSITORY' | 'EBI' | 'PDBE' | 'BMRB' | 'WWPDB' | 'PDB_ACC'>(str), + database_id: Aliased<'ALPHAFOLDDB' | 'CAS' | 'CSD' | 'EMDB' | 'ICSD' | 'MODELARCHIVE' | 'MDF' | 'MODBASE' | 'NDB' | 'NBS' | 'PDB' | 'PDF' | 'RCSB' | 'SWISS-MODEL_REPOSITORY' | 'EBI' | 'PDBE' | 'BMRB' | 'WWPDB' | 'PDB_ACC'>(ustr), /** * The code assigned by the database identified in * _database_2.database_id. @@ -767,7 +768,7 @@ export const mmCIF_Schema = { * manipulated sources are expected to have further information in * the ENTITY_SRC_GEN category. */ - src_method: Aliased<'nat' | 'man' | 'syn'>(str), + src_method: Aliased<'NAT' | 'MAN' | 'SYN'>(ustr), /** * Defines the type of the entity. * @@ -780,7 +781,7 @@ export const mmCIF_Schema = { * Water entities are not expected to have corresponding * entries in the ENTITY category. */ - type: Aliased<'polymer' | 'non-polymer' | 'macrolide' | 'water' | 'branched'>(str), + type: Aliased<'POLYMER' | 'NON-POLYMER' | 'MACROLIDE' | 'WATER' | 'BRANCHED'>(ustr), /** * A description of the entity. * @@ -820,12 +821,12 @@ export const mmCIF_Schema = { * one monomer-to-monomer link different from that implied by * _entity_poly.type. */ - nstd_linkage: Aliased<'no' | 'n' | 'yes' | 'y'>(str), + nstd_linkage: Aliased<'NO' | 'N' | 'YES' | 'Y'>(ustr), /** * A flag to indicate whether the polymer contains at least * one monomer that is not considered standard. */ - nstd_monomer: Aliased<'no' | 'n' | 'yes' | 'y'>(str), + nstd_monomer: Aliased<'NO' | 'N' | 'YES' | 'Y'>(ustr), /** * The type of the polymer. */ @@ -894,6 +895,10 @@ export const mmCIF_Schema = { * parent is not specified. Deoxynucleotides are * represented by their canonical one-letter codes of A, * C, G, or T. + * + * For modifications with several parent amino acids, + * all corresponding parent amino acid codes will be listed + * (ex. chromophores). */ pdbx_seq_one_letter_code_can: str, /** @@ -919,7 +924,7 @@ export const mmCIF_Schema = { * A flag to indicate whether this monomer in the polymer is * heterogeneous in sequence. */ - hetero: Aliased<'no' | 'n' | 'yes' | 'y'>(str), + hetero: Aliased<'NO' | 'N' | 'YES' | 'Y'>(ustr), /** * This data item is a pointer to _chem_comp.id in the CHEM_COMP * category. @@ -996,7 +1001,7 @@ export const mmCIF_Schema = { * The classification of the software according to the most * common types. */ - type: Aliased<'program' | 'library' | 'package' | 'filter' | 'jiffy' | 'other'>(str), + type: Aliased<'PROGRAM' | 'LIBRARY' | 'PACKAGE' | 'FILTER' | 'JIFFY' | 'OTHER'>(ustr), /** * The version of the software. */ @@ -1119,7 +1124,7 @@ export const mmCIF_Schema = { * This data item is a pointer to _struct_conf_type.id in the * STRUCT_CONF_TYPE category. */ - conf_type_id: Aliased<'BEND' | 'HELX_P' | 'HELX_OT_P' | 'HELX_RH_P' | 'HELX_RH_OT_P' | 'HELX_RH_AL_P' | 'HELX_RH_GA_P' | 'HELX_RH_OM_P' | 'HELX_RH_PI_P' | 'HELX_RH_27_P' | 'HELX_RH_3T_P' | 'HELX_RH_PP_P' | 'HELX_LH_P' | 'HELX_LH_OT_P' | 'HELX_LH_AL_P' | 'HELX_LH_GA_P' | 'HELX_LH_OM_P' | 'HELX_LH_PI_P' | 'HELX_LH_27_P' | 'HELX_LH_3T_P' | 'HELX_LH_PP_P' | 'HELX_N' | 'HELX_OT_N' | 'HELX_RH_N' | 'HELX_RH_OT_N' | 'HELX_RH_A_N' | 'HELX_RH_B_N' | 'HELX_RH_Z_N' | 'HELX_LH_N' | 'HELX_LH_OT_N' | 'HELX_LH_A_N' | 'HELX_LH_B_N' | 'HELX_LH_Z_N' | 'TURN_P' | 'TURN_OT_P' | 'TURN_TY1_P' | 'TURN_TY1P_P' | 'TURN_TY2_P' | 'TURN_TY2P_P' | 'TURN_TY3_P' | 'TURN_TY3P_P' | 'STRN' | 'OTHER'>(str), + conf_type_id: Aliased<'BEND' | 'HELX_P' | 'HELX_OT_P' | 'HELX_RH_P' | 'HELX_RH_OT_P' | 'HELX_RH_AL_P' | 'HELX_RH_GA_P' | 'HELX_RH_OM_P' | 'HELX_RH_PI_P' | 'HELX_RH_27_P' | 'HELX_RH_3T_P' | 'HELX_RH_PP_P' | 'HELX_LH_P' | 'HELX_LH_OT_P' | 'HELX_LH_AL_P' | 'HELX_LH_GA_P' | 'HELX_LH_OM_P' | 'HELX_LH_PI_P' | 'HELX_LH_27_P' | 'HELX_LH_3T_P' | 'HELX_LH_PP_P' | 'HELX_N' | 'HELX_OT_N' | 'HELX_RH_N' | 'HELX_RH_OT_N' | 'HELX_RH_A_N' | 'HELX_RH_B_N' | 'HELX_RH_Z_N' | 'HELX_LH_N' | 'HELX_LH_OT_N' | 'HELX_LH_A_N' | 'HELX_LH_B_N' | 'HELX_LH_Z_N' | 'TURN_P' | 'TURN_OT_P' | 'TURN_TY1_P' | 'TURN_TY1P_P' | 'TURN_TY2_P' | 'TURN_TY2P_P' | 'TURN_TY3_P' | 'TURN_TY3P_P' | 'STRN' | 'OTHER'>(ustr), /** * A description of special aspects of the conformation assignment. */ @@ -1219,7 +1224,7 @@ export const mmCIF_Schema = { * This data item is a pointer to _struct_conn_type.id in the * STRUCT_CONN_TYPE category. */ - conn_type_id: Aliased<'covale' | 'disulf' | 'metalc' | 'hydrog'>(str), + conn_type_id: Aliased<'COVALE' | 'DISULF' | 'METALC' | 'HYDROG'>(ustr), /** * A description of special aspects of the connection. */ @@ -1439,7 +1444,7 @@ export const mmCIF_Schema = { * The chemical bond order associated with the specified atoms in * this contact. */ - pdbx_value_order: Aliased<'sing' | 'doub' | 'trip' | 'quad'>(str), + pdbx_value_order: Aliased<'SING' | 'DOUB' | 'TRIP' | 'QUAD'>(ustr), }, /** * Data items in the STRUCT_CONN_TYPE category record details @@ -1454,7 +1459,7 @@ export const mmCIF_Schema = { /** * The chemical or structural type of the interaction. */ - id: Aliased<'covale' | 'disulf' | 'hydrog' | 'metalc' | 'mismat' | 'saltbr' | 'modres' | 'covale_base' | 'covale_sugar' | 'covale_phosphate'>(str), + id: Aliased<'COVALE' | 'DISULF' | 'HYDROG' | 'METALC' | 'MISMAT' | 'SALTBR' | 'MODRES' | 'COVALE_BASE' | 'COVALE_SUGAR' | 'COVALE_PHOSPHATE'>(ustr), /** * A reference that specifies the criteria used to define the * interaction. @@ -1808,7 +1813,7 @@ export const mmCIF_Schema = { /** * The cell settings for this space-group symmetry. */ - cell_setting: Aliased<'triclinic' | 'monoclinic' | 'orthorhombic' | 'tetragonal' | 'rhombohedral' | 'trigonal' | 'hexagonal' | 'cubic'>(str), + cell_setting: Aliased<'TRICLINIC' | 'MONOCLINIC' | 'ORTHORHOMBIC' | 'TETRAGONAL' | 'RHOMBOHEDRAL' | 'TRIGONAL' | 'HEXAGONAL' | 'CUBIC'>(ustr), /** * Space-group number from International Tables for Crystallography * Vol. A (2002). @@ -1868,7 +1873,7 @@ export const mmCIF_Schema = { * This code indicates whether the entry belongs to * Structural Genomics Project. */ - SG_entry: Aliased<'Y' | 'N'>(str), + SG_entry: Aliased<'Y' | 'N'>(ustr), /** * The site where the file was deposited. */ @@ -1892,7 +1897,7 @@ export const mmCIF_Schema = { * A value of 'N' indicates that the no PDB format data file is * corresponding to this entry is available in the PDB archive. */ - pdb_format_compatible: Aliased<'Y' | 'N'>(str), + pdb_format_compatible: Aliased<'Y' | 'N'>(ustr), }, /** * The PDBX_NONPOLY_SCHEME category provides residue level nomenclature @@ -2045,7 +2050,7 @@ export const mmCIF_Schema = { * The value of polymer flag indicates whether the unobserved or * zero occupancy residue is part of a polymer chain or not */ - polymer_flag: Aliased<'Y' | 'N'>(str), + polymer_flag: Aliased<'Y' | 'N'>(ustr), /** * The value of occupancy flag indicates whether the residue * is unobserved (= 1) or the coordinates have an occupancy of zero (=0) @@ -2298,7 +2303,7 @@ export const mmCIF_Schema = { /** * Defines the polymer characteristic of the entity. */ - type: Aliased<'polymer' | 'polymer-like' | 'non-polymer' | 'branched'>(str), + type: Aliased<'POLYMER' | 'POLYMER-LIKE' | 'NON-POLYMER' | 'BRANCHED'>(ustr), /** * Additional details about this entity. */ @@ -2393,7 +2398,7 @@ export const mmCIF_Schema = { /** * The bond order target for the chemical linkage. */ - value_order: Aliased<'sing' | 'doub' | 'trip' | 'quad' | 'arom' | 'poly' | 'delo' | 'pi'>(str), + value_order: Aliased<'SING' | 'DOUB' | 'TRIP' | 'QUAD' | 'AROM' | 'POLY' | 'DELO' | 'PI'>(ustr), /** * The entity component identifier for the first of two entities containing the linkage. */ @@ -2479,7 +2484,7 @@ export const mmCIF_Schema = { /** * The bond order target for the non-standard linkage. */ - value_order: Aliased<'sing' | 'doub' | 'trip' | 'quad' | 'arom' | 'poly' | 'delo' | 'pi'>(str), + value_order: Aliased<'SING' | 'DOUB' | 'TRIP' | 'QUAD' | 'AROM' | 'POLY' | 'DELO' | 'PI'>(ustr), }, /** * Data items in the PDBX_MOLECULE category identify reference molecules @@ -2514,11 +2519,11 @@ export const mmCIF_Schema = { /** * Broadly defines the function of the molecule. */ - class: Aliased<'Antagonist' | 'Antibiotic' | 'Anticancer' | 'Anticoagulant' | 'Antifungal' | 'Antigen' | 'Antiinflammatory' | 'Antimicrobial' | 'Antineoplastic' | 'Antiparasitic' | 'Antiretroviral' | 'Anthelmintic' | 'Antithrombotic' | 'Antitumor' | 'Antiviral' | 'CASPASE inhibitor' | 'Chaperone binding' | 'Enzyme inhibitor' | 'Drug delivery' | 'Glycan component' | 'Growth factor' | 'Immunosuppressant' | 'Inducer' | 'Inhibitor' | 'Lantibiotic' | 'Metabolism' | 'Metal transport' | 'Nutrient' | 'Oxidation-reduction' | 'Protein binding' | 'Receptor' | 'Substrate analog' | 'Synthetic opioid' | 'Thrombin inhibitor' | 'Transition state mimetic' | 'Transport activator' | 'Trypsin inhibitor' | 'Toxin' | 'Unknown' | 'Water retention' | 'Anticoagulant, Antithrombotic' | 'Antibiotic, Antimicrobial' | 'Antibiotic, Anthelmintic' | 'Antibiotic, Antineoplastic' | 'Antimicrobial, Antiretroviral' | 'Antimicrobial, Antitumor' | 'Antimicrobial, Antiparasitic, Antibiotic' | 'Thrombin inhibitor, Trypsin inhibitor'>(str), + class: Aliased<'ANTAGONIST' | 'ANTIBIOTIC' | 'ANTICANCER' | 'ANTICOAGULANT' | 'ANTIFUNGAL' | 'ANTIGEN' | 'ANTIINFLAMMATORY' | 'ANTIMICROBIAL' | 'ANTINEOPLASTIC' | 'ANTIPARASITIC' | 'ANTIRETROVIRAL' | 'ANTHELMINTIC' | 'ANTITHROMBOTIC' | 'ANTITUMOR' | 'ANTIVIRAL' | 'CASPASE INHIBITOR' | 'CHAPERONE BINDING' | 'ENZYME INHIBITOR' | 'DRUG DELIVERY' | 'GLYCAN COMPONENT' | 'GROWTH FACTOR' | 'IMMUNOSUPPRESSANT' | 'INDUCER' | 'INHIBITOR' | 'LANTIBIOTIC' | 'METABOLISM' | 'METAL TRANSPORT' | 'NUTRIENT' | 'OXIDATION-REDUCTION' | 'PROTEIN BINDING' | 'RECEPTOR' | 'SUBSTRATE ANALOG' | 'SYNTHETIC OPIOID' | 'THROMBIN INHIBITOR' | 'TRANSITION STATE MIMETIC' | 'TRANSPORT ACTIVATOR' | 'TRYPSIN INHIBITOR' | 'TOXIN' | 'UNKNOWN' | 'WATER RETENTION' | 'ANTICOAGULANT, ANTITHROMBOTIC' | 'ANTIBIOTIC, ANTIMICROBIAL' | 'ANTIBIOTIC, ANTHELMINTIC' | 'ANTIBIOTIC, ANTINEOPLASTIC' | 'ANTIMICROBIAL, ANTIRETROVIRAL' | 'ANTIMICROBIAL, ANTITUMOR' | 'ANTIMICROBIAL, ANTIPARASITIC, ANTIBIOTIC' | 'THROMBIN INHIBITOR, TRYPSIN INHIBITOR'>(ustr), /** * Defines the structural classification of the molecule. */ - type: Aliased<'Amino acid' | 'Aminoglycoside' | 'Anthracycline' | 'Anthraquinone' | 'Ansamycin' | 'Chalkophore' | 'Chromophore' | 'Glycopeptide' | 'Cyclic depsipeptide' | 'Cyclic lipopeptide' | 'Cyclic peptide' | 'Heterocyclic' | 'Imino sugar' | 'Keto acid' | 'Lipoglycopeptide' | 'Lipopeptide' | 'Macrolide' | 'Non-polymer' | 'Nucleoside' | 'Oligopeptide' | 'Oligosaccharide' | 'Peptaibol' | 'Peptide-like' | 'Polycyclic' | 'Polypeptide' | 'Polysaccharide' | 'Quinolone' | 'Thiolactone' | 'Thiopeptide' | 'Siderophore' | 'Unknown' | 'Chalkophore, Polypeptide'>(str), + type: Aliased<'AMINO ACID' | 'AMINOGLYCOSIDE' | 'ANTHRACYCLINE' | 'ANTHRAQUINONE' | 'ANSAMYCIN' | 'CHALKOPHORE' | 'CHROMOPHORE' | 'GLYCOPEPTIDE' | 'CYCLIC DEPSIPEPTIDE' | 'CYCLIC LIPOPEPTIDE' | 'CYCLIC PEPTIDE' | 'HETEROCYCLIC' | 'IMINO SUGAR' | 'KETO ACID' | 'LIPOGLYCOPEPTIDE' | 'LIPOPEPTIDE' | 'MACROLIDE' | 'NON-POLYMER' | 'NUCLEOSIDE' | 'OLIGOPEPTIDE' | 'OLIGOSACCHARIDE' | 'PEPTAIBOL' | 'PEPTIDE-LIKE' | 'POLYCYCLIC' | 'POLYPEPTIDE' | 'POLYSACCHARIDE' | 'QUINOLONE' | 'THIOLACTONE' | 'THIOPEPTIDE' | 'SIDEROPHORE' | 'UNKNOWN' | 'CHALKOPHORE, POLYPEPTIDE'>(ustr), /** * A name of the molecule. */ @@ -2665,7 +2670,7 @@ export const mmCIF_Schema = { /** * This data item contains the descriptor type. */ - type: Aliased<'LINUCS' | 'Glycam Condensed Sequence' | 'Glycam Condensed Core Sequence' | 'WURCS'>(str), + type: Aliased<'LINUCS' | 'GLYCAM CONDENSED SEQUENCE' | 'GLYCAM CONDENSED CORE SEQUENCE' | 'WURCS'>(ustr), /** * This data item contains the name of the program * or library used to compute the descriptor. @@ -2740,7 +2745,7 @@ export const mmCIF_Schema = { * A flag to indicate whether this monomer in the entity is * heterogeneous in sequence. */ - hetero: Aliased<'no' | 'n' | 'yes' | 'y'>(str), + hetero: Aliased<'NO' | 'N' | 'YES' | 'Y'>(ustr), /** * This data item is a pointer to _chem_comp.id in the CHEM_COMP * category. @@ -2812,7 +2817,7 @@ export const mmCIF_Schema = { /** * The chiral configuration of the first atom making the linkage. */ - atom_stereo_config_1: Aliased<'R' | 'S' | 'N'>(str), + atom_stereo_config_1: Aliased<'R' | 'S' | 'N'>(ustr), /** * The atom identifier/name for the second atom making the linkage. */ @@ -2824,11 +2829,11 @@ export const mmCIF_Schema = { /** * The chiral configuration of the second atom making the linkage. */ - atom_stereo_config_2: Aliased<'R' | 'S' | 'N'>(str), + atom_stereo_config_2: Aliased<'R' | 'S' | 'N'>(ustr), /** * The bond order target for the chemical linkage. */ - value_order: Aliased<'sing' | 'doub' | 'trip' | 'quad' | 'arom' | 'poly' | 'delo' | 'pi'>(str), + value_order: Aliased<'SING' | 'DOUB' | 'TRIP' | 'QUAD' | 'AROM' | 'POLY' | 'DELO' | 'PI'>(ustr), }, /** * Data items in the PDBX_ENTITY_BRANCH category specify the list @@ -2859,7 +2864,7 @@ export const mmCIF_Schema = { * A flag to indicate whether this monomer in the entity is * heterogeneous in sequence. */ - hetero: Aliased<'no' | 'n' | 'yes' | 'y'>(str), + hetero: Aliased<'NO' | 'N' | 'YES' | 'Y'>(ustr), /** * Pointer to _atom_site.label_asym_id. */ @@ -3332,15 +3337,15 @@ export const mmCIF_Schema = { /** * A flag to indicate if the modeling is multi scale. */ - multi_scale_flag: Aliased<'YES' | 'NO'>(str), + multi_scale_flag: Aliased<'YES' | 'NO'>(ustr), /** * A flag to indicate if the modeling is multi state. */ - multi_state_flag: Aliased<'YES' | 'NO'>(str), + multi_state_flag: Aliased<'YES' | 'NO'>(ustr), /** * A flag to indicate if the modeling involves an ensemble ordered by time or other order. */ - ordered_flag: Aliased<'YES' | 'NO'>(str), + ordered_flag: Aliased<'YES' | 'NO'>(ustr), /** * The file id corresponding to the script used in the modeling protocol step. * This data item is a pointer to _ihm_external_files.id in the IHM_EXTERNAL_FILES category. @@ -3629,7 +3634,7 @@ export const mmCIF_Schema = { * A flag that indicates whether the dataset is archived in * an IHM related database or elsewhere. */ - database_hosted: Aliased<'YES' | 'NO'>(str), + database_hosted: Aliased<'YES' | 'NO'>(ustr), }, /** * Category to define groups or collections of input datasets. @@ -4236,7 +4241,7 @@ export const mmCIF_Schema = { * whether the whole image is used or only a portion of it is used (by masking * or by other means) as restraint in the modeling. */ - image_segment_flag: Aliased<'YES' | 'NO'>(str), + image_segment_flag: Aliased<'YES' | 'NO'>(ustr), /** * Number of 2D projections of the model used in the fitting. */ @@ -4389,7 +4394,7 @@ export const mmCIF_Schema = { * whether the whole SAS profile is used or only a portion of it is used * (by masking or by other means) as restraint in the modeling. */ - profile_segment_flag: Aliased<'YES' | 'NO'>(str), + profile_segment_flag: Aliased<'YES' | 'NO'>(ustr), /** * The type of atoms in the model fit to the SAS data. */ @@ -4983,7 +4988,7 @@ export const mmCIF_Schema = { /** * The type of QA metric. */ - type: Aliased<'zscore' | 'energy' | 'distance' | 'normalized score' | 'pLDDT' | 'PAE' | 'contact probability' | 'other'>(str), + type: Aliased<'zscore' | 'energy' | 'distance' | 'normalized score' | 'pLDDT' | 'pLDDT in [0,1]' | 'pLDDT all-atom' | 'pLDDT all-atom in [0,1]' | 'PAE' | 'pTM' | 'ipTM' | 'contact probability' | 'other'>(str), /** * The mode of calculation of the QA metric. */ diff --git a/src/mol-model-formats/structure/basic/entities.ts b/src/mol-model-formats/structure/basic/entities.ts index d59b5535f3919c412dcfdb2c3135464879f019db..39d314d1762f7beca184b0bf91a754b2b915fd3e 100644 --- a/src/mol-model-formats/structure/basic/entities.ts +++ b/src/mol-model-formats/structure/basic/entities.ts @@ -10,6 +10,9 @@ import { Entities, EntitySubtype } from '../../../mol-model/structure/model/prop import { getEntityType, getEntitySubtype } from '../../../mol-model/structure/model/types'; import { ElementIndex, EntityIndex, Model } from '../../../mol-model/structure/model'; import { BasicData, BasicSchema, Entity } from './schema'; +import { mmCIF_chemComp_schema } from '../../../mol-io/reader/cif/schema/mmcif-extras'; + +type ChemCompType = mmCIF_chemComp_schema['type']['T']; export function getEntityData(data: BasicData): Entities { let entityData: Entity; @@ -35,7 +38,7 @@ export function getEntityData(data: BasicData): Entities { const entityId = sphere_entity_id.value(i); if (!entityIds.has(entityId)) { ids.push(entityId); - types.push('polymer'); + types.push('POLYMER'); entityIds.add(entityId); } } @@ -45,7 +48,7 @@ export function getEntityData(data: BasicData): Entities { const entityId = gaussian_entity_id.value(i); if (!entityIds.has(entityId)) { ids.push(entityId); - types.push('polymer'); + types.push('POLYMER'); entityIds.add(entityId); } } @@ -96,7 +99,7 @@ export function getEntityData(data: BasicData): Entities { } if (assignSubtype) { - const chemCompType = new Map<string, string>(); + const chemCompType = new Map<string, ChemCompType>(); if (data.chem_comp) { const { id, type } = data.chem_comp; for (let i = 0, il = data.chem_comp._rowCount; i < il; i++) { @@ -110,7 +113,7 @@ export function getEntityData(data: BasicData): Entities { const entityId = label_entity_id.value(i); if (!entityIds.has(entityId)) { const compId = label_comp_id.value(i); - const compType = chemCompType.get(compId) || ''; + const compType = chemCompType.get(compId) || 'OTHER'; subtypes[getEntityIndex(entityId)] = getEntitySubtype(compId, compType); entityIds.add(entityId); } diff --git a/src/mol-model-formats/structure/common/component.ts b/src/mol-model-formats/structure/common/component.ts index 8cceda0b1178e80c937870542a085a4c0c1943c0..ea39b188cac5a527c9430a0e62264bdf4ac5ef19 100644 --- a/src/mol-model-formats/structure/common/component.ts +++ b/src/mol-model-formats/structure/common/component.ts @@ -37,48 +37,48 @@ const NonPolymerNames = new Set([ const StandardComponents = (function () { const map = new Map<string, Component>(); const components: Component[] = [ - { id: 'HIS', name: 'HISTIDINE', type: 'L-peptide linking' }, - { id: 'ARG', name: 'ARGININE', type: 'L-peptide linking' }, - { id: 'LYS', name: 'LYSINE', type: 'L-peptide linking' }, - { id: 'ILE', name: 'ISOLEUCINE', type: 'L-peptide linking' }, - { id: 'PHE', name: 'PHENYLALANINE', type: 'L-peptide linking' }, - { id: 'LEU', name: 'LEUCINE', type: 'L-peptide linking' }, - { id: 'TRP', name: 'TRYPTOPHAN', type: 'L-peptide linking' }, - { id: 'ALA', name: 'ALANINE', type: 'L-peptide linking' }, - { id: 'MET', name: 'METHIONINE', type: 'L-peptide linking' }, - { id: 'CYS', name: 'CYSTEINE', type: 'L-peptide linking' }, - { id: 'ASN', name: 'ASPARAGINE', type: 'L-peptide linking' }, - { id: 'VAL', name: 'VALINE', type: 'L-peptide linking' }, - { id: 'GLY', name: 'GLYCINE', type: 'peptide linking' }, - { id: 'SER', name: 'SERINE', type: 'L-peptide linking' }, - { id: 'GLN', name: 'GLUTAMINE', type: 'L-peptide linking' }, - { id: 'TYR', name: 'TYROSINE', type: 'L-peptide linking' }, - { id: 'ASP', name: 'ASPARTIC ACID', type: 'L-peptide linking' }, - { id: 'GLU', name: 'GLUTAMIC ACID', type: 'L-peptide linking' }, - { id: 'THR', name: 'THREONINE', type: 'L-peptide linking' }, - { id: 'PRO', name: 'PROLINE', type: 'L-peptide linking' }, - { id: 'SEC', name: 'SELENOCYSTEINE', type: 'L-peptide linking' }, - { id: 'PYL', name: 'PYRROLYSINE', type: 'L-peptide linking' }, - - { id: 'MSE', name: 'SELENOMETHIONINE', type: 'L-peptide linking' }, - { id: 'SEP', name: 'PHOSPHOSERINE', type: 'L-peptide linking' }, - { id: 'TPO', name: 'PHOSPHOTHREONINE', type: 'L-peptide linking' }, - { id: 'PTR', name: 'O-PHOSPHOTYROSINE', type: 'L-peptide linking' }, - { id: 'PCA', name: 'PYROGLUTAMIC ACID', type: 'L-peptide linking' }, - - { id: 'A', name: 'ADENOSINE-5\'-MONOPHOSPHATE', type: 'RNA linking' }, - { id: 'C', name: 'CYTIDINE-5\'-MONOPHOSPHATE', type: 'RNA linking' }, - { id: 'T', name: 'THYMIDINE-5\'-MONOPHOSPHATE', type: 'RNA linking' }, - { id: 'G', name: 'GUANOSINE-5\'-MONOPHOSPHATE', type: 'RNA linking' }, - { id: 'I', name: 'INOSINIC ACID', type: 'RNA linking' }, - { id: 'U', name: 'URIDINE-5\'-MONOPHOSPHATE', type: 'RNA linking' }, - - { id: 'DA', name: '2\'-DEOXYADENOSINE-5\'-MONOPHOSPHATE', type: 'DNA linking' }, - { id: 'DC', name: '2\'-DEOXYCYTIDINE-5\'-MONOPHOSPHATE', type: 'DNA linking' }, - { id: 'DT', name: 'THYMIDINE-5\'-MONOPHOSPHATE', type: 'DNA linking' }, - { id: 'DG', name: '2\'-DEOXYGUANOSINE-5\'-MONOPHOSPHATE', type: 'DNA linking' }, - { id: 'DI', name: '2\'-DEOXYINOSINE-5\'-MONOPHOSPHATE', type: 'DNA linking' }, - { id: 'DU', name: '2\'-DEOXYURIDINE-5\'-MONOPHOSPHATE', type: 'DNA linking' }, + { id: 'HIS', name: 'HISTIDINE', type: 'L-PEPTIDE LINKING' }, + { id: 'ARG', name: 'ARGININE', type: 'L-PEPTIDE LINKING' }, + { id: 'LYS', name: 'LYSINE', type: 'L-PEPTIDE LINKING' }, + { id: 'ILE', name: 'ISOLEUCINE', type: 'L-PEPTIDE LINKING' }, + { id: 'PHE', name: 'PHENYLALANINE', type: 'L-PEPTIDE LINKING' }, + { id: 'LEU', name: 'LEUCINE', type: 'L-PEPTIDE LINKING' }, + { id: 'TRP', name: 'TRYPTOPHAN', type: 'L-PEPTIDE LINKING' }, + { id: 'ALA', name: 'ALANINE', type: 'L-PEPTIDE LINKING' }, + { id: 'MET', name: 'METHIONINE', type: 'L-PEPTIDE LINKING' }, + { id: 'CYS', name: 'CYSTEINE', type: 'L-PEPTIDE LINKING' }, + { id: 'ASN', name: 'ASPARAGINE', type: 'L-PEPTIDE LINKING' }, + { id: 'VAL', name: 'VALINE', type: 'L-PEPTIDE LINKING' }, + { id: 'GLY', name: 'GLYCINE', type: 'PEPTIDE LINKING' }, + { id: 'SER', name: 'SERINE', type: 'L-PEPTIDE LINKING' }, + { id: 'GLN', name: 'GLUTAMINE', type: 'L-PEPTIDE LINKING' }, + { id: 'TYR', name: 'TYROSINE', type: 'L-PEPTIDE LINKING' }, + { id: 'ASP', name: 'ASPARTIC ACID', type: 'L-PEPTIDE LINKING' }, + { id: 'GLU', name: 'GLUTAMIC ACID', type: 'L-PEPTIDE LINKING' }, + { id: 'THR', name: 'THREONINE', type: 'L-PEPTIDE LINKING' }, + { id: 'PRO', name: 'PROLINE', type: 'L-PEPTIDE LINKING' }, + { id: 'SEC', name: 'SELENOCYSTEINE', type: 'L-PEPTIDE LINKING' }, + { id: 'PYL', name: 'PYRROLYSINE', type: 'L-PEPTIDE LINKING' }, + + { id: 'MSE', name: 'SELENOMETHIONINE', type: 'L-PEPTIDE LINKING' }, + { id: 'SEP', name: 'PHOSPHOSERINE', type: 'L-PEPTIDE LINKING' }, + { id: 'TPO', name: 'PHOSPHOTHREONINE', type: 'L-PEPTIDE LINKING' }, + { id: 'PTR', name: 'O-PHOSPHOTYROSINE', type: 'L-PEPTIDE LINKING' }, + { id: 'PCA', name: 'PYROGLUTAMIC ACID', type: 'L-PEPTIDE LINKING' }, + + { id: 'A', name: 'ADENOSINE-5\'-MONOPHOSPHATE', type: 'RNA LINKING' }, + { id: 'C', name: 'CYTIDINE-5\'-MONOPHOSPHATE', type: 'RNA LINKING' }, + { id: 'T', name: 'THYMIDINE-5\'-MONOPHOSPHATE', type: 'RNA LINKING' }, + { id: 'G', name: 'GUANOSINE-5\'-MONOPHOSPHATE', type: 'RNA LINKING' }, + { id: 'I', name: 'INOSINIC ACID', type: 'RNA LINKING' }, + { id: 'U', name: 'URIDINE-5\'-MONOPHOSPHATE', type: 'RNA LINKING' }, + + { id: 'DA', name: '2\'-DEOXYADENOSINE-5\'-MONOPHOSPHATE', type: 'DNA LINKING' }, + { id: 'DC', name: '2\'-DEOXYCYTIDINE-5\'-MONOPHOSPHATE', type: 'DNA LINKING' }, + { id: 'DT', name: 'THYMIDINE-5\'-MONOPHOSPHATE', type: 'DNA LINKING' }, + { id: 'DG', name: '2\'-DEOXYGUANOSINE-5\'-MONOPHOSPHATE', type: 'DNA LINKING' }, + { id: 'DI', name: '2\'-DEOXYINOSINE-5\'-MONOPHOSPHATE', type: 'DNA LINKING' }, + { id: 'DU', name: '2\'-DEOXYURIDINE-5\'-MONOPHOSPHATE', type: 'DNA LINKING' }, ]; components.forEach(c => map.set(c.id, c)); return map; @@ -87,12 +87,12 @@ const StandardComponents = (function () { const CharmmIonComponents = (function () { const map = new Map<string, Component>(); const components: Component[] = [ - { id: 'ZN2', name: 'ZINC ION', type: 'Ion' }, - { id: 'SOD', name: 'SODIUM ION', type: 'Ion' }, - { id: 'CES', name: 'CESIUM ION', type: 'Ion' }, - { id: 'CLA', name: 'CHLORIDE ION', type: 'Ion' }, - { id: 'CAL', name: 'CALCIUM ION', type: 'Ion' }, - { id: 'POT', name: 'POTASSIUM ION', type: 'Ion' }, + { id: 'ZN2', name: 'ZINC ION', type: 'ION' }, + { id: 'SOD', name: 'SODIUM ION', type: 'ION' }, + { id: 'CES', name: 'CESIUM ION', type: 'ION' }, + { id: 'CLA', name: 'CHLORIDE ION', type: 'ION' }, + { id: 'CAL', name: 'CALCIUM ION', type: 'ION' }, + { id: 'POT', name: 'POTASSIUM ION', type: 'ION' }, ]; components.forEach(c => map.set(c.id, c)); return map; @@ -111,7 +111,7 @@ export class ComponentBuilder { this.ids.push(c.id); this.names.push(c.name); this.types.push(c.type); - this.mon_nstd_flags.push(PolymerNames.has(c.id) ? 'y' : 'n'); + this.mon_nstd_flags.push(PolymerNames.has(c.id) ? 'Y' : 'N'); } private getAtomIds(index: number) { @@ -138,13 +138,13 @@ export class ComponentBuilder { private getType(atomIds: Set<string>): Component['type'] { if (this.hasAtomIds(atomIds, ProteinAtomIdsList)) { - return 'peptide linking'; + return 'PEPTIDE LINKING'; } else if (this.hasAtomIds(atomIds, RnaAtomIdsList)) { - return 'RNA linking'; + return 'RNA LINKING'; } else if (this.hasAtomIds(atomIds, DnaAtomIdsList)) { - return 'DNA linking'; + return 'DNA LINKING'; } else { - return 'other'; + return 'OTHER'; } } @@ -156,11 +156,11 @@ export class ComponentBuilder { if (StandardComponents.has(compId)) { this.set(StandardComponents.get(compId)!); } else if (WaterNames.has(compId)) { - this.set({ id: compId, name: 'WATER', type: 'non-polymer' }); + this.set({ id: compId, name: 'WATER', type: 'NON-POLYMER' }); } else if (NonPolymerNames.has(compId.toUpperCase())) { - this.set({ id: compId, name: this.namesMap.get(compId) || compId, type: 'non-polymer' }); + this.set({ id: compId, name: this.namesMap.get(compId) || compId, type: 'NON-POLYMER' }); } else if (SaccharideCompIdMap.has(compId.toUpperCase())) { - this.set({ id: compId, name: this.namesMap.get(compId) || compId, type: 'saccharide' }); + this.set({ id: compId, name: this.namesMap.get(compId) || compId, type: 'SACCHARIDE' }); } else { const atomIds = this.getAtomIds(index); if (atomIds.size === 1 && CharmmIonComponents.has(compId)) { diff --git a/src/mol-model-formats/structure/common/entity.ts b/src/mol-model-formats/structure/common/entity.ts index 25e271473cb87989b2cdebc2d792f82e0986defa..8ed5b620e6203a2fcb0214dfe7a7b52e2b7354c1 100644 --- a/src/mol-model-formats/structure/common/entity.ts +++ b/src/mol-model-formats/structure/common/entity.ts @@ -11,7 +11,7 @@ import { BasicSchema } from '../basic/schema'; export type EntityCompound = { chains: string[], description: string } // TODO add support for `branched` -type EntityType = 'water' | 'polymer' | 'non-polymer' +type EntityType = 'WATER' | 'POLYMER' | 'NON-POLYMER' export class EntityBuilder { private count = 0; @@ -35,7 +35,7 @@ export class EntityBuilder { getEntityId(compId: string, moleculeType: MoleculeType, chainId: string, options?: { customName?: string }): string { if (moleculeType === MoleculeType.Water) { if (this.waterId === undefined) { - this.set('water', options?.customName || 'Water'); + this.set('WATER', options?.customName || 'Water'); this.waterId = `${this.count}`; } return this.waterId; @@ -44,14 +44,14 @@ export class EntityBuilder { return this.compoundsMap.get(chainId)!; } else { if (!this.chainMap.has(chainId)) { - this.set('polymer', options?.customName || `Polymer ${this.chainMap.size + 1}`); + this.set('POLYMER', options?.customName || `Polymer ${this.chainMap.size + 1}`); this.chainMap.set(chainId, `${this.count}`); } return this.chainMap.get(chainId)!; } } else { if (!this.heteroMap.has(compId)) { - this.set('non-polymer', options?.customName || this.namesMap.get(compId) || compId); + this.set('NON-POLYMER', options?.customName || this.namesMap.get(compId) || compId); this.heteroMap.set(compId, `${this.count}`); } return this.heteroMap.get(compId)!; @@ -69,7 +69,7 @@ export class EntityBuilder { setCompounds(compounds: EntityCompound[]) { for (let i = 0, il = compounds.length; i < il; ++i) { const { chains, description } = compounds[i]; - this.set('polymer', description); + this.set('POLYMER', description); for (let j = 0, jl = chains.length; j < jl; ++j) { this.compoundsMap.set(chains[j], `${this.count}`); } diff --git a/src/mol-model-formats/structure/property/bonds/struct_conn.ts b/src/mol-model-formats/structure/property/bonds/struct_conn.ts index 2713d0f4f779f49ce16ed9274c5294b79836d688..328f7d4879eb361a05a5c9286b5b22011f535ce3 100644 --- a/src/mol-model-formats/structure/property/bonds/struct_conn.ts +++ b/src/mol-model-formats/structure/property/bonds/struct_conn.ts @@ -138,15 +138,15 @@ export namespace StructConn { if (partnerA === undefined || partnerB === undefined) continue; const type = conn_type_id.value(i); - const orderType = (pdbx_value_order.value(i) || '').toLowerCase(); + const orderType = (pdbx_value_order.value(i) || ''); let flags = BondType.Flag.None; let order = 1; switch (orderType) { - case 'sing': order = 1; break; - case 'doub': order = 2; break; - case 'trip': order = 3; break; - case 'quad': order = 4; break; + case 'SING': order = 1; break; + case 'DOUB': order = 2; break; + case 'TRIP': order = 3; break; + case 'QUAD': order = 4; break; default: order = getInterBondOrderFromTable( struct_conn.ptnr1_label_comp_id.value(i), @@ -157,14 +157,14 @@ export namespace StructConn { } switch (type) { - case 'covale': + case 'COVALE': flags = BondType.Flag.Covalent; break; - case 'disulf': flags = BondType.Flag.Covalent | BondType.Flag.Disulfide; break; - case 'hydrog': + case 'DISULF': flags = BondType.Flag.Covalent | BondType.Flag.Disulfide; break; + case 'HYDROG': flags = BondType.Flag.HydrogenBond; break; - case 'metalc': flags = BondType.Flag.MetallicCoordination; break; + case 'METALC': flags = BondType.Flag.MetallicCoordination; break; } entries.push({ diff --git a/src/mol-model/structure/model/properties/sequence.ts b/src/mol-model/structure/model/properties/sequence.ts index 7cb395f97952e3b110c08ba58c28117e76468ecd..510cef237b694a209cecae58d0af52a9b944eddf 100644 --- a/src/mol-model/structure/model/properties/sequence.ts +++ b/src/mol-model/structure/model/properties/sequence.ts @@ -60,11 +60,11 @@ namespace StructureSequence { for (let cI = 0 as ChainIndex, _cI = hierarchy.chains._rowCount; cI < _cI; cI++) { const entityKey = hierarchy.index.getEntityFromChain(cI); // Only for polymers, trying to mirror _entity_poly_seq - if (byEntityKey[entityKey] !== void 0 || entities.data.type.value(entityKey) !== 'polymer') continue; + if (byEntityKey[entityKey] !== void 0 || entities.data.type.value(entityKey) !== 'POLYMER') continue; const start = cI; cI++; - while (cI < _cI && entityKey === hierarchy.index.getEntityFromChain(cI) && entities.data.type.value(entityKey) !== 'polymer') { + while (cI < _cI && entityKey === hierarchy.index.getEntityFromChain(cI) && entities.data.type.value(entityKey) !== 'POLYMER') { cI++; } cI--; diff --git a/src/mol-model/structure/model/properties/utils/atomic-derived.ts b/src/mol-model/structure/model/properties/utils/atomic-derived.ts index a2dc50223d24116afb8855316425d7120e1d1472..fcbc1c548f35080da1c4456e3d976b82b35c9969 100644 --- a/src/mol-model/structure/model/properties/utils/atomic-derived.ts +++ b/src/mol-model/structure/model/properties/utils/atomic-derived.ts @@ -11,6 +11,9 @@ import { MoleculeType, getMoleculeType, getComponentType, PolymerType, getPolyme import { getAtomIdForAtomRole } from '../../../../../mol-model/structure/util'; import { ChemicalComponentMap } from '../common'; import { isProductionMode } from '../../../../../mol-util/debug'; +import { mmCIF_chemComp_schema } from '../../../../../mol-io/reader/cif/schema/mmcif-extras'; + +type ChemCompType = mmCIF_chemComp_schema['type']['T']; export function getAtomicDerivedData(data: AtomicData, segments: AtomicSegments, index: AtomicIndex, chemicalComponentMap: ChemicalComponentMap): AtomicDerivedData { const { label_comp_id, type_symbol, _rowCount: atomCount } = data.atoms; @@ -42,7 +45,7 @@ export function getAtomicDerivedData(data: AtomicData, segments: AtomicSegments, molType = moleculeTypeMap.get(compId)!; polyType = polymerTypeMap.get(compId)!; } else { - let type: string; + let type: ChemCompType; if (chemCompMap.has(compId)) { type = chemCompMap.get(compId)!.type; } else { diff --git a/src/mol-model/structure/model/types.ts b/src/mol-model/structure/model/types.ts index e6c7b808075a350065b169655ee8ee8090d59fc2..8a46d673c0541e1102869c2e08042f7e73c79639 100644 --- a/src/mol-model/structure/model/types.ts +++ b/src/mol-model/structure/model/types.ts @@ -1,5 +1,5 @@ /** - * Copyright (c) 2017-2021 mol* contributors, licensed under MIT, See LICENSE file for more info. + * Copyright (c) 2017-2022 mol* contributors, licensed under MIT, See LICENSE file for more info. * * @author Alexander Rose <alexander.rose@weirdbyte.de> * @author David Sehnal <david.sehnal@gmail.com> @@ -162,38 +162,40 @@ export const NucleicBackboneAtoms = new Set([ 'O2*', 'O3*', 'O4*', 'O5*', 'C1*', 'C2*', 'C3*', 'C4*', 'C5*' ]); +type ChemCompType = mmCIF_chemComp_schema['type']['T']; + /** Chemical component type names for D-linked protein */ -export const DProteinComponentTypeNames = new Set([ +export const DProteinComponentTypeNames = new Set<ChemCompType>([ 'D-PEPTIDE LINKING', 'D-PEPTIDE NH3 AMINO TERMINUS', 'D-PEPTIDE COOH CARBOXY TERMINUS', 'D-GAMMA-PEPTIDE, C-DELTA LINKING', 'D-BETA-PEPTIDE, C-GAMMA LINKING' ]); /** Chemical component type names for L-linked protein */ -export const LProteinComponentTypeNames = new Set([ +export const LProteinComponentTypeNames = new Set<ChemCompType>([ 'L-PEPTIDE LINKING', 'L-PEPTIDE NH3 AMINO TERMINUS', 'L-PEPTIDE COOH CARBOXY TERMINUS', 'L-GAMMA-PEPTIDE, C-DELTA LINKING', 'L-BETA-PEPTIDE, C-GAMMA LINKING' ]); /** Chemical component type names for gamma protein, overlaps with D/L-linked */ -export const GammaProteinComponentTypeNames = new Set([ +export const GammaProteinComponentTypeNames = new Set<ChemCompType>([ 'D-GAMMA-PEPTIDE, C-DELTA LINKING', 'L-GAMMA-PEPTIDE, C-DELTA LINKING' ]); /** Chemical component type names for beta protein, overlaps with D/L-linked */ -export const BetaProteinComponentTypeNames = new Set([ +export const BetaProteinComponentTypeNames = new Set<ChemCompType>([ 'D-BETA-PEPTIDE, C-GAMMA LINKING', 'L-BETA-PEPTIDE, C-GAMMA LINKING' ]); /** Chemical component type names for protein termini, overlaps with D/L-linked */ -export const ProteinTerminusComponentTypeNames = new Set([ +export const ProteinTerminusComponentTypeNames = new Set<ChemCompType>([ 'D-PEPTIDE NH3 AMINO TERMINUS', 'D-PEPTIDE COOH CARBOXY TERMINUS', 'L-PEPTIDE NH3 AMINO TERMINUS', 'L-PEPTIDE COOH CARBOXY TERMINUS' ]); /** Chemical component type names for peptide-like protein */ -export const OtherProteinComponentTypeNames = new Set([ +export const OtherProteinComponentTypeNames = new Set<ChemCompType>([ 'PEPTIDE LINKING', 'PEPTIDE-LIKE', ]); @@ -203,37 +205,41 @@ export const ProteinComponentTypeNames = SetUtils.unionMany( ); /** Chemical component type names for DNA */ -export const DNAComponentTypeNames = new Set([ +export const DNAComponentTypeNames = new Set<ChemCompType>([ 'DNA LINKING', 'L-DNA LINKING', 'DNA OH 5 PRIME TERMINUS', 'DNA OH 3 PRIME TERMINUS', ]); /** Chemical component type names for RNA */ -export const RNAComponentTypeNames = new Set([ +export const RNAComponentTypeNames = new Set<ChemCompType>([ 'RNA LINKING', 'L-RNA LINKING', 'RNA OH 5 PRIME TERMINUS', 'RNA OH 3 PRIME TERMINUS', ]); /** Chemical component type names for saccharide */ -export const SaccharideComponentTypeNames = new Set([ - 'D-SACCHARIDE, BETA LINKING', 'L-SACCHARIDE, BETA LINKING', - 'D-SACCHARIDE, ALPHA LINKING', 'L-SACCHARIDE, ALPHA LINKING', - 'L-SACCHARIDE', 'D-SACCHARIDE', 'SACCHARIDE', - // the following four are marked to be deprecated in the mmCIF dictionary - 'D-SACCHARIDE 1,4 AND 1,4 LINKING', 'L-SACCHARIDE 1,4 AND 1,4 LINKING', - 'D-SACCHARIDE 1,4 AND 1,6 LINKING', 'L-SACCHARIDE 1,4 AND 1,6 LINKING', -]); +export const SaccharideComponentTypeNames = SetUtils.unionMany( + new Set<ChemCompType>([ + 'D-SACCHARIDE, BETA LINKING', 'L-SACCHARIDE, BETA LINKING', + 'D-SACCHARIDE, ALPHA LINKING', 'L-SACCHARIDE, ALPHA LINKING', + 'L-SACCHARIDE', 'D-SACCHARIDE', 'SACCHARIDE', + ]), + // deprecated in the mmCIF dictionary, kept for backward compatibility + new Set([ + 'D-SACCHARIDE 1,4 AND 1,4 LINKING', 'L-SACCHARIDE 1,4 AND 1,4 LINKING', + 'D-SACCHARIDE 1,4 AND 1,6 LINKING', 'L-SACCHARIDE 1,4 AND 1,6 LINKING' + ]), +); /** Chemical component type names for other */ -export const OtherComponentTypeNames = new Set([ +export const OtherComponentTypeNames = new Set<ChemCompType>([ 'NON-POLYMER', 'OTHER' ]); /** Chemical component type names for ion (extension to mmcif) */ -export const IonComponentTypeNames = new Set([ +export const IonComponentTypeNames = new Set<ChemCompType>([ 'ION' ]); /** Chemical component type names for lipid (extension to mmcif) */ -export const LipidComponentTypeNames = new Set([ +export const LipidComponentTypeNames = new Set<ChemCompType>([ 'LIPID' ]); @@ -298,8 +304,7 @@ export const isPyrimidineBase = (compId: string) => PyrimidineBaseNames.has(comp export const PolymerNames = SetUtils.unionMany(AminoAcidNames, BaseNames); /** get the molecule type from component type and id */ -export function getMoleculeType(compType: string, compId: string): MoleculeType { - compType = compType.toUpperCase(); +export function getMoleculeType(compType: ChemCompType, compId: string): MoleculeType { compId = compId.toUpperCase(); if (PeptideBaseNames.has(compId)) { return MoleculeType.PNA; @@ -319,7 +324,7 @@ export function getMoleculeType(compType: string, compId: string): MoleculeType return MoleculeType.Lipid; } else if (OtherComponentTypeNames.has(compType)) { if (SaccharideCompIdMap.has(compId)) { - // trust our saccharide table more than given 'non-polymer' or 'other' component type + // trust our saccharide table more than given 'NON-POLYMER' or 'OTHER' component type return MoleculeType.Saccharide; } else if (AminoAcidNames.has(compId)) { return MoleculeType.Protein; @@ -335,8 +340,7 @@ export function getMoleculeType(compType: string, compId: string): MoleculeType } } -export function getPolymerType(compType: string, molType: MoleculeType): PolymerType { - compType = compType.toUpperCase(); +export function getPolymerType(compType: ChemCompType, molType: MoleculeType): PolymerType { if (molType === MoleculeType.Protein) { if (GammaProteinComponentTypeNames.has(compType)) { return PolymerType.GammaProtein; @@ -358,18 +362,18 @@ export function getPolymerType(compType: string, molType: MoleculeType): Polymer } } -export function getComponentType(compId: string): mmCIF_chemComp_schema['type']['T'] { +export function getComponentType(compId: string): ChemCompType { compId = compId.toUpperCase(); if (AminoAcidNames.has(compId)) { - return 'peptide linking'; + return 'PEPTIDE LINKING'; } else if (RnaBaseNames.has(compId)) { - return 'RNA linking'; + return 'RNA LINKING'; } else if (DnaBaseNames.has(compId)) { - return 'DNA linking'; + return 'DNA LINKING'; } else if (SaccharideCompIdMap.has(compId)) { - return 'saccharide'; + return 'SACCHARIDE'; } else { - return 'other'; + return 'OTHER'; } } @@ -381,7 +385,7 @@ export function getDefaultChemicalComponent(compId: string): ChemicalComponent { formula_weight: 0, id: compId, name: compId, - mon_nstd_flag: PolymerNames.has(compId) ? 'y' : 'n', + mon_nstd_flag: PolymerNames.has(compId) ? 'Y' : 'N', pdbx_synonyms: [], type: getComponentType(compId) }; @@ -390,19 +394,18 @@ export function getDefaultChemicalComponent(compId: string): ChemicalComponent { export function getEntityType(compId: string): mmCIF_Schema['entity']['type']['T'] { compId = compId.toUpperCase(); if (WaterNames.has(compId)) { - return 'water'; + return 'WATER'; } else if (PolymerNames.has(compId)) { - return 'polymer'; + return 'POLYMER'; } else if (SaccharideCompIdMap.has(compId)) { - return 'branched'; + return 'BRANCHED'; } else { - return 'non-polymer'; + return 'NON-POLYMER'; } } -export function getEntitySubtype(compId: string, compType: string): EntitySubtype { +export function getEntitySubtype(compId: string, compType: ChemCompType): EntitySubtype { compId = compId.toUpperCase(); - compType = compType.toUpperCase(); if (LProteinComponentTypeNames.has(compType)) { return 'polypeptide(L)'; } else if (DProteinComponentTypeNames.has(compType)) { diff --git a/src/mol-model/structure/query/queries/internal.ts b/src/mol-model/structure/query/queries/internal.ts index 38bcaebeec8759a8f1041b62d59f6e1c605f715e..8fc9f91cd166c6f81d2880215eaceef26b5e87e3 100644 --- a/src/mol-model/structure/query/queries/internal.ts +++ b/src/mol-model/structure/query/queries/internal.ts @@ -30,7 +30,7 @@ export function atomicSequence(): StructureQuery { l.unit = unit; const elements = unit.elements; l.element = elements[0]; - if (P.entity.type(l) !== 'polymer') continue; + if (P.entity.type(l) !== 'POLYMER') continue; const residuesIt = Segmentation.transientSegments(unit.model.atomicHierarchy.residueAtomSegments, elements); let residueCount = 0; @@ -59,7 +59,7 @@ export function water(): StructureQuery { l.unit = unit; const elements = unit.elements; l.element = elements[0]; - if (P.entity.type(l) !== 'water') continue; + if (P.entity.type(l) !== 'WATER') continue; units.push(unit); } return StructureSelection.Singletons(inputStructure, Structure.create(units, { parent: inputStructure })); @@ -78,8 +78,8 @@ export function atomicHet(): StructureQuery { l.unit = unit; const elements = unit.elements; l.element = elements[0]; - if (P.entity.type(l) === 'water') continue; - if (P.entity.type(l) === 'polymer') { + if (P.entity.type(l) === 'WATER') continue; + if (P.entity.type(l) === 'POLYMER') { const residuesIt = Segmentation.transientSegments(unit.model.atomicHierarchy.residueAtomSegments, elements); let residueCount = 0; while (residuesIt.hasNext) { diff --git a/src/mol-model/structure/query/queries/modifiers.ts b/src/mol-model/structure/query/queries/modifiers.ts index c860695950b6b3430e8d6f8effa9843e4456b396..3522c9aef65393c89ac084ae76d66039c7ca2846 100644 --- a/src/mol-model/structure/query/queries/modifiers.ts +++ b/src/mol-model/structure/query/queries/modifiers.ts @@ -492,7 +492,7 @@ export function surroundingLigands({ query, radius, includeWater }: SurroundingL const entityType = StructureProperties.entity.type(l); // test entity and chain - if (entityType === 'water' || entityType === 'polymer') continue; + if (entityType === 'WATER' || entityType === 'POLYMER') continue; residuesIt.setSegment(chainSegment); while (residuesIt.hasNext) { @@ -575,7 +575,7 @@ export function surroundingLigands({ query, radius, includeWater }: SurroundingL const _entity_type = StructureProperties.entity.type; function testIsWater(l: StructureElement.Location) { - return _entity_type(l) === 'water'; + return _entity_type(l) === 'WATER'; } function getPrdAsymIdx(structure: Structure) { @@ -602,7 +602,7 @@ function getStructConnInfo(structure: Structure) { for (let i = 0; i < struct_conn._rowCount; i++) { const bondType = conn_type_id.value(i); - if (bondType !== 'covale' && bondType !== 'metalc') continue; + if (bondType !== 'COVALE' && bondType !== 'METALC') continue; const a: ResidueSetEntry = { label_asym_id: ptnr1_label_asym_id.value(i), diff --git a/src/mol-model/structure/structure/structure.ts b/src/mol-model/structure/structure/structure.ts index 81f84f447fa5c17191641c2d8c3b81594bcdc08d..660f1c9a5f50b6f27d3a00fc30492150332db7d6 100644 --- a/src/mol-model/structure/structure/structure.ts +++ b/src/mol-model/structure/structure/structure.ts @@ -855,12 +855,12 @@ namespace Structure { function isWaterChain(model: Model, chainIndex: ChainIndex) { const e = model.atomicHierarchy.index.getEntityFromChain(chainIndex); - return model.entities.data.type.value(e) === 'water'; + return model.entities.data.type.value(e) === 'WATER'; } function isPolymerChain(model: Model, chainIndex: ChainIndex) { const e = model.atomicHierarchy.index.getEntityFromChain(chainIndex); - return model.entities.data.type.value(e) === 'polymer'; + return model.entities.data.type.value(e) === 'POLYMER'; } function partitionAtomicUnitByAtom(model: Model, indices: SortedArray, builder: StructureBuilder, multiChain: boolean, operator: SymmetryOperator) { diff --git a/src/mol-plugin-state/helpers/structure-selection-query.ts b/src/mol-plugin-state/helpers/structure-selection-query.ts index 4640cf0fc9ace99f2202be4539da4f33d02f1907..bc02cdb0d7e4ed026b36005d7638444c6421ff51 100644 --- a/src/mol-plugin-state/helpers/structure-selection-query.ts +++ b/src/mol-plugin-state/helpers/structure-selection-query.ts @@ -1,5 +1,5 @@ /** - * Copyright (c) 2019-2021 mol* contributors, licensed under MIT, See LICENSE file for more info. + * Copyright (c) 2019-2022 mol* contributors, licensed under MIT, See LICENSE file for more info. * * @author Alexander Rose <alexander.rose@weirdbyte.de> * @author David Sehnal <david.sehnal@gmail.com> @@ -91,7 +91,7 @@ const current = StructureSelectionQuery('Current Selection', MS.internal.generat const polymer = StructureSelectionQuery('Polymer', MS.struct.modifier.union([ MS.struct.generator.atomGroups({ 'entity-test': MS.core.logic.and([ - MS.core.rel.eq([MS.ammp('entityType'), 'polymer']), + MS.core.rel.eq([MS.ammp('entityType'), 'POLYMER']), MS.core.str.match([ MS.re('(polypeptide|cyclic-pseudo-peptide|peptide-like|nucleotide|peptide nucleic acid)', 'i'), MS.ammp('entitySubtype') @@ -104,7 +104,7 @@ const trace = StructureSelectionQuery('Trace', MS.struct.modifier.union([ MS.struct.combinator.merge([ MS.struct.modifier.union([ MS.struct.generator.atomGroups({ - 'entity-test': MS.core.rel.eq([MS.ammp('entityType'), 'polymer']), + 'entity-test': MS.core.rel.eq([MS.ammp('entityType'), 'POLYMER']), 'chain-test': MS.core.set.has([ MS.set('sphere', 'gaussian'), MS.ammp('objectPrimitive') ]) @@ -112,7 +112,7 @@ const trace = StructureSelectionQuery('Trace', MS.struct.modifier.union([ ]), MS.struct.modifier.union([ MS.struct.generator.atomGroups({ - 'entity-test': MS.core.rel.eq([MS.ammp('entityType'), 'polymer']), + 'entity-test': MS.core.rel.eq([MS.ammp('entityType'), 'POLYMER']), 'chain-test': MS.core.rel.eq([MS.ammp('objectPrimitive'), 'atomistic']), 'atom-test': MS.core.set.has([MS.set('CA', 'P'), MS.ammp('label_atom_id')]) }) @@ -121,7 +121,7 @@ const trace = StructureSelectionQuery('Trace', MS.struct.modifier.union([ ]), { category: StructureSelectionCategory.Structure }); const _proteinEntityTest = MS.core.logic.and([ - MS.core.rel.eq([MS.ammp('entityType'), 'polymer']), + MS.core.rel.eq([MS.ammp('entityType'), 'POLYMER']), MS.core.str.match([ MS.re('(polypeptide|cyclic-pseudo-peptide|peptide-like)', 'i'), MS.ammp('entitySubtype') @@ -129,7 +129,7 @@ const _proteinEntityTest = MS.core.logic.and([ ]); const _nucleiEntityTest = MS.core.logic.and([ - MS.core.rel.eq([MS.ammp('entityType'), 'polymer']), + MS.core.rel.eq([MS.ammp('entityType'), 'POLYMER']), MS.core.str.match([ MS.re('(nucleotide|peptide nucleic acid)', 'i'), MS.ammp('entitySubtype') @@ -275,7 +275,7 @@ const beta = StructureSelectionQuery('Beta Strand/Sheet', MS.struct.modifier.uni const water = StructureSelectionQuery('Water', MS.struct.modifier.union([ MS.struct.generator.atomGroups({ - 'entity-test': MS.core.rel.eq([MS.ammp('entityType'), 'water']) + 'entity-test': MS.core.rel.eq([MS.ammp('entityType'), 'WATER']) }) ]), { category: StructureSelectionCategory.Type }); @@ -294,9 +294,9 @@ const lipid = StructureSelectionQuery('Lipid', MS.struct.modifier.union([ const branched = StructureSelectionQuery('Carbohydrate', MS.struct.modifier.union([ MS.struct.generator.atomGroups({ 'entity-test': MS.core.logic.or([ - MS.core.rel.eq([MS.ammp('entityType'), 'branched']), + MS.core.rel.eq([MS.ammp('entityType'), 'BRANCHED']), MS.core.logic.and([ - MS.core.rel.eq([MS.ammp('entityType'), 'non-polymer']), + MS.core.rel.eq([MS.ammp('entityType'), 'NON-POLYMER']), MS.core.str.match([ MS.re('oligosaccharide', 'i'), MS.ammp('entitySubtype') @@ -327,7 +327,7 @@ const ligand = StructureSelectionQuery('Ligand', MS.struct.modifier.union([ MS.struct.generator.atomGroups({ 'entity-test': MS.core.logic.and([ MS.core.logic.or([ - MS.core.rel.eq([MS.ammp('entityType'), 'non-polymer']), + MS.core.rel.eq([MS.ammp('entityType'), 'NON-POLYMER']), MS.core.rel.neq([MS.ammp('entityPrdId'), '']) ]), MS.core.logic.not([MS.core.str.match([ @@ -343,7 +343,7 @@ const ligand = StructureSelectionQuery('Ligand', MS.struct.modifier.union([ ]), MS.struct.modifier.union([ MS.struct.generator.atomGroups({ - 'entity-test': MS.core.rel.eq([MS.ammp('entityType'), 'polymer']), + 'entity-test': MS.core.rel.eq([MS.ammp('entityType'), 'POLYMER']), 'chain-test': MS.core.rel.eq([MS.ammp('objectPrimitive'), 'atomistic']), 'residue-test': _nonPolymerResidueTest }) @@ -352,7 +352,7 @@ const ligand = StructureSelectionQuery('Ligand', MS.struct.modifier.union([ ]), by: MS.struct.modifier.union([ MS.struct.generator.atomGroups({ - 'entity-test': MS.core.rel.eq([MS.ammp('entityType'), 'polymer']), + 'entity-test': MS.core.rel.eq([MS.ammp('entityType'), 'POLYMER']), 'chain-test': MS.core.rel.eq([MS.ammp('objectPrimitive'), 'atomistic']), 'residue-test': MS.core.set.has([ MS.set(...SetUtils.toArray(PolymerNames)), MS.ammp('label_comp_id') @@ -447,7 +447,7 @@ const nosBridges = StructureSelectionQuery('NOS Bridges', MS.struct.modifier.uni const nonStandardPolymer = StructureSelectionQuery('Non-standard Residues in Polymers', MS.struct.modifier.union([ MS.struct.generator.atomGroups({ - 'entity-test': MS.core.rel.eq([MS.ammp('entityType'), 'polymer']), + 'entity-test': MS.core.rel.eq([MS.ammp('entityType'), 'POLYMER']), 'chain-test': MS.core.rel.eq([MS.ammp('objectPrimitive'), 'atomistic']), 'residue-test': MS.ammp('isNonStandard') }) @@ -683,7 +683,7 @@ export function getPolymerAndBranchedEntityQueries(structures: Structure[]) { l.unit = ug.units[0]; l.element = ug.elements[0]; const entityType = StructureProperties.entity.type(l); - if (entityType === 'polymer' || entityType === 'branched') { + if (entityType === 'POLYMER' || entityType === 'BRANCHED') { const description = StructureProperties.entity.pdbx_description(l); uniqueEntities.set(description.join(', '), description); } diff --git a/src/mol-plugin-ui/sequence.tsx b/src/mol-plugin-ui/sequence.tsx index 3807eb073bce3679b54087076348f7b6c1db0e23..f5f0f1b469548ef1874aa8ba80a4a8968327e1d8 100644 --- a/src/mol-plugin-ui/sequence.tsx +++ b/src/mol-plugin-ui/sequence.tsx @@ -108,7 +108,7 @@ function getModelEntityOptions(structure: Structure, polymersOnly = false): [str const modelIdx = structure.getModelIndex(unit.model); const key = `${modelIdx}|${id}`; if (seen.has(key)) continue; - if (polymersOnly && SP.entity.type(l) !== 'polymer') continue; + if (polymersOnly && SP.entity.type(l) !== 'POLYMER') continue; let description = SP.entity.pdbx_description(l).join(', '); if (structure.models.length) { diff --git a/src/mol-plugin-ui/structure/focus.tsx b/src/mol-plugin-ui/structure/focus.tsx index f64af65c64e97ba528166335c394a612fcf11da0..bee80274168e5b76d5aa4b7a4303176b9622670e 100644 --- a/src/mol-plugin-ui/structure/focus.tsx +++ b/src/mol-plugin-ui/structure/focus.tsx @@ -62,8 +62,8 @@ function getFocusEntries(structure: Structure) { l.element = ug.elements[0]; const isMultiChain = Unit.Traits.is(l.unit.traits, Unit.Trait.MultiChain); const entityType = StructureProperties.entity.type(l); - const isNonPolymer = entityType === 'non-polymer'; - const isBranched = entityType === 'branched'; + const isNonPolymer = entityType === 'NON-POLYMER'; + const isBranched = entityType === 'BRANCHED'; const isBirdMolecule = !!StructureProperties.entity.prd_id(l); if (isBirdMolecule) { diff --git a/src/mol-plugin-ui/structure/superposition.tsx b/src/mol-plugin-ui/structure/superposition.tsx index 97216a7af2b81f29880ff3172716e2f7bbbc4e87..b104817a3d7e57f67dfefaa6e5998c2933c52688 100644 --- a/src/mol-plugin-ui/structure/superposition.tsx +++ b/src/mol-plugin-ui/structure/superposition.tsx @@ -272,7 +272,7 @@ export class SuperpositionControls extends PurePluginUIComponent<{ }, Superposit // only single polymer chain selections const l = StructureElement.Loci.getFirstLocation(selection, location)!; - if (selection.elements.length > 1 || StructureProperties.entity.type(l) !== 'polymer') return; + if (selection.elements.length > 1 || StructureProperties.entity.type(l) !== 'POLYMER') return; const stats = StructureElement.Stats.ofLoci(selection); const counts = structureElementStatsLabel(stats, { countsOnly: true }); diff --git a/src/mol-theme/color/polymer-id.ts b/src/mol-theme/color/polymer-id.ts index 1bbe42bafc81c7779a127b4770d7de24eabe55e1..1d64e9b2138a8b0c6bbdd0f5ef19a3643dffe4bf 100644 --- a/src/mol-theme/color/polymer-id.ts +++ b/src/mol-theme/color/polymer-id.ts @@ -60,7 +60,7 @@ function getPolymerAsymIdSerialMap(structure: Structure) { const { index: chainIndex } = chainIt.move(); const entityId = chains.label_entity_id.value(chainIndex); const eI = model.entities.getEntityIndex(entityId); - if (model.entities.data.type.value(eI) === 'polymer') { + if (model.entities.data.type.value(eI) === 'POLYMER') { const asymId = chains.label_asym_id.value(chainIndex); if (!map.has(asymId)) map.set(asymId, map.size); } @@ -75,7 +75,7 @@ function getPolymerAsymIdSerialMap(structure: Structure) { const elementIndex = chainElementSegments.offsets[chainIndex]; const entityId = entity_id.value(elementIndex); const eI = model.entities.getEntityIndex(entityId); - if (model.entities.data.type.value(eI) === 'polymer') { + if (model.entities.data.type.value(eI) === 'POLYMER') { const asymId = asym_id.value(elementIndex); if (!map.has(asymId)) map.set(asymId, map.size); }