Created
September 6, 2023 21:31
-
-
Save nazavode/a68ef80a9ebc607631f178245e85507d to your computer and use it in GitHub Desktop.
Compute optimal RMSD between two molecular structures
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from rdkit.Chem.rdmolfiles import MolFromMol2File | |
from rdkit.Chem.rdMolAlign import AlignMol | |
import argparse | |
if __name__ == "__main__": | |
PARSER = argparse.ArgumentParser( | |
description="""Compute optimal RMSD of two structures. | |
Atom order is not changed, and no matching is attempted. For details refer to: | |
https://www.rdkit.org/docs/source/rdkit.Chem.rdMolAlign.html#module-rdkit.Chem.rdMolAlign | |
""", | |
formatter_class=argparse.RawDescriptionHelpFormatter, | |
) | |
PARSER.add_argument( | |
"file_a", | |
metavar="PATH_A", | |
help="path to the first structure in TRIPOS mol2 format", | |
) | |
PARSER.add_argument( | |
"file_b", | |
metavar="PATH_B", | |
help="path to the second structure in TRIPOS mol2 format", | |
) | |
args = PARSER.parse_args() | |
a = MolFromMol2File(args.file_a) | |
b = MolFromMol2File(args.file_b) | |
res = AlignMol(a, b) | |
print(res) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment