
Hi Pablo, The typical approach is to write a temporary file for the PDB and the map, for example, from Midas import write write(mol, map, “outfile.pdb”) map.write_file(“outfile.mrc”) The first two lines write out a pdb file. The map is given as an argument to tell it to write the PDB relative to the map coordinate system (probably what you want for fitting). The third line writes the map file in MRC format. Chimera does not write CCP4 format, but MRC and CCP4 are almost identical and can probably be used interchangably by your code. If you need the file suffix to be ccp4 you can instead use map.write_file(“outfile.ccp4”, format=“mrc”) In some cases you the opened molecule and map may already come from a PDB file and map file and you could use those paths. But molecules can also come from mmCIF or mol2 and maps can come from many different format files or be produced inside Chimera. So relying on the original files won’t work in general. But if you still want to pursue that all models (molecule and map Python objects have an openedAs attribute that has the file path and file type: mol.openedAs = (file_path, type, default_type, prefixable_type) When the files are fetched from a database this does not give the local cached copy of the file. For molecules the cached file path is simply not easy to get at, and for maps you can always get the local file path using map.data.path. Tom
On Feb 24, 2017, at 12:12 AM, Pablo Solar Rodríguez <pablo.solar@delogica.com> wrote:
Hello again dear mates!
I've been working those days in my extension and the GUI es almost finished. Now I want to fill this skeleton with the process logic. To understand between us, I have an external compiled program that is executed in shell this way:
./bin/myProgram ./dir1/pdbselected.pdb ./dir/mapselected.ccp4 arg3 arg3 arg4
And for sure, in my .py test, it has to be executed as:
import subprocess subprocess.call(["./Users/Solar/Desktop/parent/child1/child2/bin/myProgram", "/Users/Solar/Desktop/parent/child1/child2/dir1/pdbselected.pdb", "/Users/Solar/Desktop/parent/child1/child2/dir1/mapselected.ccp4", "arg3", "arg4", "arg5"])
The problem is to execute this in Chimera as an extension. The coding I made for the PDB and the Map it's similar to the FitMap tool (in Volume Data), where I use:
... # PDB from chimera import Molecule mlist = [m for m in fit_object_models() if isinstance(m, Molecule)] fstart = mlist[0] if mlist else None from chimera.widgets import ModelOptionMenu om = ModelOptionMenu(ff, labelpos = 'w', label_text = 'Fit ', initialitem = fstart, listFunc = fit_object_models, sortFunc = compare_fit_objects, command = self.object_chosen_cb) om.grid(row = 0, column = 0, sticky = 'w') self.object_menu = om
# Map fm = Volume_Menu(ff, ' in map ') fm.frame.grid(row = 0, column = 1, sticky = 'w') self.map_menu = fm --
The question is, how can I pass the PDB to the compiled program as it is expected? Or, another possible solution, the paths of the PDB and the Map loaded in Chimera? I didn't found any friendly doc (methods, info and so on) about this and and I'm a mess :/
Thank you in advance dear coworkers!
Pablo
_______________________________________________ Chimera-dev mailing list Chimera-dev@cgl.ucsf.edu http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-dev