Change numbering in Chain/Sequence

Hi!

When you create a chain in the program, you are able to add the molecule name, type, sequence, and the number that the sequence begins at. Once you have created the numbering, is there a way to go back and change this information?  For example, I create a protein to start at number 1 in the sequence. After a while, I need to fix the number so that the protein begins at number 20, not number 1. Just wondering if this edit is available in V3.

Thank you!


Domarin

Hi Domarin, We will add shortly a module to edit the chain. Meanwhile, do you need rename only one residue or `shift` the whole chain, with a new starting number?

To re-number the whole chain:
use chain.renumberResidues(offset, start, stop)
eg.
Assuming you have one chain in your project,
if your chain starts at 1 and finishes at 100 and you want restart from 20:
On the python console:
chain = project.chains[0]
chain.renumberResidues(20,1,100)

to rename only one residue:
r = project.getByPid(`MR:A.12.ALA`)
r.rename(`100`)

I hope it helps.

Luca

Hi Luca!

I just realized I never replied to this post. Yes, it did work! Thank you for the script.

Hi Luca!

I have another question about renaming residues. The macro works for renaming a chain. I also want to renumber my NMRchains. Is there a macro that will do this?

Thanks!

Domarin

Hi,

similar syntax, the command will be:

nmrChain.renumberNmrResidues(offSet, start, stop)

L

Hi Luca!

I am now trying to renumber the NMR chain in my project file using the command you gave `nmrChain.renumberNmrResidues(offSet, start, stop)`. I successfully was able to change the chain number using the first command you gave me. Using the nmr chain command, I get this error and am not able to figure out what is wrong. To give background, I have a protein that was originally numbered 1 to 290 and changed it to begin at 311 so my offset was 310. The following shows the command I used and the error I get:

chain = project.chains[0]
nmrChain.renumberNmrResidues(310,10,290)

---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-30-1c430eed590f> in <module>
1 chain = project.chains[0]
----> 2 nmrChain.renumberNmrResidues(310,10,290)

<decorator-gen-216> in renumberNmrResidues(self, offset, start, stop)

/Applications/CcpNmrLauncher.app/Contents/Resources/ccpnmr3.0.2/src/python/ccpn/util/decorators.py in theDecorator(*args, **kwds)
326 self = args[0]
327
--> 328 application = self.project.application
329 blocking = application._echoBlocking
330 if blocking == 0:

/Applications/CcpNmrLauncher.app/Contents/Resources/ccpnmr3.0.2/src/python/ccpn/core/Project.py in application(self)
182 @property
183 def application(self):
--> 184 return self._appBase
185
186 def _initialiseProject(self):

AttributeError: `Project` object has no attribute `_appBase`

Hi,

my first thought, are you renumbering an nmrChain or a chain? In line 1 is chain = project.chains[0] . but in line 2 you call nmrChain. That nmrchain could be an old pointer to a previous session, or something else. Try replacing line one with nmrChain = project.nmrChains[0]

Hi Luca,

Thanks a lot, I was able to change the chain numbering but not the NmrChain. Which produces an unpleasant thing, I cannot change my assignment: e.g. A1 → A100 gives the error:
Screen Shot 2022-08-24 at 15.28.59

try the macro Renumber unconnected nmrChain