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.
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)
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
to rename only one residue:
r = project.getByPid(`MR:A.12.ALA`)
I hope it helps.
I just realized I never replied to this post. Yes, it did work! Thank you for the script.
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?
similar syntax, the command will be:
nmrChain.renumberNmrResidues(offSet, start, stop)
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
AttributeError Traceback (most recent call last)
<ipython-input-30-1c430eed590f> in <module>
1 chain = project.chains
----> 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
--> 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)
183 def application(self):
--> 184 return self._appBase
186 def _initialiseProject(self):
AttributeError: `Project` object has no attribute `_appBase`
my first thought, are you renumbering an nmrChain or a chain? In line 1 is chain = project.chains . 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