Skip to content
Snippets Groups Projects
Commit cba4c76f authored by Sebastian Bittrich's avatar Sebastian Bittrich
Browse files

resolves conflict with master

parent c0ec05c3
No related branches found
No related tags found
No related merge requests found
...@@ -13,9 +13,7 @@ interface SecondaryStructure { ...@@ -13,9 +13,7 @@ interface SecondaryStructure {
/** index into the elements array */ /** index into the elements array */
readonly key: ArrayLike<number>, readonly key: ArrayLike<number>,
/** indexed by key */ /** indexed by key */
readonly elements: ReadonlyArray<SecondaryStructure.Element>, readonly elements: ReadonlyArray<SecondaryStructure.Element>
/** string representation of DSSP annotation */
readonly dsspString: String
} }
namespace SecondaryStructure { namespace SecondaryStructure {
......
...@@ -119,11 +119,16 @@ export const SecondaryStructureComputationParams = { ...@@ -119,11 +119,16 @@ export const SecondaryStructureComputationParams = {
export type SecondaryStructureComputationParams = typeof SecondaryStructureComputationParams export type SecondaryStructureComputationParams = typeof SecondaryStructureComputationParams
export function computeSecondaryStructure(hierarchy: AtomicHierarchy, export function computeSecondaryStructure(hierarchy: AtomicHierarchy,
conformation: AtomicConformation) {
// TODO use Zhang-Skolnik for CA alpha only parts or for coarse parts with per-residue elements
return computeModelDSSP(hierarchy, conformation)
}
export function computeModelDSSP(hierarchy: AtomicHierarchy,
conformation: AtomicConformation, conformation: AtomicConformation,
params: Partial<PD.Values<SecondaryStructureComputationParams>> = {}): SecondaryStructure { params: Partial<PD.Values<SecondaryStructureComputationParams>> = {}): SecondaryStructure {
params = { ...PD.getDefaultValues(SecondaryStructureComputationParams), ...params }; params = { ...PD.getDefaultValues(SecondaryStructureComputationParams), ...params };
// TODO use Zhang-Skolnik for CA alpha only parts or for coarse parts with per-residue elements
const { lookup3d, proteinResidues } = calcAtomicTraceLookup3D(hierarchy, conformation) const { lookup3d, proteinResidues } = calcAtomicTraceLookup3D(hierarchy, conformation)
const backboneIndices = calcBackboneAtomIndices(hierarchy, proteinResidues) const backboneIndices = calcBackboneAtomIndices(hierarchy, proteinResidues)
const hbonds = calcBackboneHbonds(hierarchy, conformation, proteinResidues, backboneIndices, lookup3d) const hbonds = calcBackboneHbonds(hierarchy, conformation, proteinResidues, backboneIndices, lookup3d)
...@@ -184,22 +189,12 @@ export function computeSecondaryStructure(hierarchy: AtomicHierarchy, ...@@ -184,22 +189,12 @@ export function computeSecondaryStructure(hierarchy: AtomicHierarchy,
const secondaryStructure: SecondaryStructure = { const secondaryStructure: SecondaryStructure = {
type, type,
key: keys, key: keys,
elements: elements, elements: elements
dsspString: composeDSSPString(flags, getFlagName)
} }
return secondaryStructure return secondaryStructure
} }
function composeDSSPString(flags: Uint32Array, getFlagName: (f: DSSPType) => String) {
let out = ''
for (let i = 0, il = flags.length; i < il; ++i) {
const f = DSSPType.create(flags[i])
out += getFlagName(f)
}
return out
}
function createElement(kind: string, flag: DSSPType.Flag, getResidueFlag: (f: DSSPType) => SecondaryStructureType): SecondaryStructure.Element { function createElement(kind: string, flag: DSSPType.Flag, getResidueFlag: (f: DSSPType) => SecondaryStructureType): SecondaryStructure.Element {
// TODO would be nice to add more detailed information // TODO would be nice to add more detailed information
if (kind === 'helix') { if (kind === 'helix') {
......
...@@ -12,7 +12,7 @@ import { ColorTheme } from 'mol-theme/color'; ...@@ -12,7 +12,7 @@ import { ColorTheme } from 'mol-theme/color';
import { SizeTheme } from 'mol-theme/size'; import { SizeTheme } from 'mol-theme/size';
import { CartoonRepresentationProvider } from 'mol-repr/structure/representation/cartoon'; import { CartoonRepresentationProvider } from 'mol-repr/structure/representation/cartoon';
import { trajectoryFromMmCIF } from 'mol-model-formats/structure/mmcif'; import { trajectoryFromMmCIF } from 'mol-model-formats/structure/mmcif';
import { computeSecondaryStructure } from 'mol-model/structure/model/properties/utils/secondary-structure'; import { computeModelDSSP } from 'mol-model/structure/model/properties/utils/secondary-structure';
const parent = document.getElementById('app')! const parent = document.getElementById('app')!
parent.style.width = '100%' parent.style.width = '100%'
...@@ -62,24 +62,21 @@ function getCartoonRepr() { ...@@ -62,24 +62,21 @@ function getCartoonRepr() {
} }
async function init() { async function init() {
const cif = await downloadFromPdb('1acj') const cif = await downloadFromPdb('3j3q')
const models = await getModels(cif) const models = await getModels(cif)
console.time('computeModelDSSP') console.time('computeModelDSSP')
const secondaryStructure = computeSecondaryStructure(models[0].atomicHierarchy, const secondaryStructure = computeModelDSSP(models[0].atomicHierarchy, models[0].atomicConformation)
models[0].atomicConformation) console.timeEnd('computeModelDSSP')
console.timeEnd('computeModelDSSP'); ;(models[0].properties as any).secondaryStructure = secondaryStructure
(models[0].properties as any).secondaryStructure = secondaryStructure
const structure = await getStructure(models[0]) const structure = await getStructure(models[0])
const cartoonRepr = getCartoonRepr() const cartoonRepr = getCartoonRepr()
console.log(secondaryStructure.dsspString)
cartoonRepr.setTheme({ cartoonRepr.setTheme({
color: reprCtx.colorThemeRegistry.create('secondary-structure', { structure }), color: reprCtx.colorThemeRegistry.create('secondary-structure', { structure }),
size: reprCtx.sizeThemeRegistry.create('uniform', { structure }) size: reprCtx.sizeThemeRegistry.create('uniform', { structure })
}) })
await cartoonRepr.createOrUpdate({ ...CartoonRepresentationProvider.defaultValues, quality: 'auto' }, structure).run() await cartoonRepr.createOrUpdate({ ...CartoonRepresentationProvider.defaultValues, quality: 'auto' }, structure).run()
canvas3d.add(cartoonRepr) canvas3d.add(cartoonRepr)
canvas3d.resetCamera() canvas3d.resetCamera()
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment