Batch processed output lacks Predicted dissociation constant
Dear developers,
I am finding Prodigy very informative, and I have been working on a batch script to process a folder of pdb files and collect the Prodigy outputs to a log file. This largely works quite well, but the last line of the typical command terminal output providing the Predicted dissociation constant does not write to the log file.
When running directly from a Windows command prompt..
C:\dataForProdigy>prodigy C:\dataForProdigy\fold_copiapropellar_mouse_vnut_mouse_model_1.pdb --temperature 37.0
Gives [+] Reading structure file: C:\dataForProdigy\fold_copiapropellar_mouse_vnut_mouse_model_1.pdb [+] Parsed structure file fold_copiapropellar_mouse_vnut_mouse_model_1 (2 chains, 765 residues) [+] No. of intermolecular contacts: 113 [+] No. of charged-charged contacts: 18 [+] No. of charged-polar contacts: 21 [+] No. of charged-apolar contacts: 32 [+] No. of polar-polar contacts: 7 [+] No. of apolar-polar contacts: 21 [+] No. of apolar-apolar contacts: 14 [+] Predicted binding affinity (kcal.mol-1): -12.8 [+] Percentage of apolar NIS residues: 45.30 [+] Percentage of charged NIS residues: 21.62 [+] Predicted dissociation constant (M) at 37.0˚C: 9.6e-10
However, the following batch script fails to record that last line:
@echo off
setlocal enabledelayedexpansion
:: Set the folder containing PDB files and the output file
set "folder=C:\dataForProdigy"
set "output_file=C:\dataForProdigy\output.log"
:: Check if the folder exists
if not exist "%folder%" (
echo Error: The folder does not exist. > "%output_file%"
exit /b 1
)
:: Clear previous output file
echo File Data... > "%output_file%"
:: Loop through all .pdb files in the folder
for %%F in ("%folder%\*.pdb") do (
echo Processing: %%F
for /f "delims=" %%O in ('prodigy "%%F" --temperature 37.0 --pymol_selection 2^>^&1 ^| find "[+"') do (
set "line=%%O"
setlocal enabledelayedexpansion
:: Replace ': ' (colon followed by space) with ':<TAB>'
set "formatted_line=!line:: =: !"
set "formatted_line=!line: =!"
:: Replace 'Parsed structure file ' with 'Parsed structure file<TAB>'
set "formatted_line=!formatted_line:Parsed structure file =Parsed structure file !"
:: Append filename and formatted output to file
echo %%F !formatted_line! >> "%output_file%"
endlocal
)
)
echo Done! Output saved to %output_file%
This appears to be due to trying to write the degree symbol to the output file at line 249 in predict_IC.py.
handle.write(
#Note that the degree symbol prevents this line from saving in batch files
#"[++] Predicted dissociation constant (M) at {:.1f}˚C: {:8.1e}\n".format(self.temp, self.kd_val)
"[+] Predicted dissociation constant (M) at {:.1f} C: {:8.1e}\n".format(self.temp, self.kd_val)
)
Just wanted to pass this on in case others run into this problem
Best, Damon Poburko
Thanks for bringing this to our attention! Could it be simply related to some (lack of) encoding? Does it give you any error or just doesn't print the line? Maybe I can simply remove it to avoid further issues.
Thanks for the quick response!
I hadn't considered text encoding standards. Specifying utf-8 encoding with the following lines in the batch file allowed the º symbol to be saved to the output log file.
chcp 65001 >nul set PYTHONIOENCODING=utf-8
I am curious. Does your lab use an alternate approach to batch processing pdb files?
Best, Damon
From: Rodrigo Vargas Honorato Sent: Thursday, March 20, 2025 10:11 AM To: haddocking/prodigy Cc: Damon Poburko; Author Subject: Re: [haddocking/prodigy] Batch processed output lacks Predicted dissociation constant (Issue #40)
[rvhonorato]rvhonorato left a comment (haddocking/prodigy#40)https://github.com/haddocking/prodigy/issues/40#issuecomment-2741096214
Thanks for bringing this to our attention! Could it be simply related to some (lack of) encoding? Does it give you any error or just doesn't print the line? Maybe I can simply remove it to avoid further issues.
— Reply to this email directly, view it on GitHubhttps://github.com/haddocking/prodigy/issues/40#issuecomment-2741096214, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKCQMIR7O6NNGCCLNZMZGZ32VLWZZAVCNFSM6AAAAABZNQJ6UKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONBRGA4TMMRRGQ. You are receiving this because you authored the thread.
@dpoburko I have just updated the code and published a new version that can handle batch processing, see the instructions here. Thanks for the input!
Thank you!