|
@@ -193,34 +193,38 @@ async function createStructureRepresentation(plugin: PluginUIContext, pdbtmDescr
|
|
|
|
|
|
await buildStructureRepresentation(plugin, components);
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+ const siteColors = [
|
|
|
+ [255,100,100],
|
|
|
+ [100,100,255],
|
|
|
+ [255,255,0],
|
|
|
+ [255,255,0],
|
|
|
+ [255,127,0],
|
|
|
+ [0,255, 0],
|
|
|
+ [196,196,196],
|
|
|
+ [0,255, 0],
|
|
|
+ ];
|
|
|
+ const siteDefinitions = pdbtmDescriptor.sites.map(
|
|
|
+ (siteDefinition: any) => siteDefinition.label
|
|
|
+ );
|
|
|
+
|
|
|
+ pdbtmDescriptor.chains.forEach((chain: any) => {
|
|
|
+
|
|
|
+ let regionsBySite: PDBTMRegion[] = siteColors.map((color):PDBTMRegion => {
|
|
|
+ return { site: "valami", auth_ids: [], color: color };
|
|
|
+ });
|
|
|
+
|
|
|
+ for (let residueItem of chain.residues) {
|
|
|
+ const siteIndex = residueItem.site_data[0].site_id_ref - 1;
|
|
|
+ regionsBySite[siteIndex].auth_ids.push(Number(residueItem.pdb_res_label));
|
|
|
+ }
|
|
|
+
|
|
|
+ console.log(`REGIONS-${chain.chain_label}`, regionsBySite);
|
|
|
+ const regionUpdates = plugin.build();
|
|
|
+ createRegionRepresentation(plugin, chain.chain_label, regionsBySite[0], regionUpdates.to(structure));
|
|
|
+ regionUpdates.commit();
|
|
|
+
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
async function createStructureComponents(plugin: PluginUIContext, structure: StateObjectCell<PMS, StateTransform<StateTransformer<StateObject<any, StateObject.Type<any>>, StateObject<any, StateObject.Type<any>>, any>>>) {
|
|
@@ -236,7 +240,6 @@ function createRegionRepresentation(plugin: PluginUIContext, chain: string, resi
|
|
|
const color: Color = Color.fromArray(residue.color, 0);
|
|
|
const query: Expression = getAtomGroupExpression(chain, residue.auth_ids);
|
|
|
|
|
|
-
|
|
|
|
|
|
update
|
|
|
.apply(StateTransforms.Model.StructureSelectionFromExpression, { label: regionLabel, expression: query })
|
|
@@ -266,7 +269,14 @@ async function loadStructure(ctx: PluginUIContext, params: any, pdbtmDescriptor:
|
|
|
isBinary: false
|
|
|
});
|
|
|
const trajectory = await builders.structure.parseTrajectory(data, 'mmcif');
|
|
|
+ await applyTransformations(pdbtmDescriptor, trajectory);
|
|
|
|
|
|
+
|
|
|
+ await builders.structure.hierarchy.applyPreset(
|
|
|
+ trajectory, 'default', { representationPreset: 'preset-membrane-orientation' as any });
|
|
|
+}
|
|
|
+
|
|
|
+async function applyTransformations(pdbtmDescriptor: PDBTMDescriptor, trajectory: any) {
|
|
|
if (trajectory.data != null) {
|
|
|
let new_x = [];
|
|
|
let new_y = [];
|
|
@@ -291,10 +301,6 @@ async function loadStructure(ctx: PluginUIContext, params: any, pdbtmDescriptor:
|
|
|
trajectory.data.representative.atomicConformation.y = new_y;
|
|
|
trajectory.data.representative.atomicConformation.z = new_z;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- await builders.structure.hierarchy.applyPreset(
|
|
|
- trajectory, 'default', { representationPreset: 'preset-membrane-orientation' as any });
|
|
|
}
|
|
|
|
|
|
function applyTransformationMatrix(coords: PDBTMVec3, tmatrix: PDBTMTransformationMatrix): PDBTMVec3 {
|
|
@@ -310,6 +316,7 @@ function vectorMultiply(v1: PDBTMVec3, v2: PDBTMVec3): number {
|
|
|
}
|
|
|
|
|
|
function getAtomGroupExpression(chainId: string, auth_array: number[]): Expression {
|
|
|
+ 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')]),
|