-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Read Partial Charges from mol2 and SDF #258
Merged
Merged
Changes from 3 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
726ae0b
add args to read charges from atom prop
rwxayheee 63b0fff
edit init_atom to support read charges from atom prop
rwxayheee bedbdb7
finish draft charges from mol2
rwxayheee 2d9492e
change default read_charge_from_propname to _TriposPartialCharge
rwxayheee 31c0d4b
fixup! change default read_charge_from_propname to _TriposPartialCharge
rwxayheee f6699e7
fixup! change default read_charge_from_propname to _TriposPartialCharge
rwxayheee e0f7c53
set default atom property name to PartialCharge; revise error handlin…
rwxayheee 6741616
rename charge_propname to charge_atom_prop
rwxayheee 2bfa6a2
add option charge_from_prop to mk_prepare_ligand.py
rwxayheee c7f0fb4
use arguments from cli to override config, before
rwxayheee 7f1380f
fixup! use arguments from cli to override config, before preparator =…
rwxayheee 0568941
fix mistakes in handling args charge_from_prop and config;
rwxayheee 772c8d9
Only explicitly provided command line arguments override config
rwxayheee 3c4422c
remove special & redundant handling of explicitly prvided args;
rwxayheee 5995773
clean up unused backend options; redirect error msg to file=sys.stderr
rwxayheee d0fd018
clearify error msg; make them all begin with Error:
rwxayheee 86b0eb2
clean up lines added in testing
rwxayheee 36c3af4
revert unecessary changes to make diffs prettier
rwxayheee 81151af
clean up changes; move --charge_atom_prop to config_group
rwxayheee a2a7984
clarify argparse overriding config file
diogomart File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,6 +78,11 @@ def cmd_lineparser(): | |
"--name_from_prop", | ||
help="set molecule name from RDKit/SDF property", | ||
) | ||
io_group.add_argument( | ||
"--charge_from_prop", | ||
nargs="*", | ||
help="set atom partial charges from the input file. The default is PartialCharge for SDF and _TriposPartialCharge for MOL2 unless overriden by a user defined property name. ", | ||
) | ||
io_group.add_argument( | ||
"-o", | ||
"--out", | ||
|
@@ -214,7 +219,7 @@ def cmd_lineparser(): | |
) | ||
config_group.add_argument( | ||
"--charge_model", | ||
choices=("gasteiger", "espaloma", "zero"), | ||
choices=("gasteiger", "espaloma", "zero", "read"), | ||
help="default is 'gasteiger', 'zero' sets all zeros", | ||
default="gasteiger", | ||
) | ||
|
@@ -551,6 +556,19 @@ def main(): | |
nr_failures = 0 | ||
is_after_first = False | ||
preparator = MoleculePreparation.from_config(config) | ||
|
||
if args.charge_from_prop is not None: | ||
if args.charge_model != "read": | ||
print('--charge_from_prop must be used with --charge_model "read"') | ||
sys.exit(1) | ||
|
||
preparator.charge_model = "read" | ||
if args.charge_from_prop: | ||
preparator.charge_atom_prop = args.charge_from_prop[0] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no need for |
||
else: | ||
if ext=="mol2": | ||
preparator.charge_atom_prop = "_TriposPartialCharge" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is inside the |
||
|
||
for mol in mol_supplier: | ||
if is_after_first and output.is_multimol == False: | ||
print("Processed only the first molecule of multiple molecule input.") | ||
|
This file contains 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
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need for nargs