pengxingang / Pocket2Mol

Pocket2Mol: Efficient Molecular Sampling Based on 3D Protein Pockets
MIT License
258 stars 70 forks source link

Argparse regression #34

Open nakker opened 11 months ago

nakker commented 11 months ago

If the --center argument starts with a negative number argparse fails (see https://bugs.python.org/issue9334)

$ python sample_for_pdb.py --pdb_path ./example/6j00.pdb --center '-42.6,-30.6,-11.6'
usage: sample_for_pdb.py [-h] [--pdb_path PDB_PATH] [--center CENTER] [--bbox_size BBOX_SIZE] [--config CONFIG] [--device DEVICE] [--outdir OUTDIR]
sample_for_pdb.py: error: argument --center: expected one argument

A simple workaround is to place a space as the first character in the --center argument such as

$ python sample_for_pdb.py --pdb_path ./example/6j00.pdb --center ' -42.6,-30.6,-11.6'

Without solving the regression, a horribly hacky way to fix this would be on line 67 of sample_for_pdb.py

if __name__ == '__main__':
    idx = sys.argv.index("--center")+1
    sys.argv[idx] = ' ' + sys.argv[idx]
    parser = argparse.ArgumentParser()
    ...
pengxingang commented 11 months ago

Thank you very much for your valuable suggestion. We took note of the situation in which the center parameter begins with a negative value and had left a space before the first value in the example in our readme.md file. To ensure this space is not overlooked, we may need to place greater emphasis on it. Once again, we sincerely appreciate your feedback.