Skip to content
Snippets Groups Projects
Commit c94d330b authored by David Sehnal's avatar David Sehnal
Browse files

mmcif conformation parsing

parent 530a86dc
No related branches found
No related tags found
No related merge requests found
......@@ -13,6 +13,7 @@ import Interval from '../../../mol-base/collections/integer/interval'
import Segmentation from '../../../mol-base/collections/integer/segmentation'
import uuId from '../../../mol-base/utils/uuid'
import * as Hierarchy from '../properties/hierarchy'
import Conformation from '../properties/conformation'
import findHierarchyKeys from '../utils/hierarchy-keys'
function findModelBounds(data: mmCIF, startIndex: number) {
......@@ -62,6 +63,16 @@ function createHierarchyData(data: mmCIF, bounds: Interval, offsets: { residues:
return { atoms, residues, chains, entities: data.entity };
}
function getConformation(data: mmCIF, bounds: Interval): Conformation {
const start = Interval.start(bounds), end = Interval.end(bounds);
const { atom_site } = data;
return {
x: atom_site.Cartn_x.toArray({ array: Float32Array, start, end }),
y: atom_site.Cartn_y.toArray({ array: Float32Array, start, end }),
z: atom_site.Cartn_z.toArray({ array: Float32Array, start, end }),
}
}
function createModel(raw: RawData, data: mmCIF, bounds: Interval): Model {
const hierarchyOffsets = findHierarchyOffsets(data, bounds);
......@@ -77,7 +88,7 @@ function createModel(raw: RawData, data: mmCIF, bounds: Interval): Model {
sourceData: raw,
model_num: data.atom_site.pdbx_PDB_model_num.value(Interval.start(bounds)),
hierarchy: { ...hierarchyData, ...hierarchyKeys, ...hierarchySegments },
conformation: 0 as any,
conformation: getConformation(data, bounds),
version: { data: 0, conformation: 0 },
atomCount: Interval.size(bounds)
};
......
......@@ -4,4 +4,20 @@
* @author David Sehnal <david.sehnal@gmail.com>
*/
// TODO: stuff like "residue type/flags", isRingAtom, rings, bonds??, wrap these in a computation?
\ No newline at end of file
// TODO: stuff like "residue type/flags", isRingAtom, rings, bonds??, wrap these in a computation?
// secondary structure is also a computed property
// import { SecondaryStructureType } from '../constants'
// import Segmentation from '../../../mol-base/collections/integer/segmentation'
// interface SecondaryStructure {
// ofResidue: ArrayLike<SecondaryStructureType>,
// // atom segmentation??
// segments: Segmentation
// }
// interface Conformation {
// positions: Conformation,
// secondaryStructure: SecondaryStructure
// }
\ No newline at end of file
......@@ -4,24 +4,10 @@
* @author David Sehnal <david.sehnal@gmail.com>
*/
import { SecondaryStructureType } from '../constants'
import Segmentation from '../../../mol-base/collections/integer/segmentation'
interface Positions {
interface Conformation {
x: ArrayLike<number>,
y: ArrayLike<number>,
z: ArrayLike<number>
}
interface SecondaryStructure {
ofResidue: ArrayLike<SecondaryStructureType>,
// atom segmentation??
segments: Segmentation
}
interface Conformation {
positions: Positions,
secondaryStructure: SecondaryStructure
}
export default Conformation
\ No newline at end of file
......@@ -126,6 +126,9 @@ async function runCIF(input: string | Uint8Array) {
console.log(models[0].hierarchy.chains.auth_asym_id.value(0));
console.log(models[0].hierarchy.chains.auth_asym_id.value(1));
console.log(models[0].hierarchy.chains.label_asym_id.value(1));
console.log(models[0].conformation.x[0]);
console.log(models[0].conformation.y[0]);
console.log(models[0].conformation.z[0]);
// const schema = await _dic()
// if (schema) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment