Closed jrom99 closed 1 month ago
Hi! Very nice code.
In my limited tests, it works like a charm.
In fact, cmd.iterate
supports retrieve the object name via the model
variable. Because I didn't knew it either and also prefer the cmd.get_model
, I submitted https://github.com/schrodinger/pymol-open-source/pull/380.
We could also think about to support 3-letter hyphen separated residue codes in the regex to better support unusual amino acids.
And the checkParams
for firstOnly
is wrong since before.
@jrom99, if you still want to use cmd.iterate
's model
variable instead of pm.get_model
, please commit on this branch.
We could also think about to support 3-letter hyphen separated residue codes in the regex to better support unusual amino acids.
And the
checkParams
forfirstOnly
is wrong since before.
Hello, I accidentally messed firstOnly
, now it returns the first match for every chain in each object instead of the global first match.
We can now have both behaviors (global first versus chain first), but I'm not sure if the later would be useful.
For now I tried to restore the expected behavior in my fork branch.
Hi @jrom99, I didn't understood what you said...
There are three possible behaviors when findseq is used on a multi-chain protein with multiple matches:
>chain_A
xxxMxxxxMx
>chain_B
xxxxMxxM
obj/A/4+9 or obj/B/5+8
(all matches)obj/A/4
(global first match)obj/A/4 or obj/B/5
(per chain first match)firstOnly=0
should use the first behavior, while firstOnly=1
should use the second. Due to a bug, firstOnly=1
results in the third behavior.
I agree with you. Multiple objects wasn't though initially so the firstOnly=1
behavior should be to global match (per object).
In the proposed implementation, running
needle.finditer(AAs)
will just redo the (constant) search for each object, without actually checking if the single-letter sequence refers to that object.I changed the iteration method to use
cmd.get_model
, but I don't know how to get the returned atoms to expose their object names, so I usedcmd.get_object_list
and runcmd.get_model
for each object.I find
cmd.get_model
easier to use thancmd.iterate
, but if the latter exposes the atom model then it may be more useful.May fix bug https://github.com/Pymol-Scripts/Pymol-script-repo/issues/148