|
From: Michael L. <mgl...@gm...> - 2012-06-10 20:11:16
|
Hi all, If I have a surface representation, is there currently a way to write it out as points (perhaps with a desired spacing) to a file? I know that the answer used to be no, but I thought I'd check just in case there was a new function that I didn't know about. Cheers, -Michael -- Michael Lerner Department of Physics and Astronomy Earlham College - Drawer 111 801 National Road West Richmond, IN 47374-4095 |
|
From: Tsjerk W. <ts...@gm...> - 2012-06-11 16:46:31
|
Hi Michael, The answer used to be "you can write out the surface as mesh in vrml or povray format, from which you can extract the vertices". I think it's still the proper answer. Cheers, Tsjerk On Jun 11, 2012 5:26 PM, "Michael Lerner" <mgl...@gm...> wrote: Hi all, If I have a surface representation, is there currently a way to write it out as points (perhaps with a desired spacing) to a file? I know that the answer used to be no, but I thought I'd check just in case there was a new function that I didn't know about. Cheers, -Michael -- Michael Lerner Department of Physics and Astronomy Earlham College - Drawer 111 801 National Road West Richmond, IN 47374-4095 ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ PyMOL-users mailing list (PyM...@li...) Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users Archives: http://www.mail-archive.com/pym...@li... |
|
From: Hurt, D. (NIH/N. [E] <dar...@ni...> - 2012-06-11 16:52:03
|
And the spacing can be controlled a least a little by using the surface quality setting. Darrell Hurt, Ph.D. Section Head, Computational Biology Bioinformatics and Computational Biosciences Branch (BCBB) OCICB/OSMO/OD/NIAID/NIH 31 Center Drive, Room 3B62B, MSC 2135 Bethesda, MD 20892-2135 Office 301-402-0095 Mobile 301-758-3559 http://bioinformatics.niaid.nih.gov (Within NIH) http://exon.niaid.nih.gov (Public) Disclaimer: The information in this e-mail and any of its attachments is confidential and may contain sensitive information. It should not be used by anyone who is not the original intended recipient. If you have received this e-mail in error please inform the sender and delete it from your mailbox or any other storage devices. National Institute of Allergy and Infectious Diseases shall not accept liability for any statements made that are sender's own and not expressly made on behalf of the NIAID by one of its representatives. From: Tsjerk Wassenaar [mailto:ts...@gm...] Sent: Monday, June 11, 2012 12:46 PM To: Michael Lerner <mgl...@gm...> Cc: pymol mailinglist <pym...@li...> Subject: Re: [PyMOL] writing out the surface Hi Michael, The answer used to be "you can write out the surface as mesh in vrml or povray format, from which you can extract the vertices". I think it's still the proper answer. Cheers, Tsjerk On Jun 11, 2012 5:26 PM, "Michael Lerner" <mgl...@gm...<mailto:mgl...@gm...>> wrote: Hi all, If I have a surface representation, is there currently a way to write it out as points (perhaps with a desired spacing) to a file? I know that the answer used to be no, but I thought I'd check just in case there was a new function that I didn't know about. Cheers, -Michael -- Michael Lerner Department of Physics and Astronomy Earlham College - Drawer 111 801 National Road West Richmond, IN 47374-4095 ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ PyMOL-users mailing list (PyM...@li...<mailto:PyM...@li...>) Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users Archives: http://www.mail-archive.com/pym...@li... |
|
From: Takanori N. <t.n...@ma...> - 2012-06-12 00:57:24
|
Hi, Another way: There is an undocumented API called 'dump', which can dump coordinates of isomesh/isosurface to a file. For mesh, it dumps a list of vertex coordinates, which can be rendered as GL_LINE_STRIP. For surface, it dumps a list of pairs of a vertex coordinate and its vertex normal vector, which can be rendered as GL_TRIANGLES. Please examine my old post for a script example. http://www.mail-archive.com/pym...@li.../msg10012.html Best regards, Takanori Nakane |
|
From: Michael L. <mgl...@gm...> - 2012-06-12 02:48:26
|
Hi all, Tsjerk- Thanks. I'm not sure how I missed that, given that it's even mentioned on the wiki on the surface page under the clear heading "Exporting Surface/Mesh Coordinates to File" :-|. ( http://www.pymolwiki.org/index.php/Surface#Exporting_Surface.2FMesh_Coordinates_to_File). I don't know anything about VRML, but I found some documentation online at http://www.c3.hu/cryptogram/vrmltut/part5.html and it looks really straightforward. The surface will show up in the VRML file as an IndexedFaceSet, and the points are just XYZ triples, and I can safely ignore everything else. Darrell- Thanks. I'll build that in as an option. Takanori- Thanks. That's really cool. I happen to want solvent accessible surfaces rather than isosurfaces, but "dump" is definitely going into my bag of tricks. Cheers, -Michael On Mon, Jun 11, 2012 at 8:57 PM, Takanori Nakane < t.n...@ma...> wrote: > Hi, > > Another way: > There is an undocumented API called 'dump', which can > dump coordinates of isomesh/isosurface to a file. > > For mesh, it dumps a list of vertex coordinates, which > can be rendered as GL_LINE_STRIP. > For surface, it dumps a list of pairs of a vertex coordinate > and its vertex normal vector, which can be rendered as GL_TRIANGLES. > > Please examine my old post for a script example. > http://www.mail-archive.com/pym...@li.../msg10012.html > > Best regards, > > Takanori Nakane > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > PyMOL-users mailing list (PyM...@li...) > Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users > Archives: http://www.mail-archive.com/pym...@li... > -- Michael Lerner Department of Physics and Astronomy Earlham College - Drawer 111 801 National Road West Richmond, IN 47374-4095 |
|
From: Michael L. <mgl...@gm...> - 2012-07-15 02:05:45
|
I finally got back to this, and I'm still having some trouble. The surface
I write out seems to be offset from what I'm viewing in PyMOL. I define the
following functions:
def getIndexedFaceSet(wrlname):
f = file(wrlname)
for line in f:
if 'geometry IndexedFaceSet {' in line:
break
else:
print "Could not find IndexedFaceSet"
return None
assert 'coord Coordinate' in f.next()
assert 'point' in f.next()
points = []
for line in f:
if not line.strip(): continue
line = line.strip()
if ']' in line:
break
if line.endswith(','):
line = line[:-1]
points.append(','.join(line.split()) + '\n')
return points
def pts2pdb(ptsname,pdbname):
f = file(pdbname,'w')
atomid,resi = 1,1
for line in open(ptsname):
line = line.strip()
if not line: continue
c = [float(x) for x in line.split(',')]
f.write('ATOM %06s %4s PHO %04s
%8.3f%8.3f%8.3f\n'%(atomid,resi,'C',c[0],c[1],c[2]))
atomid += 1
f.close()
def
writeSurfaceValue(objname,wrlname='/tmp/tmp.wrl',ptsname='/tmp/tmp.pts',pdbname='/tmp/tmp.pdb'):
cmd.hide('everything')
cmd.show('surface',objname)
cmd.save(wrlname)
points = getIndexedFaceSet(wrlname)
f = file(ptsname,'w')
f.writelines(points)
f.close()
pts2pdb(ptsname,pdbname)
cmd.extend('write_surface_value',writeSurfaceValue)
and then do
fetch 1rx1
set surface_solvent, 1
show surface
run <whatever file defines the above functions>
write_surface_value 1rx1
load /tmp/tmp.pdb
show spheres, tmp
and the tmp object looks like it has the right shape, but is clearly offset
from 1rx1.
I have a feeling I'm doing something simple and obvious wrong, but I'm not
sure what.
Thanks,
-Michael
On Mon, Jun 11, 2012 at 10:47 PM, Michael Lerner <mgl...@gm...> wrote:
> Hi all,
>
> Tsjerk- Thanks. I'm not sure how I missed that, given that it's even
> mentioned on the wiki on the surface page under the clear heading
> "Exporting Surface/Mesh Coordinates to File" :-|. (
> http://www.pymolwiki.org/index.php/Surface#Exporting_Surface.2FMesh_Coordinates_to_File).
> I don't know anything about VRML, but I found some documentation online at
> http://www.c3.hu/cryptogram/vrmltut/part5.html and it looks really
> straightforward. The surface will show up in the VRML file as an
> IndexedFaceSet, and the points are just XYZ triples, and I can safely
> ignore everything else.
>
> Darrell- Thanks. I'll build that in as an option.
>
> Takanori- Thanks. That's really cool. I happen to want solvent accessible
> surfaces rather than isosurfaces, but "dump" is definitely going into my
> bag of tricks.
>
> Cheers,
> -Michael
>
> On Mon, Jun 11, 2012 at 8:57 PM, Takanori Nakane <
> t.n...@ma...> wrote:
>
>> Hi,
>>
>> Another way:
>> There is an undocumented API called 'dump', which can
>> dump coordinates of isomesh/isosurface to a file.
>>
>> For mesh, it dumps a list of vertex coordinates, which
>> can be rendered as GL_LINE_STRIP.
>> For surface, it dumps a list of pairs of a vertex coordinate
>> and its vertex normal vector, which can be rendered as GL_TRIANGLES.
>>
>> Please examine my old post for a script example.
>>
>> http://www.mail-archive.com/pym...@li.../msg10012.html
>>
>> Best regards,
>>
>> Takanori Nakane
>>
>>
>> ------------------------------------------------------------------------------
>> Live Security Virtual Conference
>> Exclusive live event will cover all the ways today's security and
>> threat landscape has changed and how IT managers can respond. Discussions
>> will include endpoint security, mobile security and the latest in malware
>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>> _______________________________________________
>> PyMOL-users mailing list (PyM...@li...)
>> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
>> Archives: http://www.mail-archive.com/pym...@li...
>>
>
>
>
> --
> Michael Lerner
> Department of Physics and Astronomy
> Earlham College - Drawer 111
> 801 National Road West
> Richmond, IN 47374-4095
>
>
--
Michael Lerner
Department of Physics and Astronomy
Earlham College - Drawer 111
801 National Road West
Richmond, IN 47374-4095
|
|
From: Thomas H. <sp...@us...> - 2012-07-15 09:35:20
|
Hi Michael,
you need to reset the camera view.
def writeSurfaceValue(objname, wrlname='/tmp/tmp.wrl',
ptsname='/tmp/tmp.pts', pdbname='/tmp/tmp.pdb'):
cmd.hide('everything')
cmd.show('surface',objname)
view = cmd.get_view()
cmd.set_view([1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0,
0.0, 0.0, -50.0, 0.0, 0.0, 0.0, 40.0, 100.0, -20.0])
cmd.save(wrlname)
points = getIndexedFaceSet(wrlname)
f = file(ptsname,'w')
f.writelines(points)
f.close()
pts2pdb(ptsname,pdbname)
cmd.set_view(view)
Cheers,
Thomas
Michael Lerner wrote, On 07/15/12 04:05:
> I finally got back to this, and I'm still having some trouble. The
> surface I write out seems to be offset from what I'm viewing in PyMOL. I
> define the following functions:
>
> def getIndexedFaceSet(wrlname):
> f = file(wrlname)
> for line in f:
> if 'geometry IndexedFaceSet {' in line:
> break
> else:
> print "Could not find IndexedFaceSet"
> return None
> assert 'coord Coordinate' in f.next()
> assert 'point' in f.next()
> points = []
> for line in f:
> if not line.strip(): continue
> line = line.strip()
> if ']' in line:
> break
> if line.endswith(','):
> line = line[:-1]
> points.append(','.join(line.split()) + '\n')
> return points
>
> def pts2pdb(ptsname,pdbname):
> f = file(pdbname,'w')
> atomid,resi = 1,1
> for line in open(ptsname):
> line = line.strip()
> if not line: continue
> c = [float(x) for x in line.split(',')]
> f.write('ATOM %06s %4s PHO %04s
> %8.3f%8.3f%8.3f\n'%(atomid,resi,'C',c[0],c[1],c[2]))
> atomid += 1
> f.close()
>
> def
> writeSurfaceValue(objname,wrlname='/tmp/tmp.wrl',ptsname='/tmp/tmp.pts',pdbname='/tmp/tmp.pdb'):
> cmd.hide('everything')
> cmd.show('surface',objname)
> cmd.save(wrlname)
> points = getIndexedFaceSet(wrlname)
> f = file(ptsname,'w')
> f.writelines(points)
> f.close()
> pts2pdb(ptsname,pdbname)
> cmd.extend('write_surface_value',writeSurfaceValue)
>
> and then do
>
> fetch 1rx1
> set surface_solvent, 1
> show surface
> run <whatever file defines the above functions>
> write_surface_value 1rx1
> load /tmp/tmp.pdb
> show spheres, tmp
>
> and the tmp object looks like it has the right shape, but is clearly
> offset from 1rx1.
>
> I have a feeling I'm doing something simple and obvious wrong, but I'm
> not sure what.
>
> Thanks,
>
> -Michael
>
> On Mon, Jun 11, 2012 at 10:47 PM, Michael Lerner <mgl...@gm...
> <mailto:mgl...@gm...>> wrote:
>
> Hi all,
>
> Tsjerk- Thanks. I'm not sure how I missed that, given that it's even
> mentioned on the wiki on the surface page under the clear heading
> "Exporting Surface/Mesh Coordinates to File" :-|.
> (http://www.pymolwiki.org/index.php/Surface#Exporting_Surface.2FMesh_Coordinates_to_File).
> I don't know anything about VRML, but I found some documentation
> online at http://www.c3.hu/cryptogram/vrmltut/part5.html and it
> looks really straightforward. The surface will show up in the VRML
> file as an IndexedFaceSet, and the points are just XYZ triples, and
> I can safely ignore everything else.
>
> Darrell- Thanks. I'll build that in as an option.
>
> Takanori- Thanks. That's really cool. I happen to want solvent
> accessible surfaces rather than isosurfaces, but "dump" is
> definitely going into my bag of tricks.
>
> Cheers,
> -Michael
>
> On Mon, Jun 11, 2012 at 8:57 PM, Takanori Nakane
> <t.n...@ma...
> <mailto:t.n...@ma...>> wrote:
>
> Hi,
>
> Another way:
> There is an undocumented API called 'dump', which can
> dump coordinates of isomesh/isosurface to a file.
>
> For mesh, it dumps a list of vertex coordinates, which
> can be rendered as GL_LINE_STRIP.
> For surface, it dumps a list of pairs of a vertex coordinate
> and its vertex normal vector, which can be rendered as GL_TRIANGLES.
>
> Please examine my old post for a script example.
> http://www.mail-archive.com/pym...@li.../msg10012.html
>
> Best regards,
>
> Takanori Nakane
--
Thomas Holder
MPI for Developmental Biology
Spemannstr. 35
D-72076 Tübingen
|
|
From: Michael L. <mgl...@gm...> - 2012-07-15 15:00:29
|
Thanks!
Apparently I'd forgotten that fetch defaults to doing a zoom (which it
obviously has to do to make things look reasonable), so I thought I didn't
need to play with the view. Too much non-PyMOL work rots the brain, it
seems.
Cheers,
-Michael
On Sun, Jul 15, 2012 at 5:35 AM, Thomas Holder <
sp...@us...> wrote:
> Hi Michael,
>
> you need to reset the camera view.
>
> def writeSurfaceValue(objname, wrlname='/tmp/tmp.wrl',
> ptsname='/tmp/tmp.pts', pdbname='/tmp/tmp.pdb'):
>
> cmd.hide('everything')
> cmd.show('surface',objname)
> view = cmd.get_view()
> cmd.set_view([1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0,
> 0.0, 0.0, -50.0, 0.0, 0.0, 0.0, 40.0, 100.0, -20.0])
>
> cmd.save(wrlname)
> points = getIndexedFaceSet(wrlname)
> f = file(ptsname,'w')
> f.writelines(points)
> f.close()
> pts2pdb(ptsname,pdbname)
> cmd.set_view(view)
>
> Cheers,
> Thomas
>
> Michael Lerner wrote, On 07/15/12 04:05:
>
>> I finally got back to this, and I'm still having some trouble. The
>> surface I write out seems to be offset from what I'm viewing in PyMOL. I
>> define the following functions:
>>
>> def getIndexedFaceSet(wrlname):
>> f = file(wrlname)
>> for line in f:
>> if 'geometry IndexedFaceSet {' in line:
>> break
>> else:
>> print "Could not find IndexedFaceSet"
>> return None
>> assert 'coord Coordinate' in f.next()
>> assert 'point' in f.next()
>> points = []
>> for line in f:
>> if not line.strip(): continue
>> line = line.strip()
>> if ']' in line:
>> break
>> if line.endswith(','):
>> line = line[:-1]
>> points.append(','.join(line.**split()) + '\n')
>> return points
>>
>> def pts2pdb(ptsname,pdbname):
>> f = file(pdbname,'w')
>> atomid,resi = 1,1
>> for line in open(ptsname):
>> line = line.strip()
>> if not line: continue
>> c = [float(x) for x in line.split(',')]
>> f.write('ATOM %06s %4s PHO %04s %8.3f%8.3f%8.3f\n'%(atomid,**
>> resi,'C',c[0],c[1],c[2]))
>> atomid += 1
>> f.close()
>> def writeSurfaceValue(objname,**wrlname='/tmp/tmp.wrl',**
>> ptsname='/tmp/tmp.pts',**pdbname='/tmp/tmp.pdb'):
>> cmd.hide('everything')
>> cmd.show('surface',objname)
>> cmd.save(wrlname)
>> points = getIndexedFaceSet(wrlname)
>> f = file(ptsname,'w')
>> f.writelines(points)
>> f.close()
>> pts2pdb(ptsname,pdbname)
>> cmd.extend('write_surface_**value',writeSurfaceValue)
>>
>> and then do
>>
>> fetch 1rx1
>> set surface_solvent, 1
>> show surface
>> run <whatever file defines the above functions>
>> write_surface_value 1rx1
>> load /tmp/tmp.pdb
>> show spheres, tmp
>>
>> and the tmp object looks like it has the right shape, but is clearly
>> offset from 1rx1.
>>
>> I have a feeling I'm doing something simple and obvious wrong, but I'm
>> not sure what.
>>
>> Thanks,
>>
>> -Michael
>>
>> On Mon, Jun 11, 2012 at 10:47 PM, Michael Lerner <mgl...@gm...<mailto:
>> mgl...@gm...>> wrote:
>>
>> Hi all,
>>
>> Tsjerk- Thanks. I'm not sure how I missed that, given that it's even
>> mentioned on the wiki on the surface page under the clear heading
>> "Exporting Surface/Mesh Coordinates to File" :-|.
>> (http://www.pymolwiki.org/**index.php/Surface#Exporting_**
>> Surface.2FMesh_Coordinates_to_**File<http://www.pymolwiki.org/index.php/Surface#Exporting_Surface.2FMesh_Coordinates_to_File>
>> ).
>> I don't know anything about VRML, but I found some documentation
>> online at http://www.c3.hu/cryptogram/**vrmltut/part5.html<http://www.c3.hu/cryptogram/vrmltut/part5.html>and it
>> looks really straightforward. The surface will show up in the VRML
>> file as an IndexedFaceSet, and the points are just XYZ triples, and
>> I can safely ignore everything else.
>>
>> Darrell- Thanks. I'll build that in as an option.
>>
>> Takanori- Thanks. That's really cool. I happen to want solvent
>> accessible surfaces rather than isosurfaces, but "dump" is
>> definitely going into my bag of tricks.
>>
>> Cheers,
>> -Michael
>>
>> On Mon, Jun 11, 2012 at 8:57 PM, Takanori Nakane
>> <t.n...@ma....**kyoto-u.ac.jp<t.n...@ma...>
>> <mailto:t.n...@ma....**med.kyoto-u.ac.jp<t.n...@ma...>>>
>> wrote:
>>
>> Hi,
>>
>> Another way:
>> There is an undocumented API called 'dump', which can
>> dump coordinates of isomesh/isosurface to a file.
>>
>> For mesh, it dumps a list of vertex coordinates, which
>> can be rendered as GL_LINE_STRIP.
>> For surface, it dumps a list of pairs of a vertex coordinate
>> and its vertex normal vector, which can be rendered as
>> GL_TRIANGLES.
>>
>> Please examine my old post for a script example.
>> http://www.mail-archive.com/**pym...@li....**
>> net/msg10012.html<http://www.mail-archive.com/pym...@li.../msg10012.html>
>>
>> Best regards,
>>
>> Takanori Nakane
>>
>
> --
> Thomas Holder
> MPI for Developmental Biology
> Spemannstr. 35
> D-72076 Tübingen
>
--
Michael Lerner
Department of Physics and Astronomy
Earlham College - Drawer 111
801 National Road West
Richmond, IN 47374-4095
|