Entering edit mode
7.9 years ago
ac.research
▴
30
People I need your help,
I have the following command:
iterate n. CA, print resi + ':' + ss
I use this command in pymol to print out each residue number and its corresponding secondary structure. The command prints out the result in pymol itself.
My question is: How can I save the output from this command into a file?
AC Research
I'm not familiar with pymol, but I naively expect it's a python module you are running in the standard python interpreter (correct me if I'm wrong).
In that case, you could try the following:
Well i think we are in the right direction, but not there yet.
I do get a syntax error regarding expressing the command correctly:
with open('myoutputfile.txt', 'w') as output: output.write(iterate n. CA, print resi + ':' + ss) ^ SyntaxError: invalid syntax
is there a way to write the command in output.write() better?
And what about:
I've no idea what those python objects are, but we'll get there eventually I guess.
same synthax error, pointing to the same place.
More guess-work, perhaps someone with knowledge of pymol will come along soon
If you're using PyMol GUI, I don't think the above will work. If you imported it as a module in python itself that could work I believe.
I personally WAY prefer USCF Chimera which has a Python interpreter propely baked in, and supports scripting etc.
Given the obtained SynthaxError it looks like a standard python interpreter to me, but I don't know anything about the GUI...