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.

How to select multiple residues by auth_sequence_id

See original GitHub issue

Hi, until now I selected one residue with an expression I created and converted that to a structure selection (which then got focused), like in #120.

Now I have a different use case. I want to select multiple residues by their auth sequence id and focus them. It is clear for me how to select exactly one residue by its auth sequence id, the code I use is

const expr = MS.struct.generator.atomGroups({
      "residue-test": MS.core.rel.eq([
          MS.struct.atomProperty.macromolecular.auth_seq_id(),
          557, // or any other auth seq id
      ]),
})

const sel = Script.getStructureSelection(expr, root);

const loci = StructureSelection.toLociWithSourceUnits(sel);

What I need: An expression that can select multiple residues at once by their auth seq id (so [556, 558, …] for example). So is there an easy way to do this or to combine multiple single select expressions to one big expression?

Thanks in advance

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
dvmoritzschoeflcommented, Apr 26, 2021

Thank you, that worked as expected, for anyone looking at this issue, here is the code that created the expression for selecting residues by their auth sequence id (and chain)

export function createSequenceIdExpression(
  sequenceIds: number[],
  chain?: string
): Expression {
  const query: any = {
    "residue-test": MS.core.set.has([
      MS.set(...sequenceIds),
      MS.ammp("auth_seq_id"),
    ]),
    "group-by": MS.struct.atomProperty.macromolecular.residueKey(),
  };

  if (chain) {
    query["chain-test"] = MS.core.rel.eq([
      MS.struct.atomProperty.macromolecular.auth_asym_id(),
      chain,
    ]);
  }

  return MS.struct.generator.atomGroups(query);
}
0reactions
eje24commented, Jun 17, 2022

As a bit of clarification, what I’m trying to implement is the following. I’d like to take as input:

  1. an atom from a particular residue on the protein (for example, the oxygen OE2, from the residue with sequence ID 65)
  2. an atom from the ligand (for example, the nitrogen N2)

and apply the measure the distance between the two. This will take the form:

residueAtomLoci = getResidueAtomLoci(residueID = {id of residue eg 65}, atomName = {atom name eg OE2})
ligandAtomLoci = getLigandAtomLoci(atomName = {atom name eg N2})
Viewer.plugin.managers.structure.measurement.addDistance(residueAtomLoci, ligandAtomLoci);

What I’m trying to do is implement the functions getResidueAtomLoci and getLigandAtomLoci. Any help or suggestions would be much appreciated. In any case, thank you for your reply @kscgl! This gives me a good starting point to work from.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Selecting residues in PyMOL - YouTube
Your browser can't play this video. Learn more. Switch camera.
Read more >
[Chimera-users] how to select multiple residues ... - UCSF RBVI
[Chimera-users] how to select multiple residues in multiple chains ... Is there a way to select all of the same >> number residues...
Read more >
Property Selectors - PyMOLWiki
Select All Alternate Locations. To select all residues with alternate locations (alt, alt loc), simply do: select ...
Read more >
Advanced Selection Techniques - Maestro - Schrödinger
Selecting more in the Workspace. You can switch between picking atoms and picking residues without changing your pick level. Just double-click the atom...
Read more >
RE: Selecting multiple ranges - VMD-L Mailing List
I have been in the TkC to select multiple ranges to do a "fit". I want to > select multiple ranges separated by...
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