Dear Responsible, I am trying to acquaint myself with "chimera --nogui --script" mode in order to automatize some pdb processing for a pipeline. I manage to search for pdb, to open the file, to select residues and to calculate COM for the selection. On the shell, I get the COM coordinates but I would like to print or store them to write them elsewhere. So the question is how can I print the replylog from shell to a text file, under the --nogui mode? I have tried with saveReplyLog but it doesn't seem to work...Any suggestions are appreciated. This is an excerpt from what I'm writing so far: import os from chimera import runCommand as rc from chimera import replyobj from chimera import saveReplyLog #change to the folder containing the pdb files os.chdir("xxx/yyy/zzz/ABC.pdb") def find_string_with_substring(string, substring): for s in strings: if substring in s: return s return None # list_files contain only the .pdb files list_pdb_files = [fn for fn in os.listdir(".") if fn.endswith(".pdb")] # specify the characters 'HLA' you want the filenames contain HLA_characters = HLA file_pdb_HLA = fins_string_with_substring(list_pdb_files, HLA_characters) print(list_pdb_files) print(file_pdb_HLA) nome = file_pdb_HLA replyobj.status(Processing " + nome) rc ("open " + nome) rc ("select :1.232") rc("measure center sel") saveReplyLog("~/reply-log.txt") Thank you so much -- Dr. Valerio Chiarini _Senior Scientist_ Proteins & Monoclona Antibodies Department b Takis Biotech c/o Tecnopolo Via di Castel Romano, 100 00128 Rome, Italy Tel.: +39 06-50576077 Fax: +39 06-50576710 Email: chiarini@takisbiotech.it Web: http://www.takisbiotech.it 196/03_ _Le informazioni contenute in questa comunicazione e gli eventuali documenti allegati hanno carattere confidenziale, sono tutelate dal segreto professionale e sono ad uso esclusivo del destinatario. Nel caso questa comunicazione Vi sia pervenuta per errore, Vi informiamo che la sua diffusione e riproduzione C( contraria alla legge e preghiamo di darci prontamente avviso e di cancellare quanto ricevuto. __Grazie._ _This e-mail message and any files transmitted with it are subject to attorney-client privilege and contain confidential information intended only for the person(s) to whom it is addressed. If you are not the intended recipient, you are hereby notified that any use or distribution of this e-mail is strictly prohibited: please notify the sender and delete the original message. __Thank you._
Hi Valerio, If you are running in nogui, there is no reply log. The output that would normally go to the reply log should be appearing on your shell's standard output. You just redirect the output to a file using your shell's builtin redirection capabilities. --Eric Eric Pettersen UCSF Computer Graphics Lab
On Jan 30, 2024, at 12:59 AM, valerio chiarini via Chimera-users <chimera-users@cgl.ucsf.edu> wrote:
Dear Responsible,
I am trying to acquaint myself with "chimera --nogui --script" mode in order to automatize some pdb processing for a pipeline. I manage to search for pdb, to open the file, to select residues and to calculate COM for the selection. On the shell, I get the COM coordinates but I would like to print or store them to write them elsewhere. So the question is how can I print the replylog from shell to a text file, under the --nogui mode? I have tried with saveReplyLog but it doesn't seem to work...Any suggestions are appreciated.
This is an excerpt from what I'm writing so far:
import os from chimera import runCommand as rc from chimera import replyobj from chimera import saveReplyLog
#change to the folder containing the pdb files os.chdir("xxx/yyy/zzz/ABC.pdb")
def find_string_with_substring(string, substring): for s in strings: if substring in s: return s return None
# list_files contain only the .pdb files list_pdb_files = [fn for fn in os.listdir(".") if fn.endswith(".pdb")]
# specify the characters 'HLA' you want the filenames contain HLA_characters = HLA
file_pdb_HLA = fins_string_with_substring(list_pdb_files, HLA_characters)
print(list_pdb_files)
print(file_pdb_HLA)
nome = file_pdb_HLA
replyobj.status(Processing " + nome)
rc ("open " + nome) rc ("select :1.232") rc("measure center sel")
saveReplyLog("~/reply-log.txt")
Thank you so much
-- Dr. Valerio Chiarini
_Senior Scientist_
Proteins & Monoclona Antibodies Department b Takis Biotech
c/o Tecnopolo
Via di Castel Romano, 100
00128 Rome, Italy
Tel.: +39 06-50576077
Fax: +39 06-50576710
Email: chiarini@takisbiotech.it
Web: http://www.takisbiotech.it 196/03_
_Le informazioni contenute in questa comunicazione e gli eventuali documenti allegati hanno carattere confidenziale, sono tutelate dal segreto professionale e sono ad uso esclusivo del destinatario. Nel caso questa comunicazione Vi sia pervenuta per errore, Vi informiamo che la sua diffusione e riproduzione C( contraria alla legge e preghiamo di darci prontamente avviso e di cancellare quanto ricevuto. __Grazie._
_This e-mail message and any files transmitted with it are subject to attorney-client privilege and contain confidential information intended only for the person(s) to whom it is addressed. If you are not the intended recipient, you are hereby notified that any use or distribution of this e-mail is strictly prohibited: please notify the sender and delete the original message. __Thank you._ _______________________________________________ Chimera-users mailing list -- chimera-users@cgl.ucsf.edu To unsubscribe send an email to chimera-users-leave@cgl.ucsf.edu Archives: https://mail.cgl.ucsf.edu/mailman/archives/list/chimera-users@cgl.ucsf.edu/
Thanks a lot, It simply wasn't writing the output.txt because it couldn't import saveReplyLog module. Once I commented that line it just worked by running chimera --nogui --script https://urldefense.proofpoint.com/v2/url?u=http-3A__myscript.py&d=DwIDaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=AnLbjfzj4A4gVWflERdQcNZUEpTJryfgdkg4779VL5A&m=MYKVfFbeiLDiKbMTYv9IpRgOWovwz9ohatwL58YIKl2f2YCfcN8sNhPqv0mwvrNo&s=ZdKhIjuypoF8W-zMGGFddYdmjxkGASERbRZ_XUqxBag&e= > output.txt. I have a follow up question: I have now printed two COM coordinates to my output.txt. I want to include these coordinates into my pdb as novel atoms which I will use later on to align in VMD the two COM COM to the z-axis of a simulation box. Is there a way to write a python operation that would use the coordinates of the COMs to perform the add atom function (same as tools> structure editor > build structure)? Or is it better to do it via shell script outside chimera? Thanks for the help. Valerio Il 2024-01-30 20:47 Eric Pettersen via Chimera-users ha scritto:
Hi Valerio, If you are running in nogui, there is no reply log. The output that would normally go to the reply log should be appearing on your shell's standard output. You just redirect the output to a file using your shell's builtin redirection capabilities.
--Eric
Eric Pettersen UCSF Computer Graphics Lab
On Jan 30, 2024, at 12:59 AM, valerio chiarini via Chimera-users <chimera-users@cgl.ucsf.edu> wrote:
Dear Responsible,
I am trying to acquaint myself with "chimera --nogui --script" mode in order to automatize some pdb processing for a pipeline. I manage to search for pdb, to open the file, to select residues and to calculate COM for the selection. On the shell, I get the COM coordinates but I would like to print or store them to write them elsewhere. So the question is how can I print the replylog from shell to a text file, under the --nogui mode? I have tried with saveReplyLog but it doesn't seem to work...Any suggestions are appreciated.
This is an excerpt from what I'm writing so far:
import os from chimera import runCommand as rc from chimera import replyobj from chimera import saveReplyLog
#change to the folder containing the pdb files os.chdir("xxx/yyy/zzz/ABC.pdb")
def find_string_with_substring(string, substring): for s in strings: if substring in s: return s return None
# list_files contain only the .pdb files list_pdb_files = [fn for fn in os.listdir(".") if fn.endswith(".pdb")]
# specify the characters 'HLA' you want the filenames contain HLA_characters = HLA
file_pdb_HLA = fins_string_with_substring(list_pdb_files, HLA_characters)
print(list_pdb_files)
print(file_pdb_HLA)
nome = file_pdb_HLA
replyobj.status(Processing " + nome)
rc ("open " + nome) rc ("select :1.232") rc("measure center sel")
saveReplyLog("~/reply-log.txt")
Thank you so much
-- Dr. Valerio Chiarini
_Senior Scientist_
Proteins & Monoclona Antibodies Department b Takis Biotech
c/o Tecnopolo
Via di Castel Romano, 100
00128 Rome, Italy
Tel.: +39 06-50576077
Fax: +39 06-50576710
Email: chiarini@takisbiotech.it
_Le informazioni contenute in questa comunicazione e gli eventuali documenti allegati hanno carattere confidenziale, sono tutelate dal segreto professionale e sono ad uso esclusivo del destinatario. Nel caso questa comunicazione Vi sia pervenuta per errore, Vi informiamo che la sua diffusione e riproduzione C( contraria alla legge e preghiamo di darci prontamente avviso e di cancellare quanto ricevuto. __Grazie._
_This e-mail message and any files transmitted with it are subject to attorney-client privilege and contain confidential information intended only for the person(s) to whom it is addressed. If you are not the intended recipient, you are hereby notified that any use or distribution of this e-mail is strictly prohibited: please notify the sender and delete the original message. __Thank you._ _______________________________________________ Chimera-users mailing list -- chimera-users@cgl.ucsf.edu To unsubscribe send an email to chimera-users-leave@cgl.ucsf.edu Archives: https://urldefense.proofpoint.com/v2/url?u=https-3A__mail.cgl.ucsf.edu_mailman_archives_list_chimera-2Dusers-40cgl.ucsf.edu_&d=DwIDaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=AnLbjfzj4A4gVWflERdQcNZUEpTJryfgdkg4779VL5A&m=MYKVfFbeiLDiKbMTYv9IpRgOWovwz9ohatwL58YIKl2f2YCfcN8sNhPqv0mwvrNo&s=R2rG9YHUt7J0QLN0fa8MJaSaD_LQTRmmE-jekx90gmA&e=
_______________________________________________ Chimera-users mailing list -- chimera-users@cgl.ucsf.edu To unsubscribe send an email to chimera-users-leave@cgl.ucsf.edu Archives: https://urldefense.proofpoint.com/v2/url?u=https-3A__mail.cgl.ucsf.edu_mailman_archives_list_chimera-2Dusers-40cgl.ucsf.edu_&d=DwIDaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=AnLbjfzj4A4gVWflERdQcNZUEpTJryfgdkg4779VL5A&m=MYKVfFbeiLDiKbMTYv9IpRgOWovwz9ohatwL58YIKl2f2YCfcN8sNhPqv0mwvrNo&s=R2rG9YHUt7J0QLN0fa8MJaSaD_LQTRmmE-jekx90gmA&e=
-- Dr. Valerio Chiarini _Senior Scientist_ Proteins & Monoclona Antibodies Department – Takis Biotech c/o Tecnopolo Via di Castel Romano, 100 00128 Rome, Italy Tel.: +39 06-50576077 Fax: +39 06-50576710 Email: chiarini@takisbiotech.it Web: https://urldefense.proofpoint.com/v2/url?u=http-3A__www.takisbiotech.it&d=DwIDaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=AnLbjfzj4A4gVWflERdQcNZUEpTJryfgdkg4779VL5A&m=MYKVfFbeiLDiKbMTYv9IpRgOWovwz9ohatwL58YIKl2f2YCfcN8sNhPqv0mwvrNo&s=jtM37ooMrNUZZW3gwt4ZcehHN_AvIEruld_WtShR5Xs&e= D_.lgs. 196/03_ _Le informazioni contenute in questa comunicazione e gli eventuali documenti allegati hanno carattere confidenziale, sono tutelate dal segreto professionale e sono ad uso esclusivo del destinatario. Nel caso questa comunicazione Vi sia pervenuta per errore, Vi informiamo che la sua diffusione e riproduzione è contraria alla legge e preghiamo di darci prontamente avviso e di cancellare quanto ricevuto. __Grazie._ _This e-mail message and any files transmitted with it are subject to attorney-client privilege and contain confidential information intended only for the person(s) to whom it is addressed. If you are not the intended recipient, you are hereby notified that any use or distribution of this e-mail is strictly prohibited: please notify the sender and delete the original message. __Thank you._
Well, you can't easily do it in your original script since AFAIK you can't capture the COM position into a variable. You could write a second script that opens your structure and then adds two helium atoms at the COM positions with: import chimera m = chimera.openModels.list()[0] from chimera import Point from BuildStructure import placeHelium placeHelium("CM1", model=m, position=Point(x1, y1, z1)) placeHelium("CM2", model=m, position=Point(x2, y2, z2)) Then save the structure as PDB. --Eric
On Jan 31, 2024, at 4:01 AM, chiarini@takisbiotech.it wrote:
Thanks a lot, It simply wasn't writing the output.txt because it couldn't import saveReplyLog module. Once I commented that line it just worked by running chimera --nogui --script http://myscript.py <http://myscript.py> > output.txt.
I have a follow up question:
I have now printed two COM coordinates to my output.txt. I want to include these coordinates into my pdb as novel atoms which I will use later on to align in VMD the two COM COM to the z-axis of a simulation box. Is there a way to write a python operation that would use the coordinates of the COMs to perform the add atom function (same as tools> structure editor > build structure)? Or is it better to do it via shell script outside chimera?
Thanks for the help.
Valerio
Il 2024-01-30 20:47 Eric Pettersen via Chimera-users ha scritto:
Hi Valerio, If you are running in nogui, there is no reply log. The output that would normally go to the reply log should be appearing on your shell's standard output. You just redirect the output to a file using your shell's builtin redirection capabilities. --Eric Eric Pettersen UCSF Computer Graphics Lab
On Jan 30, 2024, at 12:59 AM, valerio chiarini via Chimera-users <chimera-users@cgl.ucsf.edu> wrote: Dear Responsible, I am trying to acquaint myself with "chimera --nogui --script" mode in order to automatize some pdb processing for a pipeline. I manage to search for pdb, to open the file, to select residues and to calculate COM for the selection. On the shell, I get the COM coordinates but I would like to print or store them to write them elsewhere. So the question is how can I print the replylog from shell to a text file, under the --nogui mode? I have tried with saveReplyLog but it doesn't seem to work...Any suggestions are appreciated. This is an excerpt from what I'm writing so far: import os from chimera import runCommand as rc from chimera import replyobj from chimera import saveReplyLog #change to the folder containing the pdb files os.chdir("xxx/yyy/zzz/ABC.pdb") def find_string_with_substring(string, substring): for s in strings: if substring in s: return s return None # list_files contain only the .pdb files list_pdb_files = [fn for fn in os.listdir(".") if fn.endswith(".pdb")] # specify the characters 'HLA' you want the filenames contain HLA_characters = HLA file_pdb_HLA = fins_string_with_substring(list_pdb_files, HLA_characters) print(list_pdb_files) print(file_pdb_HLA) nome = file_pdb_HLA replyobj.status(Processing " + nome) rc ("open " + nome) rc ("select :1.232") rc("measure center sel") saveReplyLog("~/reply-log.txt") Thank you so much -- Dr. Valerio Chiarini _Senior Scientist_ Proteins & Monoclona Antibodies Department b Takis Biotech c/o Tecnopolo Via di Castel Romano, 100 00128 Rome, Italy Tel.: +39 06-50576077 Fax: +39 06-50576710 Email: chiarini@takisbiotech.it Web: http://www.takisbiotech.it <http://www.takisbiotech.it> 196/03_ _Le informazioni contenute in questa comunicazione e gli eventuali documenti allegati hanno carattere confidenziale, sono tutelate dal segreto professionale e sono ad uso esclusivo del destinatario. Nel caso questa comunicazione Vi sia pervenuta per errore, Vi informiamo che la sua diffusione e riproduzione C( contraria alla legge e preghiamo di darci prontamente avviso e di cancellare quanto ricevuto. __Grazie._ _This e-mail message and any files transmitted with it are subject to attorney-client privilege and contain confidential information intended only for the person(s) to whom it is addressed. If you are not the intended recipient, you are hereby notified that any use or distribution of this e-mail is strictly prohibited: please notify the sender and delete the original message. __Thank you._ _______________________________________________ Chimera-users mailing list -- chimera-users@cgl.ucsf.edu <mailto:chimera-users@cgl.ucsf.edu> To unsubscribe send an email to chimera-users-leave@cgl.ucsf.edu <mailto:chimera-users-leave@cgl.ucsf.edu> Archives: https://mail.cgl.ucsf.edu/mailman/archives/list/chimera-users@cgl.ucsf.edu/ <https://mail.cgl.ucsf.edu/mailman/archives/list/chimera-users@cgl.ucsf.edu/>
Chimera-users mailing list -- chimera-users@cgl.ucsf.edu <mailto:chimera-users@cgl.ucsf.edu> To unsubscribe send an email to chimera-users-leave@cgl.ucsf.edu <mailto:chimera-users-leave@cgl.ucsf.edu> Archives: https://mail.cgl.ucsf.edu/mailman/archives/list/chimera-users@cgl.ucsf.edu/ <https://mail.cgl.ucsf.edu/mailman/archives/list/chimera-users@cgl.ucsf.edu/>
-- Dr. Valerio Chiarini
_Senior Scientist_
Proteins & Monoclona Antibodies Department – Takis Biotech
c/o Tecnopolo
Via di Castel Romano, 100
00128 Rome, Italy
Tel.: +39 06-50576077
Fax: +39 06-50576710
Email: chiarini@takisbiotech.it <mailto:chiarini@takisbiotech.it>
Web: http://www.takisbiotech.it <http://www.takisbiotech.it>
D_.lgs. 196/03_
_Le informazioni contenute in questa comunicazione e gli eventuali documenti allegati hanno carattere confidenziale, sono tutelate dal segreto professionale e sono ad uso esclusivo del destinatario. Nel caso questa comunicazione Vi sia pervenuta per errore, Vi informiamo che la sua diffusione e riproduzione è contraria alla legge e preghiamo di darci prontamente avviso e di cancellare quanto ricevuto. __Grazie._
_This e-mail message and any files transmitted with it are subject to attorney-client privilege and contain confidential information intended only for the person(s) to whom it is addressed. If you are not the intended recipient, you are hereby notified that any use or distribution of this e-mail is strictly prohibited: please notify the sender and delete the original message. __Thank you._
participants (2)
-
chiarini@takisbiotech.it
-
Eric Pettersen