Add keyword argument rename_atoms
to MoleculePreparation.prepare
and make option avail in CLI script
#255
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR enables unique atom names in MoleculeSetup after MoleculePreparation with the relevant option. The main purpose is to address request #47. Option
--rename_atoms
is added to the CLI script in an analog to Inprepare_ligand4.py
; there's a-w
option that renames ligand atoms, andeach newname is the original name of the atom plus its (1-based) uniqIndex
.Here're more details:
rename_atoms
toMoleculePreparation.prepare
The default is False, and it's just a keyword argument in function
prepare
. Because I didn't make it an attribute of MoleculePreparation, it can't be from the config (but we could, if the other way is preferred?). Python usage:is equivalent to
mk_prepare_ligand.py
mk_prepare_ligand.py
has a new option:The new names are a combination of original name plus the atom's (1-based) index in MoleculeSetup at the last moment of molecule preparation. For example:
C
might becomeC14
andOH
might becomeOH15
. The index should be generally consistent with the order of atoms in the input molecule, but not Smiles or the order of output PDBQT file. And glue atoms will have indices too. When the name is longer than 4 characters, the original name will remain unchanged and a warning message shall be seen:It's always possible to assign atom names in a rdkit molecule before MoleculePreparation. To import atom names, possible source includes: CIF files, MOL2/MOL files, PDB files, but PDB files are currently the only ones where atom names are parsed natively by RDKit.
This started from the release branch, so it includes some other commits that have been merged into release but not present in develop. It also includes another small fix (14ec360) just for #233, although noncritical to the rest of this PR.
@diogomart Please let me know what you think! Thanks for your time and advice in advance