Skip to content
Snippets Groups Projects
Commit 3cecb53b authored by Alexander Rose's avatar Alexander Rose
Browse files

added model.properties.structAsymMap

parent 0daf431d
No related branches found
No related tags found
No related merge requests found
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
*/ */
import { Model } from '../../../mol-model/structure/model/model'; import { Model } from '../../../mol-model/structure/model/model';
import { ChemicalComponent, MissingResidue } from '../../../mol-model/structure/model/properties/common'; import { ChemicalComponent, MissingResidue, StructAsym } from '../../../mol-model/structure/model/properties/common';
import { getMoleculeType, MoleculeType, getDefaultChemicalComponent } from '../../../mol-model/structure/model/types'; import { getMoleculeType, MoleculeType, getDefaultChemicalComponent } from '../../../mol-model/structure/model/types';
import { SaccharideComponentMap, SaccharideComponent, SaccharidesSnfgMap, SaccharideCompIdMap, UnknownSaccharideComponent } from '../../../mol-model/structure/structure/carbohydrates/constants'; import { SaccharideComponentMap, SaccharideComponent, SaccharidesSnfgMap, SaccharideCompIdMap, UnknownSaccharideComponent } from '../../../mol-model/structure/structure/carbohydrates/constants';
import { memoize1 } from '../../../mol-util/memoize'; import { memoize1 } from '../../../mol-util/memoize';
...@@ -107,10 +107,43 @@ const getUniqueComponentNames = memoize1((data: BasicData) => { ...@@ -107,10 +107,43 @@ const getUniqueComponentNames = memoize1((data: BasicData) => {
return uniqueNames return uniqueNames
}) })
function getStructAsymMap(data: BasicData): Model['properties']['structAsymMap'] {
const map = new Map<string, StructAsym>();
const { label_asym_id, auth_asym_id, label_entity_id } = data.atom_site
for (let i = 0, il = label_asym_id.rowCount; i < il; ++i) {
const id = label_asym_id.value(i)
if (!map.has(id)) {
map.set(id, {
id,
auth_id: auth_asym_id.value(i),
entity_id: label_entity_id.value(i)
})
}
}
if (data.struct_asym._rowCount > 0) {
const { id, entity_id } = data.struct_asym
for (let i = 0, il = id.rowCount; i < il; ++i) {
const _id = id.value(i)
if (!map.has(_id)) {
map.set(_id, {
id: _id,
auth_id: '',
entity_id: entity_id.value(i)
})
}
}
}
return map
}
export function getProperties(data: BasicData): Model['properties'] { export function getProperties(data: BasicData): Model['properties'] {
return { return {
missingResidues: getMissingResidues(data), missingResidues: getMissingResidues(data),
chemicalComponentMap: getChemicalComponentMap(data), chemicalComponentMap: getChemicalComponentMap(data),
saccharideComponentMap: getSaccharideComponentMap(data) saccharideComponentMap: getSaccharideComponentMap(data),
structAsymMap: getStructAsymMap(data)
} }
} }
\ No newline at end of file
...@@ -9,7 +9,7 @@ import UUID from '../../../mol-util/uuid'; ...@@ -9,7 +9,7 @@ import UUID from '../../../mol-util/uuid';
import StructureSequence from './properties/sequence'; import StructureSequence from './properties/sequence';
import { AtomicHierarchy, AtomicConformation, AtomicRanges } from './properties/atomic'; import { AtomicHierarchy, AtomicConformation, AtomicRanges } from './properties/atomic';
import { CoarseHierarchy, CoarseConformation } from './properties/coarse'; import { CoarseHierarchy, CoarseConformation } from './properties/coarse';
import { Entities, ChemicalComponentMap, MissingResidues } from './properties/common'; import { Entities, ChemicalComponentMap, MissingResidues, StructAsymMap } from './properties/common';
import { CustomProperties } from '../common/custom-property'; import { CustomProperties } from '../common/custom-property';
import { SaccharideComponentMap } from '../structure/carbohydrates/constants'; import { SaccharideComponentMap } from '../structure/carbohydrates/constants';
import { ModelFormat } from '../../../mol-model-formats/structure/format'; import { ModelFormat } from '../../../mol-model-formats/structure/format';
...@@ -59,6 +59,8 @@ export interface Model extends Readonly<{ ...@@ -59,6 +59,8 @@ export interface Model extends Readonly<{
readonly chemicalComponentMap: ChemicalComponentMap readonly chemicalComponentMap: ChemicalComponentMap
/** maps residue name to `SaccharideComponent` data */ /** maps residue name to `SaccharideComponent` data */
readonly saccharideComponentMap: SaccharideComponentMap readonly saccharideComponentMap: SaccharideComponentMap
/** maps label_asym_id name to `StructAsym` data */
readonly structAsymMap: StructAsymMap
}, },
customProperties: CustomProperties, customProperties: CustomProperties,
......
...@@ -30,3 +30,6 @@ export interface MissingResidues { ...@@ -30,3 +30,6 @@ export interface MissingResidues {
get(model_num: number, asym_id: string, seq_id: number): MissingResidue | undefined get(model_num: number, asym_id: string, seq_id: number): MissingResidue | undefined
readonly size: number readonly size: number
} }
export type StructAsym = Table.Row<Pick<mmCIF_Schema['struct_asym'], 'id' | 'entity_id'> & { auth_id: Column.Schema.Str }>
export type StructAsymMap = ReadonlyMap<string, StructAsym>
\ No newline at end of file
...@@ -15,7 +15,6 @@ import { PluginContext } from '../../context'; ...@@ -15,7 +15,6 @@ import { PluginContext } from '../../context';
import { Assembly, Symmetry } from '../../../mol-model/structure/model/properties/symmetry'; import { Assembly, Symmetry } from '../../../mol-model/structure/model/properties/symmetry';
import { PluginStateObject as SO } from '../objects'; import { PluginStateObject as SO } from '../objects';
import { ModelSymmetry } from '../../../mol-model-formats/structure/property/symmetry'; import { ModelSymmetry } from '../../../mol-model-formats/structure/property/symmetry';
import { MmcifFormat } from '../../../mol-model-formats/structure/mmcif';
export namespace ModelStructureRepresentation { export namespace ModelStructureRepresentation {
export function getParams(model?: Model, defaultValue?: 'deposited' | 'assembly' | 'symmetry' | 'symmetry-mates' | 'symmetry-assembly') { export function getParams(model?: Model, defaultValue?: 'deposited' | 'assembly' | 'symmetry' | 'symmetry-mates' | 'symmetry-assembly') {
...@@ -33,13 +32,11 @@ export namespace ModelStructureRepresentation { ...@@ -33,13 +32,11 @@ export namespace ModelStructureRepresentation {
} }
const asymIdsOptions: [string, string][] = [] const asymIdsOptions: [string, string][] = []
if (model && MmcifFormat.is(model?.sourceData)) { if (model) {
// TODO make generally available for models, also include auth_asym_id model.properties.structAsymMap.forEach(v => {
const { struct_asym } = model.sourceData.data.db const label = v.id === v.auth_id ? v.id : `${v.id} [auth ${v.auth_id}]`
for (let i = 0, il = struct_asym._rowCount; i < il; ++i) { asymIdsOptions.push([v.id, label])
const id = struct_asym.id.value(i) })
asymIdsOptions.push([id, id])
}
} }
const modes = { const modes = {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment