Collections:
"babel -d" Command - Delete Hydrogens from Molecule Data
How to delete hydrogen atoms from molecule data during data conversion?
✍: FYIcenter.com
If hydrogen atoms of a molecule are included in the input data source,
you can use the "babel" generic option "-d" remove those hydrogen atoms
during the molecule data conversion process.
Here is an example of using the "-d" option in the "babel" command.
1. Generate a benzene molecule with hydrogen atoms included and stored in a "sdf" file.
fyicenter$ obabel -:c1ccccc1 -o sdf -O benzene.sdf --gen2D -h
1 molecule converted
fyicenter$ more benzene.sdf
OpenBabel05212009392D
12 12 0 0 0 0 0 0 0 0999 V2000
-0.8660 -0.5000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-1.7321 -0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-1.7321 1.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.8660 1.5000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.0000 1.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
0.0000 0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.8660 -1.5320 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
-2.6258 -0.5160 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
-2.6258 1.5160 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
-0.8660 2.5320 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
0.8937 1.5160 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
0.8937 -0.5160 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
1 6 1 0 0 0 0
1 2 2 0 0 0 0
1 7 1 0 0 0 0
2 3 1 0 0 0 0
2 8 1 0 0 0 0
3 4 2 0 0 0 0
3 9 1 0 0 0 0
4 5 1 0 0 0 0
4 10 1 0 0 0 0
5 6 2 0 0 0 0
5 11 1 0 0 0 0
6 12 1 0 0 0 0
M END
$$$$
2. Convert the benzene molecule from "sdf" format to "svg" format with hydrogen atoms deleted using the "-d" option:
fyicenter$ babel benzene.sdf -o svg -d <?xml version="1.0"?> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:cml="http://www.xml-cml.org/schema" width="149.283" height="159.999" x="0" y="0" font-family="sans-serif" stroke="rgb(0,0,0)" stroke-width="1" stroke-linecap="round"> <rect x="0%" y="0%" width="100%" height="100%" stroke-width="0" fill="rgb(255,255,255)" /> <line x1="74.6" y1="120.0" x2="40.0" y2="100.0" stroke="rgb(0,0,0)" stroke-width="1.0"/> <line x1="73.0" y1="110.8" x2="48.8" y2="96.8" stroke="rgb(0,0,0)" stroke-width="1.0"/> <line x1="40.0" y1="100.0" x2="40.0" y2="60.0" stroke="rgb(0,0,0)" stroke-width="1.0"/> <line x1="40.0" y1="60.0" x2="74.6" y2="40.0" stroke="rgb(0,0,0)" stroke-width="1.0"/> <line x1="48.8" y1="63.2" x2="73.0" y2="49.2" stroke="rgb(0,0,0)" stroke-width="1.0"/> <line x1="74.6" y1="40.0" x2="109.3" y2="60.0" stroke="rgb(0,0,0)" stroke-width="1.0"/> <line x1="109.3" y1="60.0" x2="109.3" y2="100.0" stroke="rgb(0,0,0)" stroke-width="1.0"/> <line x1="102.1" y1="66.0" x2="102.1" y2="94.0" stroke="rgb(0,0,0)" stroke-width="1.0"/> <line x1="109.3" y1="100.0" x2="74.6" y2="120.0" stroke="rgb(0,0,0)" stroke-width="1.0"/> <text font-size="18.000000" fill ="black" font-family="sans-serif" x="10.000000" y="20.000000" ></text> <title> - OBDepict</title> </svg>
As you can see from the output, 6 hydrogen atoms were deleted from the benzene molecule, because of the "-d" option.
As a comparison, here is the output of the above "babel" command without the "-d" option:
fyicenter$ babel benzene.sdf -o svg <?xml version="1.0"?> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:cml="http://www.xml-cml.org/schema" width="218.564" height="240.001" x="0" y="0" font-family="sans-serif" stroke="rgb(0,0,0)" stroke-width="1" stroke-linecap="round"> <rect x="0%" y="0%" width="100%" height="100%" stroke-width="0" fill="rgb(255,255,255)" /> <line x1="109.3" y1="159.4" x2="109.3" y2="187.0" stroke="rgb(0,0,0)" stroke-width="1.0"/> <line x1="75.2" y1="139.7" x2="51.3" y2="153.5" stroke="rgb(0,0,0)" stroke-width="1.0"/> <line x1="75.2" y1="100.3" x2="51.3" y2="86.5" stroke="rgb(0,0,0)" stroke-width="1.0"/> <line x1="109.3" y1="80.6" x2="109.3" y2="53.0" stroke="rgb(0,0,0)" stroke-width="1.0"/> <line x1="143.4" y1="100.3" x2="167.3" y2="86.5" stroke="rgb(0,0,0)" stroke-width="1.0"/> <line x1="143.4" y1="139.7" x2="167.3" y2="153.5" stroke="rgb(0,0,0)" stroke-width="1.0"/> <line x1="109.3" y1="159.4" x2="75.2" y2="139.7" stroke="rgb(0,0,0)" stroke-width="1.0"/> <line x1="107.7" y1="150.1" x2="84.0" y2="136.4" stroke="rgb(0,0,0)" stroke-width="1.0"/> <line x1="75.2" y1="139.7" x2="75.2" y2="100.3" stroke="rgb(0,0,0)" stroke-width="1.0"/> <line x1="75.2" y1="100.3" x2="109.3" y2="80.6" stroke="rgb(0,0,0)" stroke-width="1.0"/> <line x1="84.0" y1="103.6" x2="107.7" y2="89.9" stroke="rgb(0,0,0)" stroke-width="1.0"/> <line x1="109.3" y1="80.6" x2="143.4" y2="100.3" stroke="rgb(0,0,0)" stroke-width="1.0"/> <line x1="143.4" y1="100.3" x2="143.4" y2="139.7" stroke="rgb(0,0,0)" stroke-width="1.0"/> <line x1="136.2" y1="106.3" x2="136.2" y2="133.7" stroke="rgb(0,0,0)" stroke-width="1.0"/> <line x1="143.4" y1="139.7" x2="109.3" y2="159.4" stroke="rgb(0,0,0)" stroke-width="1.0"/> <text x="103.283733" y="208.000619" fill="rgb(191,191,191)" stroke="rgb(191,191,191)" stroke-width="1" font-size="16" >H</text> <text x="34.000000" y="168.000464" fill="rgb(191,191,191)" stroke="rgb(191,191,191)" stroke-width="1" font-size="16" >H</text> <text x="34.000000" y="88.000155" fill="rgb(191,191,191)" stroke="rgb(191,191,191)" stroke-width="1" font-size="16" >H</text> <text x="103.283733" y="48.000000" fill="rgb(191,191,191)" stroke="rgb(191,191,191)" stroke-width="1" font-size="16" >H</text> <text x="172.563528" y="88.000155" fill="rgb(191,191,191)" stroke="rgb(191,191,191)" stroke-width="1" font-size="16" >H</text> <text x="172.563528" y="168.000464" fill="rgb(191,191,191)" stroke="rgb(191,191,191)" stroke-width="1" font-size="16" >H</text> <text font-size="18.000000" fill ="black" font-family="sans-serif" x="10.000000" y="20.000000" ></text> <title> - OBDepict</title> </svg>
⇒ "babel --append ..." Command - Calculate Molecule Properties
⇐ "babel -h" Command - Add Hydrogens to Molecule Data
2020-07-15, 1214🔥, 0💬
Popular Posts:
Molecule Summary: ID: FYI-1003355 Names: InChIKey: OPBCOLZGTXBFTN-ZJLYAJKPS A-NSMILES: C[C@H](CS)C(=...
Molecule Summary: ID: FYI-1003297 Names: InChIKey: VEVPAWVGLHYFFE-UHFFFAOYS A-NSMILES: COCOc1ccccc1c...
Molecule Summary: ID: FYI-1000976 SMILES: S=C1S/C(=C/c2ccccc2C)C(= O)N1CCN(C)CReceived at FYIcenter....
Molecule Summary: ID: FYI-1000270 SMILES: N[17C@@](F)([18C])C(=[19 0O])[20O]Received at FYIcenter.co...
Molecule Summary: ID: FYI-1002892 Names: InChIKey: WEOFIRPZWSUJBC-UHFFFAOYS A-NSMILES: NS(=O)(=O)c2c...