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

resolves conflict with master

parent c0ec05c3
Branches
Tags
No related merge requests found
......@@ -13,9 +13,7 @@ interface SecondaryStructure {
/** index into the elements array */
readonly key: ArrayLike<number>,
/** indexed by key */
readonly elements: ReadonlyArray<SecondaryStructure.Element>,
/** string representation of DSSP annotation */
readonly dsspString: String
readonly elements: ReadonlyArray<SecondaryStructure.Element>
}
namespace SecondaryStructure {
......
......@@ -119,11 +119,16 @@ export const SecondaryStructureComputationParams = {
export type SecondaryStructureComputationParams = typeof SecondaryStructureComputationParams
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,
params: Partial<PD.Values<SecondaryStructureComputationParams>> = {}): SecondaryStructure {
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 backboneIndices = calcBackboneAtomIndices(hierarchy, proteinResidues)
const hbonds = calcBackboneHbonds(hierarchy, conformation, proteinResidues, backboneIndices, lookup3d)
......@@ -184,22 +189,12 @@ export function computeSecondaryStructure(hierarchy: AtomicHierarchy,
const secondaryStructure: SecondaryStructure = {
type,
key: keys,
elements: elements,
dsspString: composeDSSPString(flags, getFlagName)
elements: elements
}
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 {
// TODO would be nice to add more detailed information
if (kind === 'helix') {
......
......@@ -12,7 +12,7 @@ import { ColorTheme } from 'mol-theme/color';
import { SizeTheme } from 'mol-theme/size';
import { CartoonRepresentationProvider } from 'mol-repr/structure/representation/cartoon';
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')!
parent.style.width = '100%'
......@@ -62,18 +62,15 @@ function getCartoonRepr() {
}
async function init() {
const cif = await downloadFromPdb('1acj')
const cif = await downloadFromPdb('3j3q')
const models = await getModels(cif)
console.time('computeModelDSSP')
const secondaryStructure = computeSecondaryStructure(models[0].atomicHierarchy,
models[0].atomicConformation)
console.timeEnd('computeModelDSSP');
(models[0].properties as any).secondaryStructure = secondaryStructure
const secondaryStructure = computeModelDSSP(models[0].atomicHierarchy, models[0].atomicConformation)
console.timeEnd('computeModelDSSP')
;(models[0].properties as any).secondaryStructure = secondaryStructure
const structure = await getStructure(models[0])
const cartoonRepr = getCartoonRepr()
console.log(secondaryStructure.dsspString)
cartoonRepr.setTheme({
color: reprCtx.colorThemeRegistry.create('secondary-structure', { structure }),
size: reprCtx.sizeThemeRegistry.create('uniform', { structure })
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment