Re: [Chimera-users] [chimera-dev] Dividing a model into seperate models - one for each chain

Hi Mateusz, The "split #0" command produces separate models for each chain. They are numbered #0.1, #0.2, #0.3, ... with the same primary id number (0) and different secondary id numbers. You can use these two-part id numbers in any Chimera command (e.g. color blue #0.2), or you can refer to all the models using #0. There is currently not a way to change the id numbers of models. Tom
Hello,
Is there a command / a way to split a model into seperate models (one for each chain)? I know there is the "split" command, but it divides the model into submodels.
Mateusz

Hi Tom, Thank you very much for your response. My exact problem is that I'm trying to find a way to automatically save all the models (and submodels) that are opened in Chimera at a time. It's easy when models are numbered #0, #1, #2 etc - then, I use: opened=openModels.list() howmany=len(opened) while howmany>=0: command="write "+str(howmany)+" "+o_path+"/"+str(howmany)+".pdb" runCommand(command) howmany-=1 Unfortunately, when I split, let's say, #0 that contains 3 chains, and then use the above code, I get an error: MidasError: 3 model ids match "0" So maybe there's a different way to do it? I'd like to save #0.1, #0.2 and #0.3 to seperate files. I know it's possible from Chimera's interface, but I have no idea how to do it when my script doesn't have any info about the number of submodels etc. Thank you for your time once again, Mateusz 2012/5/9 Tom Goddard <goddard@sonic.net>
Hi Mateusz,
The "split #0" command produces separate models for each chain. They are numbered #0.1, #0.2, #0.3, ... with the same primary id number (0) and different secondary id numbers. You can use these two-part id numbers in any Chimera command (e.g. color blue #0.2), or you can refer to all the models using #0. There is currently not a way to change the id numbers of models.
Tom
Hello,
Is there a command / a way to split a model into seperate models (one for each chain)? I know there is the "split" command, but it divides the model into submodels.
Mateusz

Hi Mateusz, Ok, your Python can be changed in a simple way, for example from chimera import openModels for m in openModels.list(): id = m.oslIdent() command="write "+id+" "+o_path+"/"+id[1:]+".pdb" runCommand(command) The m.oslIdent() gives the string "#0.1" or for models with no sub-id "#0". The id[1:] gives "0.1" so you don't get the "#" in the file name. The cryptic "oslIdent" stands for object selection language identifier. Tom Mateusz Dobrych?op wrote:
Hi Tom,
Thank you very much for your response.
My exact problem is that I'm trying to find a way to automatically save all the models (and submodels) that are opened in Chimera at a time. It's easy when models are numbered #0, #1, #2 etc - then, I use:
opened=openModels.list() howmany=len(opened) while howmany>=0: command="write "+str(howmany)+" "+o_path+"/"+str(howmany)+".pdb" runCommand(command) howmany-=1
Unfortunately, when I split, let's say, #0 that contains 3 chains, and then use the above code, I get an error:
MidasError: 3 model ids match "0"
So maybe there's a different way to do it? I'd like to save #0.1, #0.2 and #0.3 to seperate files. I know it's possible from Chimera's interface, but I have no idea how to do it when my script doesn't have any info about the number of submodels etc.
Thank you for your time once again, Mateusz
2012/5/9 Tom Goddard <goddard@sonic.net <mailto:goddard@sonic.net>>
Hi Mateusz,
The "split #0" command produces separate models for each chain. They are numbered #0.1, #0.2, #0.3, ... with the same primary id number (0) and different secondary id numbers. You can use these two-part id numbers in any Chimera command (e.g. color blue #0.2), or you can refer to all the models using #0. There is currently not a way to change the id numbers of models.
Tom
Hello,
Is there a command / a way to split a model into seperate models (one for each chain)? I know there is the "split" command, but it divides the model into submodels.
Mateusz
participants (2)
-
Mateusz Dobrychłop
-
Tom Goddard