|
@@ -28,6 +28,8 @@ import { StateObjectSelector } from "../../mol-state/object";
|
|
|
import { applyTransformations, createMembraneOrientation, getAtomGroupExpression } from './transformation';
|
|
|
import { PDBTMDescriptor, PDBTMRegion, PMS } from './types';
|
|
|
import { registerTmDetSymmetry } from './symmetry';
|
|
|
+import { StripedResidues } from './coloring';
|
|
|
+import { CustomColorThemeProvider } from './custom-theme';
|
|
|
|
|
|
type StructureComponentType = StateObjectSelector<
|
|
|
PMS,
|
|
@@ -55,6 +57,12 @@ export const TMDETMembraneOrientation = PluginBehavior.create<{ autoAttach: bool
|
|
|
this.ctx.representation.structure.registry.add(MembraneOrientationRepresentationProvider);
|
|
|
this.ctx.query.structure.registry.add(isTransmembrane);
|
|
|
|
|
|
+ this.ctx.representation.structure.themes.colorThemeRegistry.add(StripedResidues.colorThemeProvider!);
|
|
|
+ this.ctx.representation.structure.themes.colorThemeRegistry.add(CustomColorThemeProvider);
|
|
|
+ this.ctx.managers.lociLabels.addProvider(StripedResidues.labelProvider!);
|
|
|
+ this.ctx.customModelProperties.register(StripedResidues.propertyProvider, true);
|
|
|
+
|
|
|
+
|
|
|
this.ctx.genericRepresentationControls.set(Tag.Representation, selection => {
|
|
|
const refs: GenericRepresentationRef[] = [];
|
|
|
selection.structures.forEach(structure => {
|
|
@@ -129,6 +137,18 @@ export async function loadWithUNITMPMembraneRepresentation(plugin: PluginUIConte
|
|
|
requestAnimationFrame(() => plugin.canvas3d?.requestCameraReset());
|
|
|
}
|
|
|
|
|
|
+export async function customColor(plugin: PluginUIContext) {
|
|
|
+
|
|
|
+ plugin.dataTransaction(async () => {
|
|
|
+ console.log("data transaction...");
|
|
|
+ for (const s of plugin.managers.structure.hierarchy.current.structures) {
|
|
|
+ console.log("structure.components:", s.components);
|
|
|
+ await plugin.managers.structure.component.updateRepresentationsTheme(s.components, { color: StripedResidues.propertyProvider.descriptor.name as any });
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
async function downloadRegionDescriptor(plugin: PluginUIContext, params: any): Promise<any> {
|
|
|
|
|
|
const downloadResult: string = await plugin.runTask(plugin.fetch({ url: params.regionDescriptorUrl })) as string;
|
|
@@ -163,7 +183,7 @@ async function createStructureRepresentation(plugin: PluginUIContext, pdbtmDescr
|
|
|
pdbtmDescriptor.chains.forEach((chain: any) => {
|
|
|
|
|
|
let regionsBySite: PDBTMRegion[] = siteColors.map((color):PDBTMRegion => {
|
|
|
-
|
|
|
+
|
|
|
return { site: "valami", auth_ids: [], color: color };
|
|
|
});
|
|
|
|
|
@@ -172,10 +192,14 @@ async function createStructureRepresentation(plugin: PluginUIContext, pdbtmDescr
|
|
|
regionsBySite[siteIndex].auth_ids.push(Number(residueItem.pdb_res_label));
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- regionsBySite.forEach((region: PDBTMRegion) => {
|
|
|
+ console.log(`REGIONS-${chain.chain_label}`, regionsBySite);
|
|
|
+ regionsBySite.forEach(async (region: PDBTMRegion) => {
|
|
|
+ if (region.auth_ids.length == 0) { return; }
|
|
|
+
|
|
|
+ console.log("auth_ids: ", region.auth_ids);
|
|
|
+ console.log("color: ", region.color);
|
|
|
const regionUpdates = plugin.build();
|
|
|
- createRegionRepresentation(plugin, chain.chain_label, region, regionUpdates.to(structure));
|
|
|
+ await createRegionRepresentation(plugin, chain.chain_label, region, regionUpdates.to(structure));
|
|
|
regionUpdates.commit();
|
|
|
});
|
|
|
|
|
@@ -190,11 +214,12 @@ async function createStructureComponents(plugin: PluginUIContext, structure: Sta
|
|
|
};
|
|
|
}
|
|
|
|
|
|
-function createRegionRepresentation(plugin: PluginUIContext, chain: string, residue: PDBTMRegion, update: StateBuilder.To<any, any>) {
|
|
|
+async function createRegionRepresentation(plugin: PluginUIContext, chain: string, residue: PDBTMRegion, update: StateBuilder.To<any, any>) {
|
|
|
const lastIdIndex: number = residue.auth_ids.length - 1;
|
|
|
const regionLabel: string = `${chain}: ${residue.auth_ids[0]}-${residue.auth_ids[lastIdIndex]} | ${residue.site}`;
|
|
|
const color: Color = Color.fromArray(residue.color, 0);
|
|
|
const query: Expression = getAtomGroupExpression(chain, residue.auth_ids);
|
|
|
+ console.log("regionLabel:", regionLabel);
|
|
|
|
|
|
|
|
|
update
|