This script facilitates the conversion of chemical compounds from one file format to another using Open Babel. It also includes optional energy minimization for files converted to .pdb
format. Compounds that fail to convert are logged into a file named failed_compounds_list.txt
.
Before running the script, ensure the following:
-
Install Open Babel:
- Open Babel must be installed from source. Follow these steps to install it:
# Clone the Open Babel repository git clone https://github.com/openbabel/openbabel.git cd openbabel # Create a build directory and navigate into it mkdir build && cd build # Configure the build cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local # Compile and install make sudo make install
- Verify the installation by running:
obabel --version
- Open Babel must be installed from source. Follow these steps to install it:
-
Script and Files Location:
- Place the script and all compound files in the same directory.
- Ensure the input files have the correct extension (e.g.,
.sdf
).
Follow these steps to use the script:
-
Navigate to the Directory:
- Open a terminal and navigate to the folder containing the script and compound files:
cd /path/to/your/files
- Open a terminal and navigate to the folder containing the script and compound files:
-
Run the Script:
- Make the script executable:
chmod +x obabel_automate.sh
- Run the script:
./obabel_automate.sh
- Make the script executable:
-
Follow the Prompts:
- Enter the input file type (e.g.,
sdf
) when prompted. - Enter the desired output file format (e.g.,
pdb
,pdbqt
) when prompted.
- Enter the input file type (e.g.,
-
Review the Results:
- Converted files will appear in the same directory as the input files.
- Any files that failed to convert will be logged in
failed_compounds_list.txt
.
- Dynamic Input and Output Formats:
- The script dynamically handles file type and format conversions based on user input.
- Energy Minimization:
- Energy minimization is applied only if converting files to
.pdb
format.
- Energy minimization is applied only if converting files to
- Error Logging:
- Failed conversions are logged in
failed_compounds_list.txt
for troubleshooting.
- Failed conversions are logged in
- Place the script and input files (e.g.,
compound1.sdf
,compound2.sdf
) in the same directory. - Run the script:
./obabel_automate.sh
- Enter:
- Input file type:
sdf
- Output file format:
pdb
- Input file type:
- The script will process each compound, apply energy minimization for
.pdb
files, and log any failures.
- The script assumes all input files are in the specified format. If no matching files are found, it will exit with a message.
- For troubleshooting, review the
failed_compounds_list.txt
file and rerun the script for only the problematic compounds.
If you are using this script for your studies, kindly acknowledge the use of Open Babel as per its citation guidelines and mention my GitHub repository:
O'Boyle NM, Banck M, James CA, Morley C, Vandermeersch T, Hutchison GR. Open Babel: An open chemical toolbox. Journal of Cheminformatics. 2011;3:33. https://doi.org/10.1186/1758-2946-3-33
For the latest version of this script and updates, visit my GitHub repository: https://github.com/Gopinath-Murugan/Openbabel-Automation
Mentioning this repository in your publications or research would be greatly appreciated.
We appreciate your support!