Closed JavierSanchez-Utges closed 1 month ago
These are marked as hetatoms in the pdb file:
HETATM 1502 N TPO A 197 40.591 5.296 18.772 1.00 41.91 N
The 3Dmol behavior is correct. You could create your own list of standard/nonstandard residue names and select using that (or do an or
selection between hetflag: false
and nonstandard residues names).
Hmm, yeah, I thought that was gonna be the case. Yes, I will create a list of all resn
of modified amino acids and combine with hetflag: false
with the or
as you suggested. Thanks!
Right, I see. But then, since these modified amino acids are hetatm
, they can't have a cartoon representation, can they?
If they have the normal atom names for the backbone atoms it should work. Does it not?
True, I had my selection wrong. I have now created my own selections to use instead of hetflag
:
const canAas = ['CYS', 'MET', 'HIS', 'GLU', 'ASP', 'LYS', 'ARG', 'SER', 'THR', 'ASN', 'GLN', 'TRP', 'TYR', 'PHE', 'ILE', 'LEU', 'VAL', 'ALA', 'PRO', 'GLY'];
const modAas = ['TPO', 'SEP', 'PTR', 'PYL', 'MLY', 'MSE', 'CSO', 'CME', 'CSD', 'CSW', 'CSX', 'CSS', 'CSH', 'CSL', 'CSZ', 'CSK', 'CSM', 'CSR', 'CSS', 'CSU'];
const allAas = canAas.concat(modAas);
const aasSel = allAas.map(function(residue) {
return { resn: residue };
})
const protAtoms = {or: aasSel}; // all protein atoms, including 20 canonical AAs and 20 modified AAs
const hetAtoms = {not: protAtoms}; // all non-protein atoms
const hetAtomsNotHoh = {and: [hetAtoms, {not: {resn: 'HOH'}}]}; // all non-protein atoms except water
const hohAtoms = {resn: 'HOH'}; // all water atoms
However, now I am having issues with complex selections combining and
, not
, and or
operators. This links to issue #804. For example: {and:[{model: protAtomsModel}, {resi: PDBResNums}, {chain: repPdbChainId}, protAtoms]},
applies to all the models that are open.
protAtomsModel
is the model ID of the model representing 1svh_A.PDBResNums
is an array of residue numbers, e.g., [10, 139, 196, 197, 254, 338]
.repPdbChainId = 'A'
protAtoms
is a selection built like so: {or: Array(40)}
. This array contains 40 selections like so: {resn: 'RES'}
for the 20 canonical aas and 20 modified ones.According to my understanding, this selection should include: the atoms of all residues within those 40 AAs in chain 'A'
of model modelID
for 1svh_A
that are in {resi: PDBResNums}
. However, this selection seems to include atoms of all models.
Is my selection or understanding of them wrong? Perhaps I am not understanding properly the combination of the different operators.
Attaching example models here: models_example.zip
Thanks so much!
I think there might be an issue with the implementation of the and
operator when one of the selectionSpec
is {model:
}. See how there is no difference between yellow and cyan, i.e., atoms from other models that are not protAtomsModel
are not being removed.
More examples here:
All the sidechains on the bottom right of the viewer correspond to SEP
residues of multiple different models, except protAtomsModel
, so when passing the {model: protAtomsModel}
they should not appear, right?
Hope this helps!
Another example here. Should these two ways not result in the same selection?
viewer.setStyle({and:[{model: protAtomsModel}, {resn: "TPO"}]}, {cartoon: {hidden: false, color: "red"}, stick:{color:"red", hidden: false}, sphere:{color:"red", hidden: false, radius: 0.25}});
viewer.setStyle({model: protAtomsModel, resn: "TPO"}, {cartoon: {hidden: false, color: "green"}, stick:{color:"green", hidden: false}, sphere:{color:"green", hidden: false, radius: 0.25}});
Thanks!
I have found a temporary solution that avoids using and
operators altogether. It might not work for very complex solutions, but is doing the trick at the moment. I am doing so by extending my current existing selection objects.
Instead of {and:[{model: protAtomsModel}, {resi: PDBResNums}, {chain: repPdbChainId}, protAtoms]}
,
using:
{...protAtoms, model: protAtomsModel, not: {resi: PDBResNums}, chain: repPdbChainId}
resn: ["ARG","LYS"]
should work - you don't need and/or to specify multiple residue names or ids. Issue #804 is definitely a problem (selections are applied to models individually so the logical operators don't work properly with model specifiers). I will get around to fixing it, but I think you can do everything you want as long as you keep the model specifier at the top level.
Ah, I See. I will try the resn: array
. OK, that is good to know, I thought I was going mad with the selections. By top level, do you mean on the main AtomSelectionSpec
, without and
and or
? There is an and
operator working within this top level of the AtomSelectionSpec
, right?
Do you think using the JavaScript spread syntax using ...
is alright? It seems to work.
Yes, the model needs to be in the main AtomSelectionSpec. There can be and and
there too, but no model specifier within the and/or (I will fix this eventually).
Alright, sounds good. Closing this issue then. Thanks!
Hi, I have been dealing with some structures, for example PDB: 1SVH, which have phosphorylated residues. I use
hetflag: false
to select all my protein atoms. This usually works perfectly, but for examples like these ones, that present 1 TPO (phosphothreonine) and 1 SEP (phosphoserine), these two residues are not in the selection and therefore the cartoon will be incomplete.ChimreaX, for example, recognises these residues and other modified amino acid as standard amino acids, and not other ligands. I was wondering if there is a way around this. I think in general, you would want these modified residues to behave as any other standard amino acid and be selected with the
hetflag: false
as they are part of the petide chain.Many thanks for your help!