Entering edit mode
8.1 years ago
underoath006
▴
10
I want to use the code from example 4 here to iterate over many files:
https://pymolwiki.org/index.php/Get_Area
I tried to look up some documentation about pymol, I think maybe "glob" could be used but idon't really understand it. I found this post here, but couldn't really conenct the two codes together:
https://sourceforge.net/p/pymol/mailman/message/27805952/
I would appreciate if someone could help. P.s. I'm new to both pymol and python.
didn't quite work and I can't debug it because I'm not entirely sure what glob does! can I message you? please email me at underoath006 at gmail.
Communicating via email is not encouraged, this discussion could be beneficial for everyone.
Glob searches for files matching a pattern, in this case files in the directory specified by
sys.argv[1]
which end in.pdf
.*end in .pdb, not .pdf :P
@underoath006: What is the error you're getting?
Gha close enough ;)
But still no cigar :)
this is the error Iget, how can I post the entire script for you to look at?
You can put your script on GitHub (gist) and then post the link for public gist in a post here. Biostars understands GitHub and will load the code from the gist automatically.
This code works if I type in the name of the pdb file, it calculates the accessible surface area of each residue in a pdb file and returns a dictionary that could be saved using json dump. I want to iterate this process over many pdb file. The problem with pymol is that it needs to be restarted between runs for some reasons. :(
Currently everything from line 18 on is not covered by the for-loop, so that block would have to be indented. Is there a cmd.unload() or something that you could use at the end of the for-loop?
The easiest way could be to run this script once for each file, e.g. via a bash loop.
sorry my bad, but I get the same error. Can you elaborate what you mean by a bash loop? I found this, now how can we use it?
https://pymolwiki.org/index.php/Reinitialize
Insert a
cmd.reinitialize()
before line 16 and try if that works.Concerning the bash loop, that would be a way to run the script for multiple files using the Unix shell. There's also a way to do that on the Windows command line, but I don't know the syntax for it.