Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MVS: IHM support #1433

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

MVS: IHM support #1433

wants to merge 6 commits into from

Conversation

dsehnal
Copy link
Member

@dsehnal dsehnal commented Feb 2, 2025

Description

Adds better support for I/HM structure in MolViewSpec

  • Support coarse components
  • Support spacefill representation
  • Support element_granularity in component expressions
  • If no color theme is specified explicitly, use Mol*'s defaults instead
  • Add atom.ihm.has-seq-id symbol to the query language

https://pdb-ihm.org/cif/8zz1.cif with crosslink restraints:

image

Actions

  • Added description of changes to the [Unreleased] section of CHANGELOG.md
  • Updated headers of modified files

@dsehnal dsehnal requested review from sbittrich, midlik and arose February 2, 2025 14:39
Copy link
Collaborator

@midlik midlik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine but some things are not clear to me - see comments.
Also, have you tested if the new selections work in all possible contexts (I mean, as inline component, as *_from_uri, as target for primitive...)?

Comment on lines 329 to 330
// If no color child node is specified, use Mol*'s default
return undefined;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we are making sure MVS is pretty much Molstar-specific and no one will ever implement it for any other viewer.

Copy link
Member Author

@dsehnal dsehnal Feb 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disagree. You can still implement explicit colors. And this could be defined as expected behavior (= colors determined by viewer if not specified explicitly).

And we focus on iterating on color in "MVS 2.0".

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have an alternate solution to support "vendor extension" to do that. Thanks for the feedback.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought the original idea was that a MVS view should look roughly the same in all viewers.
With this, a representation node without specified color can look very different in different viewers.
So as a user, I might think I have created a beautiful view where each chain has a different color, but then I load it in PyMOL it will be all magenta because default per-chain coloring was just Molstar's implementation detail.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, I will implement the auto mol* coloring as a custom extension on the color node.

Comment on lines 284 to 290
if (isDefined(row.label_seq_id)) {
if (row.element_granularity === 'coarse') {
residueTests.push(ihm.hasSeqId({ 0: row.label_seq_id }));
} else {
residueTests.push(eq([macromolecular.label_seq_id(), row.label_seq_id]));
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean that if label_seq_id is not present, it will select from both atomic and coarse parts of the structure?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, we can completely remove element_granularity in this case and just use the ihm.hasSeqId.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, if we can remove element_granularity, let's do it. One thing less for the user to worry about.

@dsehnal
Copy link
Member Author

dsehnal commented Feb 5, 2025

Also, have you tested if the new selections work in all possible contexts (I mean, as inline component, as *_from_uri, as target for primitive...)?

My goal was to make this work with the primitives here. @midlik you wrote this code, so do I need to change anything else for things you mention to work or is this fine? Can also do this in a separate PR.

@midlik
Copy link
Collaborator

midlik commented Feb 5, 2025

Also, have you tested if the new selections work in all possible contexts (I mean, as inline component, as *_from_uri, as target for primitive...)?

My goal was to make this work with the primitives here. @midlik you wrote this code, so do I need to change anything else for things you mention to work or is this fine? Can also do this in a separate PR.

If we remove element_granularity, it should work in all context, i think.
If you want i can test it (just ping me once you remove element_granularity)

@dsehnal
Copy link
Member Author

dsehnal commented Feb 5, 2025

If we remove element_granularity, it should work in all context, i think.
If you want i can test it (just ping me once you remove element_granularity)

@midlik
Ready for re-review/testing. Thanks

@midlik
Copy link
Collaborator

midlik commented Feb 11, 2025

I'm getting errors when trying to use beg_label_seq_id and end_label_seq_id:

p.distance({ radius: 1, start: { label_asym_id: 'A', beg_label_seq_id: 607, end_label_seq_id: 609 }, end: { label_asym_id: 'A', label_seq_id: 58 } }); // atomic-atomic

even though the residues i'm targeting are atomic, not coarse.

I think this could be solved by implementing something like MolScript.structureQuery.atomProperty.ihm.hasOverlapWithSeqIdRange (pls give it a better name), which would take start and end argument (both can be omitted) instead of just one seqId.

@midlik
Copy link
Collaborator

midlik commented Feb 11, 2025

And getting the same kind of errors with any auth_* fields (auth_asym_id, auth_seq_id).

Not sure if these can be implemented for coarse models, but at least they should keep working for the atomic portion of the structure, while returning an empty selection from the coarse portion (+ print warning), IMHO.

@midlik
Copy link
Collaborator

midlik commented Feb 11, 2025

This completely breaks the repr, instead of just not coloring:

const repr = struct.component().representation({ type: 'spacefill' });
repr.color({ color: 'blue', selector: { auth_asym_id: 'C' } }); // breaks everything
repr.color({ color: 'blue', selector: { label_asym_id: 'A', label_seq_id: 81 } }); // works nicely
repr.color({ color: 'blue', selector: { label_asym_id: 'A', label_atom_id: 'XXXX' } }); // colors whole chain :(, should color nothing

@dsehnal
Copy link
Member Author

dsehnal commented Feb 11, 2025

I think this could be solved by implementing something like MolScript.structureQuery.atomProperty.ihm.hasOverlapWithSeqIdRange (pls give it a better name), which would take start and end argument (both can be omitted) instead of just one seqId.

@midlik added this

@dsehnal
Copy link
Member Author

dsehnal commented Feb 11, 2025

This completely breaks the repr, instead of just not coloring:

const repr = struct.component().representation({ type: 'spacefill' });
repr.color({ color: 'blue', selector: { auth_asym_id: 'C' } }); // breaks everything
repr.color({ color: 'blue', selector: { label_asym_id: 'A', label_seq_id: 81 } }); // works nicely
repr.color({ color: 'blue', selector: { label_asym_id: 'A', label_atom_id: 'XXXX' } }); // colors whole chain :(, should color nothing

And getting the same kind of errors with any auth_* fields (auth_asym_id, auth_seq_id).

Not sure if these can be implemented for coarse models, but at least they should keep working for the atomic portion of the structure, while returning an empty selection from the coarse portion (+ print warning), IMHO.

This is expected behavior currently and would break in "native" Mol* code, will possibly adjust in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants