|
@@ -133,8 +133,9 @@ export async function loadWithUNITMPMembraneRepresentation(plugin: PluginUIConte
|
|
|
requestAnimationFrame(() => plugin.canvas3d?.requestCameraReset());
|
|
|
}
|
|
|
|
|
|
+type PDBTMChainLabel = string;
|
|
|
type PDBTMChain = {
|
|
|
- chain_label: string,
|
|
|
+ chain_label: PDBTMChainLabel,
|
|
|
additional_chain_annotations: {
|
|
|
type: string,
|
|
|
num_tm: number
|
|
@@ -162,9 +163,25 @@ type PDBTMDescriptor = {
|
|
|
normal: PDBTMVec3,
|
|
|
transformation_matrix: PDBTMTransformationMatrix,
|
|
|
radius: number
|
|
|
+ },
|
|
|
+ biomatrix: {
|
|
|
+ chain_deletes: string[],
|
|
|
+ matrix_list: {
|
|
|
+ matrix_id: string,
|
|
|
+ apply_to_chain_list: {
|
|
|
+ chain_id: PDBTMChainLabel,
|
|
|
+ new_chain_id: PDBTMChainLabel
|
|
|
+ }[],
|
|
|
+ transformation_matrix: PDBTMTransformationMatrix
|
|
|
+ }[]
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
+type TrajectoryType = StateObjectSelector<
|
|
|
+ PluginStateObject.Molecule.Trajectory,
|
|
|
+ StateTransformer<StateObject<any, StateObject.Type<any>>,
|
|
|
+ StateObject<any, StateObject.Type<any>>, any>
|
|
|
+>;
|
|
|
|
|
|
function createMembraneOrientation(pdbtmDescriptor: PDBTMDescriptor): MembraneOrientation {
|
|
|
const normal = pdbtmDescriptor.additional_entry_annotations.membrane.normal;
|
|
@@ -219,7 +236,7 @@ async function createStructureRepresentation(plugin: PluginUIContext, pdbtmDescr
|
|
|
regionsBySite[siteIndex].auth_ids.push(Number(residueItem.pdb_res_label));
|
|
|
}
|
|
|
|
|
|
- console.log(`REGIONS-${chain.chain_label}`, regionsBySite);
|
|
|
+ //console.log(`REGIONS-${chain.chain_label}`, regionsBySite);
|
|
|
regionsBySite.map((region: PDBTMRegion) => {
|
|
|
const regionUpdates = plugin.build();
|
|
|
createRegionRepresentation(plugin, chain.chain_label, region, regionUpdates.to(structure));
|
|
@@ -271,6 +288,18 @@ async function loadStructure(ctx: PluginUIContext, params: any, pdbtmDescriptor:
|
|
|
isBinary: false
|
|
|
}); // , { state: { isGhost: true } });
|
|
|
const trajectory = await builders.structure.parseTrajectory(data, 'mmcif');
|
|
|
+
|
|
|
+ // TODO: DEBUG logs
|
|
|
+ console.log('ATOMIC CONFORMATION', trajectory.data!.representative.atomicConformation);
|
|
|
+ console.log('ATOMIC RANGES', trajectory.data!.representative.atomicRanges);
|
|
|
+ console.log('ATOMIC HIER', trajectory.data!.representative.atomicHierarchy);
|
|
|
+ console.log('ATOMIC ENTITIES', trajectory.data!.representative.entities);
|
|
|
+
|
|
|
+
|
|
|
+ // ctx.managers.structure.hierarchy.getStructuresWithSelection();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
await applyTransformations(pdbtmDescriptor, trajectory);
|
|
|
|
|
|
// create membrane representation
|
|
@@ -278,30 +307,36 @@ async function loadStructure(ctx: PluginUIContext, params: any, pdbtmDescriptor:
|
|
|
trajectory, 'default', { representationPreset: 'preset-membrane-orientation' as any });
|
|
|
}
|
|
|
|
|
|
-async function applyTransformations(pdbtmDescriptor: PDBTMDescriptor, trajectory: any) {
|
|
|
+async function applyTransformations(pdbtmDescriptor: PDBTMDescriptor, trajectory: TrajectoryType) {
|
|
|
+ console.log('BIOMX', pdbtmDescriptor.additional_entry_annotations.biomatrix);
|
|
|
if (trajectory.data != null) {
|
|
|
- let new_x = [];
|
|
|
- let new_y = [];
|
|
|
- let new_z = [];
|
|
|
- let atomicConformationX = trajectory.data.representative.atomicConformation.x;
|
|
|
- let atomicConformationY = trajectory.data.representative.atomicConformation.y;
|
|
|
- let atomicConformationZ = trajectory.data.representative.atomicConformation.z;
|
|
|
+ let atomicConformation = trajectory.data.representative.atomicConformation;
|
|
|
let tmatrix = pdbtmDescriptor.additional_entry_annotations.membrane.transformation_matrix;
|
|
|
+ let newConformation = {
|
|
|
+ atomId: [] as number[],
|
|
|
+ x: [] as number[],
|
|
|
+ y: [] as number[],
|
|
|
+ z: [] as number[],
|
|
|
+ B_iso_or_equiv: [] as number[],
|
|
|
+ occupancy: [] as number[]
|
|
|
+ };
|
|
|
|
|
|
- for (let i = 0; i < atomicConformationX.length; i++) {
|
|
|
+ for (let i = 0; i < atomicConformation.x.length; i++) {
|
|
|
let coords = {
|
|
|
- x: atomicConformationX[i],
|
|
|
- y: atomicConformationY[i],
|
|
|
- z: atomicConformationZ[i]
|
|
|
+ x: atomicConformation.x[i],
|
|
|
+ y: atomicConformation.y[i],
|
|
|
+ z: atomicConformation.z[i]
|
|
|
};
|
|
|
coords = applyTransformationMatrix(coords, tmatrix);
|
|
|
- new_x.push(coords.x);
|
|
|
- new_y.push(coords.y);
|
|
|
- new_z.push(coords.z);
|
|
|
+ newConformation.x.push(coords.x);
|
|
|
+ newConformation.y.push(coords.y);
|
|
|
+ newConformation.z.push(coords.z);
|
|
|
+
|
|
|
+ // copy old values
|
|
|
}
|
|
|
- trajectory.data.representative.atomicConformation.x = new_x;
|
|
|
- trajectory.data.representative.atomicConformation.y = new_y;
|
|
|
- trajectory.data.representative.atomicConformation.z = new_z;
|
|
|
+ atomicConformation.x = newConformation.x;
|
|
|
+ atomicConformation.y = newConformation.y;
|
|
|
+ atomicConformation.z = newConformation.z;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -318,7 +353,7 @@ function vectorMultiply(v1: PDBTMVec3, v2: PDBTMVec3): number {
|
|
|
}
|
|
|
|
|
|
function getAtomGroupExpression(chainId: string, auth_array: number[]): Expression {
|
|
|
- console.log('auth_array:', auth_array);
|
|
|
+ // TODO console.log('auth_array:', auth_array);
|
|
|
const query: Expression =
|
|
|
MS.struct.generator.atomGroups({
|
|
|
'residue-test': MS.core.set.has([MS.set( ...auth_array ), MS.ammp('auth_seq_id')]),
|