Skip to content

Commit

Permalink
adjust atom coordinates on structure clones before saving PDB
Browse files Browse the repository at this point in the history
  • Loading branch information
gamcil committed Sep 2, 2024
1 parent c02dfad commit 665482a
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions frontend/StructureViewerMSA.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import StructureViewerTooltip from './StructureViewerTooltip.vue';
import StructureViewerToolbar from './StructureViewerToolbar.vue';
import StructureViewerMixin from './StructureViewerMixin.vue';
import { mockPDB, makeSubPDB, makeMatrix4, interpolateMatrices, animateMatrix } from './Utilities.js';
import { download, PdbWriter, Matrix4, Quaternion, Vector3 } from 'ngl';
import { download, PdbWriter, Matrix4, Quaternion, Vector3, concatStructures } from 'ngl';
import { pulchra } from 'pulchra-wasm';
// Mock alignment object from two (MSA-derived) aligned strings
Expand Down Expand Up @@ -135,7 +135,17 @@ REMARK Warning: Non C-alpha atoms may have been re-generated by PULCHRA
REMARK if they are not present in the original PDB file.
`;
this.stage.eachComponent(comp => {
PDB = new PdbWriter(comp.structure, { renumberSerial: false }).getData();
let clone = concatStructures("clone", comp.structure)
let matrix = new Matrix4();
matrix.fromArray(comp.transform.elements);
clone.eachAtom(ap => {
let position = new Vector3(ap.x, ap.y, ap.z);
position.applyMatrix4(matrix);
ap.x = position.x;
ap.y = position.y;
ap.z = position.z;
});
PDB = new PdbWriter(clone, { renumberSerial: false }).getData();
PDB = PDB.split('\n').filter(line => line.startsWith("ATOM")).join('\n');
let index = parseInt(comp.structure.name.replace("key-", ""));
let name = this.entries[index].name;
Expand Down

0 comments on commit 665482a

Please sign in to comment.