|
@@ -193,34 +193,38 @@ async function createStructureRepresentation(plugin: PluginUIContext, pdbtmDescr
|
|
|
|
|
|
await buildStructureRepresentation(plugin, components);
|
|
|
|
|
|
- // // TODO: colors of not curated sites
|
|
|
- // const siteColors = [
|
|
|
- // [255,100,100], // Side1
|
|
|
- // [100,100,255], // Side2
|
|
|
- // [255,255,0], // TM alpha
|
|
|
- // [255,255,0], // TM beta
|
|
|
- // [255,127,0], // TM re-entrant loop
|
|
|
- // [0,255, 0], // Interfacial Helix
|
|
|
- // [196,196,196], // Unknow localization
|
|
|
- // [0,255, 0], // Membrane Inside
|
|
|
- // ];
|
|
|
- // const siteDefinitions = pdbtmDescriptor.sites.map(
|
|
|
- // (siteDefinition: any) => siteDefinition.label
|
|
|
- // );
|
|
|
- // pdbtmDescriptor.chains.forEach((chain: any) => {
|
|
|
-
|
|
|
- // for (let residueItem of chain.residues) {
|
|
|
- // const siteIndex = residueItem.site_data[0].site_id_ref - 1;
|
|
|
- // const residue: PDBTMRegion = {
|
|
|
- // "auth_ids": [ Number(residueItem.pdb_res_label) ],
|
|
|
- // "color": siteColors[siteIndex],
|
|
|
- // "site": siteDefinitions[siteIndex]
|
|
|
- // };
|
|
|
- // const regionUpdates = plugin.build();
|
|
|
- // createRegionRepresentation(plugin, chain.chain_label, residue, regionUpdates.to(structure));
|
|
|
- // regionUpdates.commit();
|
|
|
- // }
|
|
|
- // });
|
|
|
+ // TODO: colors of not curated sites
|
|
|
+ const siteColors = [
|
|
|
+ [255,100,100], // Side1
|
|
|
+ [100,100,255], // Side2
|
|
|
+ [255,255,0], // TM alpha
|
|
|
+ [255,255,0], // TM beta
|
|
|
+ [255,127,0], // TM re-entrant loop
|
|
|
+ [0,255, 0], // Interfacial Helix
|
|
|
+ [196,196,196], // Unknow localization
|
|
|
+ [0,255, 0], // Membrane Inside
|
|
|
+ ];
|
|
|
+ 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);
|
|
|
|
|
|
-
|
|
|
// based on https://github.com/molstar/molstar/issues/209
|
|
|
update
|
|
|
.apply(StateTransforms.Model.StructureSelectionFromExpression, { label: regionLabel, expression: query })
|
|
@@ -266,7 +269,14 @@ async function loadStructure(ctx: PluginUIContext, params: any, pdbtmDescriptor:
|
|
|
isBinary: false
|
|
|
}); // , { state: { isGhost: true } });
|
|
|
const trajectory = await builders.structure.parseTrajectory(data, 'mmcif');
|
|
|
+ await applyTransformations(pdbtmDescriptor, trajectory);
|
|
|
|
|
|
+ // create membrane representation
|
|
|
+ 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;
|
|
|
}
|
|
|
-
|
|
|
- // create membrane representation
|
|
|
- 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')]),
|