-
Notifications
You must be signed in to change notification settings - Fork 7
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
7 feature request argument parsing #8
7 feature request argument parsing #8
Conversation
@schackartk - Thanks for putting in the work! Very busy week - have you tested the code (such as running the automated test script) after incorporating these functions? Edit: never mind, I just saw your "Conclusions" that you had tested the automated tests |
Thank you so much for your updated code!!! I have several questions/comments regarding your changes:
I also reviewed the code, which should show up below here. Learned a lot from your code! |
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.
First off, thank you again for putting in the time! I really like the help message you included in the README! Second, I added comments (and found a little bug) for this PR. Some changes will necessitate changes to other part of the pipeline as well - which is relatively easy to me.
Hi @schackartk - if you are okay with it, I can merge your PR, then make the changes mentioned in my review comments :) |
Most python tools will use either |
Go for it! I am glad to see you found my changes useful. |
Thanks for explaining it! I wasn't a big fan of snake_case because the "_" not long takes space but also requires pressing two keys (shift and -) to type lol |
Awesome! Oh yes, super useful! I will wait for you to take a look at the only remaining review comment above about |
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.
Will approve these changes, then I will make the further changes mentioned in the comments and discussions. Thanks again!
Complete the changes mentioned in the comments of PR#8: #8
* add shebang * add argument parsing * begin validating arguments * fix small inconsistencies * update argument formatting * improve directory handling * automatically detect OS * revert to run_num as argument name * update readme to reflect argparse implementation * revert to --run_num argument name * broaden default mmb location flag wildcards * fix a few typos * remove accidental extra characters * remove old command line parsing * use argparse to validate --mode === The commits above were made by schackartk and were merged into the topic branch by the PR #8 === * Complete PR#8 Complete the changes mentioned in the comments of the PR #8 * Update README.MD * Two more fixes in main.py 1. Add an argparse argument to specify OS in command line. 2. Only overwrite the output directory (eg, ".../run1") when `-f/--force` and '--pick_up No' in command line. Then update the help message of main.py in the README.MD according to the new main.py * Update argparse in main.py * Update argparse in main.py Co-authored-by: Kenneth Schackart <schackartk1@gmail.com>
Overview
This pull request implements argparse so that the user is less likely to need to edit source code in main.py. However, more work will need to be done to include parameters related to environmental condotions like ph, etc.
Other than implementing argparse, functionality is the same. Some things are still a bit awkward because I didn't want to change too much beyond that.
Affected files
The following files have changes:
Notes
main.py
There were a few things that may need to be changed to work most efficiently and predictably.
The relationship between
--ligand
,--ligand_type
, and--ligand_seq
is a bit complex and can probably be improved. Ideally, I think--ligand
would be optional, yielding a default of None. This makes more sense than having to use--ligand False
. Then--ligand_type
, and--ligand_seq
could also be optional with a default of None (instead of an empty string). Only when--ligand
is present, you validate the others are there and if notparser.error()
. I also think the authors should consider if--ligand_seq
is truly required if--l;igand
is either 'peptide', 'DNA' or 'RNA'. Currently this is enforced (byparser.error()
), but if it is actually optional, that should be updated.I left the code that uses different params based on whether it is run as
local
orcluster
, but I am not sure if it is necessary. I especially think that the hard-coded paths used when it iscluster
should be removed, and turned into arguments. In which case, it is the same as the usual arguments, and may make--device
obsolete if there is no difference between local and cluster.I implemented wildcards to help the user find their MMB paths (lib and executable) within the
--mmb_dir
and--mmb
. I am hoping the defaults will make it so users don't have to change this argument.I removed the operating system argument and instead used
platform
to detect it. This new implementation has only been tested on my WSL system, so please check this works. One issue is if the result ofplatform.system().lower()
doesn't match an expected value on mac. Initially mine returnedLinux
, which is why I ranlower()
to make it 'linux' which is compatible with the previous implementation.Lots of argument validation now happens in
get_args()
, so hopefully more helpful error messages are produced.I added a feature so that both
--aptamer
and--ligand_seq
can be names of files. In that case, the file contents are read in and used as the sequences. Literal strings can still be used instead of file names.Readme.md
I hope my additions are helpful in describing the current functionality.
One thing I was uncertain is the description of ligand type saying "(default: Amber14)" I didn't see this anywhere that params were set. It is not the default to any arguments I set up. If this needs to be a default, please take note of this.
Conclusions
Currently, all modes in
automate_tests.sh
run for me, so it seems that these changes are compatible. It would be great to have unit and integration tests with pytest to confirm.Please check that it works on MacOS still, as I have only tested on WSL.
No additional dependencies have been added, only core libraries were used.
Please feel free to make any changes you see fit or discuss!