[Chimera-users] could not save model using write command
Elaine Meng
meng at cgl.ucsf.edu
Mon Mar 18 09:47:44 PDT 2019
Hi Zafer,
An example command is
write format mol2 #0 ~/Desktop/myfile.mol2
Of course, that example will only work if your structure(s) are open as model #0. Depending on what you did, it could be some other number. You would check this by looking in the Model Panel (open from Favorites menu), but generally the first thing opened is #0, the next one #1, etc.
The “Usage” line in the manual page for the command shows that options (format mol2) should go before the model number (#0).
<http://www.rbvi.ucsf.edu/chimera/docs/UsersGuide/midas/write.html>
Like I said before, you should always try your commands in the GUI to get them right before you put them into a script.
Lots of commands use model number or other atom specification, and there is a whole separate manual page for that with many examples:
<http://www.rbvi.ucsf.edu/chimera/docs/UsersGuide/midas/atom_spec.html#basic>
I hope this helps,
Elaine
-----
Elaine C. Meng, Ph.D.
UCSF Chimera(X) team
Department of Pharmaceutical Chemistry
University of California, San Francisco
> On Mar 18, 2019, at 8:40 AM, Zafer AYDIN <zafer.aydin at agu.edu.tr> wrote:
>
> Dear Elaine,
>
> I am struggling a little bit with the links you sent me and the command formats of chimea. I wrote the following Python script called addh_addcharge.py to add hydrogens and charges to a drug molecule.
>
> import chimera
> from chimera import runCommand
> runCommand("addh")
> runCommand("addcharge")
> runCommand("write 1 format mol2 %s" % "drug.mol2")
>
> I ran this code from command-line as
>
> ${chimera_dir}chimera --nogui --script "addh_addcharge.py" $drug_mol2_filename
>
> Although I am able to add hydrogens and charges without any errors, I am getting the following error when I try to save the model using the last write command in my Python code:
>
> MidasError: no model ids match "1"
> File "/vol1/software/edock/2018.08.6/script/beforedocking/chimera/share/Midas/__init__.py", line 4253, in _getModelsFromId
> raise MidasError, "no model ids match \"%s\"" % s
>
> Looks like the command expects me to include a model number. I checked the link below but could not figure out which model number I should provide:
>
> http://www.rbvi.ucsf.edu/chimera/docs/UsersGuide/framecommand.html
>
> It would be quite useful if the link of each command includes an example.
>
> I also tried the commands in
>
> http://plato.cgl.ucsf.edu/trac/chimera/attachment/wiki/Scripts/save.py
>
> but received other errors. I will appreciate if you can you tell me how I can save the model using the write command.
>
> Thanks,
> Zafer
>
>
> From: "Elaine Meng (meng at cgl.ucsf.edu)" <meng at cgl.ucsf.edu>
> To: Zafer AYDIN <zafer.aydin at agu.edu.tr>
> Cc: chimera List <chimera-users at cgl.ucsf.edu>
> Date: Fri, 15 Mar 2019 09:30:20 -0700
> Subject: Re: [Chimera-users] could not find binaries for addh and addcharge programs
>
> Please see the last paragraph of my previous reply.
>
> First to figure out the commands you want, you would have to try them yourself in the GUI. Then, you would put the commands in a script. Then you would start Chimera with the nogui option and input your script. These topics are covered in the links I sent.
>
> Best,
> Elaine
>
> > On Mar 15, 2019, at 9:11 AM, Zafer AYDIN <zafer.aydin at agu.edu.tr> wrote:
> >
> > Dear Elaine,
> >
> > I want to be able to run these commands (findhbond and addcharge) from Linux command-line only. I don't know how I can do it through the chimera executable. Can you send me an example command-line that does that? I don't want to open structures in GUI.
> >
> > Thanks,
> > Zafer
> >
> >
> > From: "Elaine Meng (meng at cgl.ucsf.edu)" <meng at cgl.ucsf.edu>
> > To: Zafer AYDIN <zafer.aydin at agu.edu.tr>
> > Cc: chimera-users at cgl.ucsf.edu
> > Date: Fri, 15 Mar 2019 08:44:42 -0700
> > Subject: Re: [Chimera-users] could not find binaries for addh and addcharge programs
> >
> > Hi Zafer Aydin,
> > The commands are “findhbond” (or “hbonds”) and “addcharge” — they are in the Chimera executable, and they are not separate binaries.
> >
> > <http://www.rbvi.ucsf.edu/chimera/docs/UsersGuide/midas/hbonds.html>
> > <http://www.rbvi.ucsf.edu/chimera/docs/UsersGuide/midas/addcharge.html>
> >
> > For example, open your structure(s) and then use commands:
> >
> > findhbond reveal true
> > addcharge
> >
> > Of course, there are other command options, and you would need to read the manual pages linked above to decide whether you want to use any of them.
> >
> > If you want to use Chimera without any graphical interface (not even the Chimera window), you need to start it with the nogui option and input your structures and commands in a script. See
> > <http://www.rbvi.ucsf.edu/chimera/docs/UsersGuide/startup.html>
> > <http://www.rbvi.ucsf.edu/chimera/docs/UsersGuide/options.html>
> > <http://www.rbvi.ucsf.edu/chimera/docs/ProgrammersGuide/basicPrimer.html>
> >
> > I hope this helps,
> > Elaine
> > -----
> > Elaine C. Meng, Ph.D.
> > UCSF Chimera(X) team
> > Department of Pharmaceutical Chemistry
> > University of California, San Francisco
> >
> > > On Mar 15, 2019, at 7:31 AM, Zafer AYDIN <zafer.aydin at agu.edu.tr> wrote:
> > >
> > > Hi,
> > >
> > > I installed chimera software to my Ubuntu workstation. I want to add hydrogen bonds and charges to ligand molecules. I could not find the addh and addcharge executables under the chimera directory.
> > >
> > > I would readlly appreciate if you can provide me basic guidelines for how to add hydrogen bonds and charges to ligand molecules using chimera from command-line (not from GUI).
> > >
> > > Many thanks,
> > >
> > > Zafer Aydin
> > > AGÜ Computer Engineering Department
> > > Kayseri, Turkey
> >
> _______________________________________________
> Chimera-users mailing list: Chimera-users at cgl.ucsf.edu
> Manage subscription: http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users
More information about the Chimera-users
mailing list