Webgl, python script for multiple pdbs

Hello Chimera Team i have been trying to make a script for looping through a set of pdb files and get WebGL (.html) file as the output. import os import chimera import Midas from chimera import exports from chimera import runCommand as rc # use 'rc' as shorthand for runCommand # change to folder with data files os.chdir("E:/files to work/") # gather the names of .pdb files in the folder file_names = [fn for fn in os.listdir(".") if fn.endswith(".pdb")] # loop through the files, opening, processing, and closing each in turn for fn in file_names: rc("open " + fn) rc("ac wb") rc("ac c2") htmlname = fn[:-3] +'.html' exports.doExportCommand("WebGL",htmlname) rc("close") This is the code I have been using in the script , but the output i get is not working , i have been getting 26kb files instead of 3-5 mb files and it doesn't show anything when I open it. can you please help me with the same as i am new to python code

Hi Avnam, Possibly the problem is that Chimera has not drawn the atomic model before you export the HTML and it may not show the ribbon or atoms until they get drawn on the screen. I am not sure about this. (All our development is on our newer ChimeraX program, although it does not export WebGL/HTML.) To get it to draw put in a rc('wait 1') before you export the HTML. If that does not fix it, make sure to try with the exact same PDB file doing the steps by hand to see that it is not some issue with the specific PDB file you are using. Tom
On Jul 6, 2021, at 4:24 PM, Avnam Ohri via Chimera-users <chimera-users@cgl.ucsf.edu> wrote:
Hello Chimera Team i have been trying to make a script for looping through a set of pdb files and get WebGL (.html) file as the output.
import os import chimera import Midas from chimera import exports from chimera import runCommand as rc # use 'rc' as shorthand for runCommand # change to folder with data files os.chdir("E:/files to work/")
# gather the names of .pdb files in the folder file_names = [fn for fn in os.listdir(".") if fn.endswith(".pdb")]
# loop through the files, opening, processing, and closing each in turn for fn in file_names: rc("open " + fn) rc("ac wb") rc("ac c2") htmlname = fn[:-3] +'.html' exports.doExportCommand("WebGL",htmlname) rc("close")
This is the code I have been using in the script , but the output i get is not working , i have been getting 26kb files instead of 3-5 mb files and it doesn't show anything when I open it.
can you please help me with the same as i am new to python code _______________________________________________ Chimera-users mailing list: Chimera-users@cgl.ucsf.edu Manage subscription: https://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users
participants (2)
-
Avnam Ohri
-
Tom Goddard