
Hi, I apologize if this is a newbie question - I've searched for material but didn't seem to find any answers. I would like to write a plugin that allows chimera to parse up my own trajectory format. I would like it to be seekable rather than loading the whole shebang into memory at once. Is there an example trajectory parser out there or maybe someone could point me in the right direction? I saw charmm.py, which might be a good place to start, but I am not sure of which bits I need to replicate. Any pointers on a good place to begin looking would be very appreciated. thank you! -denny-

Hi Denny, Hardly a newbie question! Anyway, there actually is documentation for adding a format at the end of the MD Movie help page: http://www.cgl.ucsf.edu/chimera/current/docs/ContributedSoftware/movie/movie... You should read that and see how far it gets you. Feel free to send any questions here or directly to me -- that will help me determine where the documentation needs more detail. BTW, you were certainly on the right track in that you need to add a folder to Trajectories/formats that supports your format. Though unless your format is based on DCD files, Gromacs is probably a better example to look at than Charmm. Anyway, like I said, don't be shy with the questions! --Eric Eric Pettersen UCSF Computer Graphics Lab http://www.cgl.ucsf.edu On May 17, 2013, at 9:37 PM, Dennis N Bromley <dbromley@uw.edu> wrote:
Hi,
I apologize if this is a newbie question - I've searched for material but didn't seem to find any answers.
I would like to write a plugin that allows chimera to parse up my own trajectory format. I would like it to be seekable rather than loading the whole shebang into memory at once. Is there an example trajectory parser out there or maybe someone could point me in the right direction? I saw charmm.py, which might be a good place to start, but I am not sure of which bits I need to replicate. Any pointers on a good place to begin looking would be very appreciated.
thank you! -denny-
_______________________________________________ Chimera-dev mailing list Chimera-dev@cgl.ucsf.edu http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-dev

Forgot to mention that you do not need to read all frames at startup, though for performance reasons it is usually good to memory map your coordinate file, like this code snippet from the DCD-handling code: self.file = open(dcdfile,'rb') if hasattr(self.file, 'fileno'): print "using memory mapping" from mmap import mmap, ACCESS_READ self.file = mmap(self.file.fileno(), 0, access=ACCESS_READ) else: print "not using memory mapping" --Eric On May 20, 2013, at 10:18 PM, Eric Pettersen wrote:
Hi Denny, Hardly a newbie question! Anyway, there actually is documentation for adding a format at the end of the MD Movie help page:
http://www.cgl.ucsf.edu/chimera/current/docs/ContributedSoftware/movie/movie...
You should read that and see how far it gets you. Feel free to send any questions here or directly to me -- that will help me determine where the documentation needs more detail. BTW, you were certainly on the right track in that you need to add a folder to Trajectories/formats that supports your format. Though unless your format is based on DCD files, Gromacs is probably a better example to look at than Charmm. Anyway, like I said, don't be shy with the questions!
--Eric
Eric Pettersen UCSF Computer Graphics Lab http://www.cgl.ucsf.edu
On May 17, 2013, at 9:37 PM, Dennis N Bromley <dbromley@uw.edu> wrote:
Hi,
I apologize if this is a newbie question - I've searched for material but didn't seem to find any answers.
I would like to write a plugin that allows chimera to parse up my own trajectory format. I would like it to be seekable rather than loading the whole shebang into memory at once. Is there an example trajectory parser out there or maybe someone could point me in the right direction? I saw charmm.py, which might be a good place to start, but I am not sure of which bits I need to replicate. Any pointers on a good place to begin looking would be very appreciated.
thank you! -denny-
_______________________________________________ Chimera-dev mailing list Chimera-dev@cgl.ucsf.edu http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-dev
_______________________________________________ Chimera-dev mailing list Chimera-dev@cgl.ucsf.edu http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-dev

Hi Eric, Thank you very much for your help. My data is happily loading away. :) I have two more questions regarding loading: 1. My trajectory can contain multiple models (i.e. multiple proteins, not just protein + ligand). How do I specify that? 2. My data is actually coming from a streaming source where the other end of the stream could add molecules or change the structure. I know how to catch that message, but how would I tell Chimera that the structure had changed and I need to re-do all the models and residue counts and names and such (all the stuff from the GetDict() call)? thank you! -denny- On Mon, May 20, 2013 at 10:18 PM, Eric Pettersen <pett@cgl.ucsf.edu> wrote:
Hi Denny, Hardly a newbie question! Anyway, there actually is documentation for adding a format at the end of the MD Movie help page:
http://www.cgl.ucsf.edu/chimera/current/docs/ContributedSoftware/movie/movie...
You should read that and see how far it gets you. Feel free to send any questions here or directly to me -- that will help me determine where the documentation needs more detail. BTW, you were certainly on the right track in that you need to add a folder to Trajectories/formats that supports your format. Though unless your format is based on DCD files, Gromacs is probably a better example to look at than Charmm. Anyway, like I said, don't be shy with the questions!
--Eric
Eric Pettersen UCSF Computer Graphics Lab http://www.cgl.ucsf.edu
On May 17, 2013, at 9:37 PM, Dennis N Bromley <dbromley@uw.edu> wrote:
Hi,
I apologize if this is a newbie question - I've searched for material but didn't seem to find any answers.
I would like to write a plugin that allows chimera to parse up my own trajectory format. I would like it to be seekable rather than loading the whole shebang into memory at once. Is there an example trajectory parser out there or maybe someone could point me in the right direction? I saw charmm.py, which might be a good place to start, but I am not sure of which bits I need to replicate. Any pointers on a good place to begin looking would be very appreciated.
thank you! -denny-
_______________________________________________ Chimera-dev mailing list Chimera-dev@cgl.ucsf.edu http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-dev

On May 29, 2013, at 10:46 AM, Dennis N Bromley <dbromley@uw.edu> wrote:
Hi Eric,
Thank you very much for your help. My data is happily loading away. :)
Hi Denny, happy to hear it!
I have two more questions regarding loading: 1. My trajectory can contain multiple models (i.e. multiple proteins, not just protein + ligand). How do I specify that?
I'm not sure I understand the issue. In Chimera, a "model" can have multiple proteins. A model is just biological data that came from a single data source (e.g. a PDB file, an MRC file) and is always moved/rotated as a whole. Help me out here. :-)
2. My data is actually coming from a streaming source where the other end of the stream could add molecules or change the structure. I know how to catch that message, but how would I tell Chimera that the structure had changed and I need to re-do all the models and residue counts and names and such (all the stuff from the GetDict() call)?
Like VMD, Chimera employs the paradigm that trajectories don't change composition over time. Despite that, you can change the composition of your trajectory "by hand" by calling the correct atom/bond/residue creation/deletion calls yourself (i.e. the Molecule methods newAtom, newBond, newResidue, deleteAtom, deleteBond, deleteResidue). You would need to set the coordinates of any new atoms via their setCoord method. If you do nothing about it, the coordinates of these new atoms in previous frames will be at the origin. Let me know what additional help you need. --Eric Eric Pettersen UCSF Computer Graphics Lab http://www.cgl.ucsf.edu

Thank you Eric!. :) So, rather than model, I guess I should say "multiple proteins", or, as I am looking at ligands as well, "multiple molecules". Basically I want to show a few proteins (wild type + a few mutants) and some small molecules that I have docked using Vina. I don't know how to tell Chimera about more than one molecule. Right now I just specify lots of residues and atoms and bonds in the GetDict() function, but, so far as I can tell, I haven't specified that those structures belong to any particular molecule or protein. How do I indicate that *this* residue and atom belong to molecule #1 and *that* residue and atom belong to molecule #2? Also, I built a simple stand-alone trajectory plugin to nail down the basic plugin mechanics. The plugin simply creates a single water molecule and pushes it around on demand, so there are no file dependencies. I have attached the files in case somebody else finds them useful. All you need to do is stick them in the "<Chimera>\share\trajectory\formats\Waterdemo" directory. I'll update it with the results of this discussion to show how to load multiple molecules and such. thanks again! -denny- On Wed, May 29, 2013 at 11:34 AM, Eric Pettersen <pett@cgl.ucsf.edu> wrote:
On May 29, 2013, at 10:46 AM, Dennis N Bromley <dbromley@uw.edu> wrote:
Hi Eric,
Thank you very much for your help. My data is happily loading away. :)
Hi Denny, happy to hear it!
I have two more questions regarding loading: 1. My trajectory can contain multiple models (i.e. multiple proteins, not just protein + ligand). How do I specify that?
I'm not sure I understand the issue. In Chimera, a "model" can have multiple proteins. A model is just biological data that came from a single data source (*e.g.* a PDB file, an MRC file) and is always moved/rotated as a whole. Help me out here. :-)
2. My data is actually coming from a streaming source where the other end of the stream could add molecules or change the structure. I know how to catch that message, but how would I tell Chimera that the structure had changed and I need to re-do all the models and residue counts and names and such (all the stuff from the GetDict() call)?
Like VMD, Chimera employs the paradigm that trajectories don't change composition over time. Despite that, you can change the composition of your trajectory "by hand" by calling the correct atom/bond/residue creation/deletion calls yourself (*i.e.* the Molecule methods newAtom, newBond, newResidue, deleteAtom, deleteBond, deleteResidue). You would need to set the coordinates of any new atoms via their setCoord method. If you do nothing about it, the coordinates of these new atoms in previous frames will be at the origin.
Let me know what additional help you need.
--Eric
Eric Pettersen
UCSF Computer Graphics Lab

Hi Denny, I'm guessing the issue is that since the entire molecular system of your trajectory is treated as a single model, it is awkward to work on one particular protein in it. For instance, if you had two copies of the same protein you would want them numbered the same but would also like to be able to work on specific residues of a single copy, whereas a command such as "color red :121" always colors residue 121 in all the copies. All I can offer here is the ability to give each protein a distinct chain ID. To that end, I have added another optional key to the GetDict handling: "chains". It should return a list the same length as the number of residues, containing the desired chain IDs (solvent could be given "water", or same as nearby protein, or blank [a space]). It's not a great solution, but I hope it's good enough. The change will be in the next successful daily build (dated June 3 or later). --Eric On May 31, 2013, at 12:44 PM, Dennis N Bromley <dbromley@uw.edu> wrote:
Thank you Eric!. :)
So, rather than model, I guess I should say "multiple proteins", or, as I am looking at ligands as well, "multiple molecules". Basically I want to show a few proteins (wild type + a few mutants) and some small molecules that I have docked using Vina.
I don't know how to tell Chimera about more than one molecule. Right now I just specify lots of residues and atoms and bonds in the GetDict() function, but, so far as I can tell, I haven't specified that those structures belong to any particular molecule or protein. How do I indicate that *this* residue and atom belong to molecule #1 and *that* residue and atom belong to molecule #2?
Also, I built a simple stand-alone trajectory plugin to nail down the basic plugin mechanics. The plugin simply creates a single water molecule and pushes it around on demand, so there are no file dependencies. I have attached the files in case somebody else finds them useful. All you need to do is stick them in the "<Chimera>\share\trajectory\formats\Waterdemo" directory. I'll update it with the results of this discussion to show how to load multiple molecules and such.
thanks again! -denny-
On Wed, May 29, 2013 at 11:34 AM, Eric Pettersen <pett@cgl.ucsf.edu> wrote: On May 29, 2013, at 10:46 AM, Dennis N Bromley <dbromley@uw.edu> wrote:
Hi Eric,
Thank you very much for your help. My data is happily loading away. :)
Hi Denny, happy to hear it!
I have two more questions regarding loading: 1. My trajectory can contain multiple models (i.e. multiple proteins, not just protein + ligand). How do I specify that?
I'm not sure I understand the issue. In Chimera, a "model" can have multiple proteins. A model is just biological data that came from a single data source (e.g. a PDB file, an MRC file) and is always moved/rotated as a whole. Help me out here. :-)
2. My data is actually coming from a streaming source where the other end of the stream could add molecules or change the structure. I know how to catch that message, but how would I tell Chimera that the structure had changed and I need to re-do all the models and residue counts and names and such (all the stuff from the GetDict() call)?
Like VMD, Chimera employs the paradigm that trajectories don't change composition over time. Despite that, you can change the composition of your trajectory "by hand" by calling the correct atom/bond/residue creation/deletion calls yourself (i.e. the Molecule methods newAtom, newBond, newResidue, deleteAtom, deleteBond, deleteResidue). You would need to set the coordinates of any new atoms via their setCoord method. If you do nothing about it, the coordinates of these new atoms in previous frames will be at the origin.
Let me know what additional help you need.
--Eric
Eric Pettersen UCSF Computer Graphics Lab http://www.cgl.ucsf.edu
<__init__.py><Waterdemo.py>_______________________________________________ Chimera-dev mailing list Chimera-dev@cgl.ucsf.edu http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-dev

Hey, thanks Eric! I will take a look and see if I can make it work. -denny- On Mon, Jun 3, 2013 at 12:02 PM, Eric Pettersen <pett@cgl.ucsf.edu> wrote:
Hi Denny, I'm guessing the issue is that since the entire molecular system of your trajectory is treated as a single model, it is awkward to work on one particular protein in it. For instance, if you had two copies of the same protein you would want them numbered the same but would also like to be able to work on specific residues of a single copy, whereas a command such as "color red :121" always colors residue 121 in all the copies. All I can offer here is the ability to give each protein a distinct chain ID. To that end, I have added another optional key to the GetDict handling: "chains". It should return a list the same length as the number of residues, containing the desired chain IDs (solvent could be given "water", or same as nearby protein, or blank [a space]). It's not a great solution, but I hope it's good enough. The change will be in the next successful daily build (dated June 3 or later).
--Eric
On May 31, 2013, at 12:44 PM, Dennis N Bromley <dbromley@uw.edu> wrote:
Thank you Eric!. :)
So, rather than model, I guess I should say "multiple proteins", or, as I am looking at ligands as well, "multiple molecules". Basically I want to show a few proteins (wild type + a few mutants) and some small molecules that I have docked using Vina.
I don't know how to tell Chimera about more than one molecule. Right now I just specify lots of residues and atoms and bonds in the GetDict() function, but, so far as I can tell, I haven't specified that those structures belong to any particular molecule or protein. How do I indicate that *this* residue and atom belong to molecule #1 and *that* residue and atom belong to molecule #2?
Also, I built a simple stand-alone trajectory plugin to nail down the basic plugin mechanics. The plugin simply creates a single water molecule and pushes it around on demand, so there are no file dependencies. I have attached the files in case somebody else finds them useful. All you need to do is stick them in the "<Chimera>\share\trajectory\formats\Waterdemo" directory. I'll update it with the results of this discussion to show how to load multiple molecules and such.
thanks again! -denny-
On Wed, May 29, 2013 at 11:34 AM, Eric Pettersen <pett@cgl.ucsf.edu>wrote:
On May 29, 2013, at 10:46 AM, Dennis N Bromley <dbromley@uw.edu> wrote:
Hi Eric,
Thank you very much for your help. My data is happily loading away. :)
Hi Denny, happy to hear it!
I have two more questions regarding loading: 1. My trajectory can contain multiple models (i.e. multiple proteins, not just protein + ligand). How do I specify that?
I'm not sure I understand the issue. In Chimera, a "model" can have multiple proteins. A model is just biological data that came from a single data source (*e.g.* a PDB file, an MRC file) and is always moved/rotated as a whole. Help me out here. :-)
2. My data is actually coming from a streaming source where the other end of the stream could add molecules or change the structure. I know how to catch that message, but how would I tell Chimera that the structure had changed and I need to re-do all the models and residue counts and names and such (all the stuff from the GetDict() call)?
Like VMD, Chimera employs the paradigm that trajectories don't change composition over time. Despite that, you can change the composition of your trajectory "by hand" by calling the correct atom/bond/residue creation/deletion calls yourself (*i.e.* the Molecule methods newAtom, newBond, newResidue, deleteAtom, deleteBond, deleteResidue). You would need to set the coordinates of any new atoms via their setCoord method. If you do nothing about it, the coordinates of these new atoms in previous frames will be at the origin.
Let me know what additional help you need.
--Eric
Eric Pettersen UCSF Computer Graphics Lab http://www.cgl.ucsf.edu
<__init__.py><Waterdemo.py>_______________________________________________
Chimera-dev mailing list Chimera-dev@cgl.ucsf.edu http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-dev
participants (2)
-
Dennis N Bromley
-
Eric Pettersen