question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Atom selection questions

See original GitHub issue

Hi all, I have a question. We want to apply representations to specific water atoms. We currently select the atoms like this

atoms: (atomIds) => {
                return query.struct.generator.atomGroups({
                    'atom-test': query.core.set.has([
                        query.core.type.set(atomIds),
                        query.ammp('id')
                    ])
                });
            },

However this ends up slowing down our browser a lot (freezes the tab on my computer).

We compared it to this which ends up being much much faster even if we select the exact same atoms.

water: () => molstar.SelectionQueries.water.expression,

Is there any reason why index atom selections are so much slower than expressions? I would have assumed they would be faster since molstar would not have to search for what is water.

Also one more question. Is molstar 1-indexing atoms? I initially selected atoms with 0-based index but it always missed the last atom, then I switched to 1-based indexing, but then we found some sdf file where the 1-based index doesn’t work either.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
dsehnalcommented, Aug 11, 2021

The performance issue is fixed in 2.2.2.

Using sourceIndex() vs ammp('id'):

  • ammp('id') (which is shorthand for struct.atomProperty.macromolecular.id()) is the value of the _atom_site.id column in mmCIF (the 2nd column in the PDB file). This is usually 1-based index of the atom in the file)
  • struct.atomProperty.core.sourceIndex() is zero-based index of the ATOM/HETATM record as it appears in the input file.
0reactions
stefdoerrcommented, Aug 11, 2021

Indexing works like a charm! Will need to test now 2.2.2. Thanks a lot!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Atomic Structure Examples of Multiple Choice Questions 1.
Which of the following has a positive charge? (a) proton: (b) neutron: (c) anion: (d) electron: (e) atom. 2. Rutherford carried out experiments...
Read more >
Sample Test Problems
The atom decays to a lower state by emitting a photon. Find the possible photon energies that may be observed. Give your answers...
Read more >
Atom Selection — CHARMM v35b1 documentation
Selection based on atom properties​​ The token LONE selects all lone pairs (based on a mass selection). The token HYDRogen selects all hydrogens...
Read more >
1355 questions with answers in ATOMS | Science topic
Explore the latest questions and answers in Atoms, and find Atoms experts. ... Same situation happens with selection tool and "atom selection option...
Read more >
Atom selection language - MDAnalysis User Guide
AtomGroups can be created by selecting atoms using the MDAnalysis atom selection language: In [1]: import MDAnalysis as mda In [2]: from ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found