In the process of investigating Ben Bobay's question about keyboard shortcuts for adding a methyl group, I may have found a bug, or at least unexpected behavior, in cmd.fab().
When first creating a peptide, it works fine:
fab AAAA, pep
However, if I call it again with a different (or the same) sequence,
fab DDDD, pep
The new residues are overlaid right on top of the initial ones, and interspersed in the sequence order (overlapping sticks, Screenshot1). This breaks cartoon representation, as Ala1 and Ala2 are no longer contiguous in the sequence (as cartoon leaves nothing drawn, Screenshot2).
Also, something happens when switching representations (e.g. from cartoon to sticks) that segfaults with certain sequences. I can semi-reproducibly produce a segfault (perhaps 2/3 of the time) with the following commands in Open Source PyMOL (1.7.4.0), PyMOLX11Hybrid (1.7.6.0), and MacPyMOL (1.7.6.0).
reinitialize
fab AAAA, pep
fab ADAA, pep
as cartoon
as sticks
# sometimes it takes an extra line or two
#fab AADA, pep
#as sticks
I believe this happens specifically when some residues are the same and some are different: I haven't been able to produce a segfault using "DDDD" as the second sequence, but adding the third sequence (second to last line) reintroduces the segfault.
I would expect calling fab with an existing object name to perform one of the following actions (from most to least preferable):
editor.attach_fragment().cmd.load(state=0).It may also be helpful to have additional arguments to fab, such as append=1 or state=0, depending on which of the above options might be implemented.
fixed in svn rev 4127.
Implemented the least spectacular option 3.: Delete existing object