<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Shawn,<div><br></div><div> The solvent excluded surfaces produced by the surface command or menu Actions / Surface / Show are instances of Python class MSMSModel defined in share/MolecularSurface/msurf.py. They are a subclass of SurfaceModel and the only type of Chimera surface which has a direct association between surface vertices and nearest atoms. That association is given by s.atomMap which maps vertex number (0 based) to Python atom object.</div><div><br></div><div> The MultiScale surfaces are a plain SurfaceModel. I'd suggest adapting your current code to use</div><div><br></div><div><br></div><div> for piece in m.surfacePieces:</div><div><div><span class="Apple-tab-span" style="white-space: pre; "> </span>if hasattr(m, 'surfacePieceAtomsAndBonds'):</div><div><span class="Apple-tab-span" style="white-space: pre; "> </span> atoms, bonds = m.surfacePieceAtomsAndBonds([piece], create = False)</div></div><div><span class="Apple-tab-span" style="white-space:pre"> </span> # Now export associated atom (closest among atoms) for each vertex.</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> …</div><div> # Now add triangles for surface piece even if it has no associated atoms</div><div><br></div><div><br></div><div> I didn't study your code closely but it seems you will handle molecules that belong to multiscale surfaces twice. Not sure if that will create duplicates in your vtk output.</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>Tom</div><div><br></div><div><br></div><div><div><div>On Aug 6, 2013, at 5:30 PM, Shawn Waldon wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">Hi Tom,<div><br></div><div>Thanks for the feedback. I wrote my code mainly to work with Multiscale models, but I was trying to use an interface that would also work on surfaces generated by the surf command. Apparently I failed to test that last one adequately since I was assuming that Multiscale models with a resolution of 0 produced not only the same surface but also the same type of datastructure.</div>
<div><br></div><div>What is the best way to get the molecule information (or tell if it exists) for the other kind of surface?</div><div><br></div><div>I'll start working on the things that you've pointed out.</div>
<div><br></div><div>Thanks for your help,</div><div><br></div><div>Shawn</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Aug 6, 2013 at 4:30 PM, Tom Goddard wrote:<br>
<blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; position: static; z-index: auto; "><div style="word-wrap:break-word">Hi Shawn,<div><br></div><div> If I export VTK with a surface open the export code throws an error. For instance use command "shape sphere" to make a surface, or make a surface of a PDB model with Actions / Surface / show, then try export vtk. Not sure your code that handles surface pieces is intended to work with, maybe Multiscale surfaces? The surfacePieceAtomsAndBonds() method is not present for most surfaces. Then your code only looks at the first atom (assumes the atom list is non-empty), and writes data associating all atoms of the molecule with the surface. That will be wrong for multiscale models with more than one chain because you will associate all atoms of all chains to the surface piece for each chain.</div>
<div><br></div><div> This stuff will need to be fixed so the code doesn't throw errors whenever a scene is exported with a surface.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div><span style="white-space:pre-wrap"> </span>Tom</div>
<div><br></div><div><br></div></font></span><div><br><div><div><div class="h5"><div>On Aug 6, 2013, at 12:19 PM, Shawn Waldon wrote:</div>
<br></div></div><blockquote type="cite"><div><div class="h5"><div dir="ltr">Hi Tom,<div><br></div><div>Here is a picture of what I get when I follow your directions and open the file with Paraview. Did you hit apply on the left after open created the data source? Paraview is a little funny about opening things, it allows you to set up parameters on the reader (not relevant for .vtk files) before actually reading the data. You have to click the apply button on the left before the data is actually read in. The other thing I changed was the Color by dropdown on the left to color by the position along the protein chain with a red-to-blue color map (essentially the equivalent of chimera's rainbow command, but with Paraview's default color map). This is impossible with VTK's PDB file reader which throws away all information about the atoms and just keeps the points and lines for the bonds connecting them.</div>
<div><br></div><div>Shawn </div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Jul 26, 2013 at 8:06 PM, Tom Goddard wrote:<br>
<blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; position: static; z-index: auto; "><div style="word-wrap:break-word">Hi Shawn,<div><br></div><div> I opened PDB 1idi, used your code to export it to VTK, and opened it in Paraview 4.0.1 on a Mac. Couldn't get it to show anything. I don't know Paraview and that is probably the issue. Could you tell me something I could do with this Chimera VTK export? I'd like to have an idea of what it is good for before putting it into Chimera.</div>
<div><br></div><div><span style="white-space:pre-wrap"> </span>Tom</div><div><br></div><div><br><div><div>On Jul 26, 2013, at 11:45 AM, Shawn Waldon wrote:</div><br><blockquote type="cite"><div><div dir="ltr">
Hi Tom,<div><br></div><div>Here is the export code (and the ChimeraExtension.py file). Let me know if there is anything that needs fixing.</div><div><br></div><div>Shawn</div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Fri, Jul 26, 2013 at 1:15 PM, Tom Goddard wrote:<br><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; position: static; z-index: auto; ">
<div style="word-wrap:break-word">Hi Shawn,<div><br></div><div> The SketchBio project looks cool. We are trying to make it easy to build hypothetical models of hiv, muscle sarcomeres, fibronectin and all manner of large molecular machinery in Chimera. It is a difficult user interface problem. Graham Johnson, Sam Hertig and I are trying to move this project along. We are happy to help your efforts on this problem.</div>
<div><br></div><div> Can you send us your Chimera VTK export code and I'll take a look. We don't have a list of coding conventions. I don't really care how you indent your lines, or capitalize your variable names. Mostly I want the user to know when an error occurs what the nature of the problem is (e.g. export can't handle surfaces) without having to ask us.</div>
<span><font color="#888888"><div><br></div><div><span style="white-space:pre-wrap"> </span>Tom</div></font></span><div><div><br></div><div><br></div><div><br><div><div>On Jul 25, 2013, at 1:32 PM, Shawn Waldon wrote:</div>
<br><blockquote type="cite"><div dir="ltr">Hi Tom,<div><br></div><div>I don't know exactly how high quality it is. I haven't found any bugs in my latest version, but that doesn't mean they aren't there. I am fairly new to python, so there may be some subtleties that I missed. Also, do you have coding conventions listed somewhere? I have looked, but I haven't found an official list or anything. I am willing to fix it up a bit before submitting it if you can point me to a list of things to fix up.</div>
<div><br></div><div>My use case is that I am writing a higher level modeling tool that uses VTK to do its graphics. I have been calling Chimera as a subprocess to get a surface to render (and now other data). See the project website for more details: <a href="http://www.sketchbio.org/" target="_blank">http://www.sketchbio.org</a></div>
<div><br></div><div>Shawn</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jul 16, 2013 at 10:49 PM, Tom Goddard wrote:<br>
<blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; position: static; z-index: auto; "><div dir="auto"><div>Hi Shawn,</div><div><br></div><div> That is interesting. We could put it in Chimera if the code is solid. The error reports will come to us so we need high quality code so we have time to do more than reply to bug reports.</div>
<div><br></div><div> What use of molecules in VTK motivated you to write this export code?</div><div><br></div><div> Tom</div><div><div><br></div><div><br>On Jul 16, 2013, at 11:30 AM, Shawn Waldon wrote:<br>
<br></div><blockquote type="cite"><div dir="ltr">Hello all,<div><br></div><div>As part of a project that I am working on, I recently wrote an extension for Chimera that exports the scene as a .vtk file which can be read into the <a href="http://www.vtk.org/" target="_blank">Visualization Toolkit</a> or <a href="http://www.paraview.org/" target="_blank">Paraview</a>. It exports atoms (points), bonds (lines) and surfaces along with other data associated with them such as the atom and residue names, residue number, position along its chain, b-factor, occupancy, etc. in a format that can be used in VTK-based applications with the default file readers. I think this could be a good thing to add to Chimera itself, so I was wondering if you would like to have the code for the extension to add to Chimera itself.</div>
<div><br></div><div><div>I look forward to hearing from you,</div><div>-- <br></div><div dir="ltr">Shawn Waldon<div>Graduate Research Assistant</div><div>Department of Computer Science</div><div>University of North Carolina at Chapel Hill</div>
<div><br></div></div>
</div></div>
</blockquote></div><blockquote type="cite"><span>_______________________________________________</span><br><span>Chimera-dev mailing list</span><br><span><a href="mailto:Chimera-dev@cgl.ucsf.edu" target="_blank">Chimera-dev@cgl.ucsf.edu</a></span><br>
<span><a href="http://www.rbvi.ucsf.edu/mailman/listinfo/chimera-dev" target="_blank">http://www.rbvi.ucsf.edu/mailman/listinfo/chimera-dev</a></span><br></blockquote></div></blockquote></div><br><br clear="all"><div>
<br></div>-- <br><div dir="ltr">Shawn Waldon<div>Graduate Research Assistant</div><div>Department of Computer Science</div><div>University of North Carolina at Chapel Hill</div><div><br></div>
</div>
</div>
</blockquote></div><br></div></div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Shawn Waldon<div>Graduate Research Assistant</div><div>Department of Computer Science</div><div>University of North Carolina at Chapel Hill</div>
<div><br></div></div>
</div>
</div><span><ExportVTK.zip></span></blockquote></div><br></div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Shawn Waldon<div>Graduate Research Assistant</div><div>Department of Computer Science</div>
<div>University of North Carolina at Chapel Hill</div><div><br></div></div>
</div>
</div></div><div class="im"><span><Screen Shot 2013-08-06 at 3.19.09 PM.png></span></div></blockquote></div><br></div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Shawn Waldon<div>
Graduate Research Assistant</div><div>Department of Computer Science</div><div>University of North Carolina at Chapel Hill</div><div><a href="mailto:swaldon@cs.unc.edu" target="_blank">swaldon@cs.unc.edu</a></div></div>
</div>
</blockquote></div><br></div></body></html>