Skip to content
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

cluster.py fails if paths have no directory spec #195

Open
justinrporter opened this issue May 1, 2020 · 3 comments
Open

cluster.py fails if paths have no directory spec #195

justinrporter opened this issue May 1, 2020 · 3 comments
Labels
bug good-first-issue this issue would be a good first commit

Comments

@justinrporter
Copy link
Collaborator

$ python ~/projects/enspara/enspara/apps/cluster.py \
  --trajectories trajectory-*.xtc \
  --topology fs-peptide.pdb \
  --algorithm khybrid \
  --cluster-number 20 \
  --subsample 10 \
  --atoms '(name N or name C or name CA)' \
  --distances fs-khybrid-clusters0020-distances.h5 \
  --center-features fs-khybrid-clusters0020-centers.pickle \
  --assignments fs-khybrid-clusters0020-assignments.h5
[clustering blah blah]
05-01-2020 11:00:57 __main__ INFO    Clustered 28000 frames into 20 clusters in 2.8169675880053546 seconds.
05-01-2020 11:00:57 __main__ INFO    --center-indices not provided, not writing center indices to file.
05-01-2020 11:00:57 __main__ INFO    Wrote center indices in 0.00 sec.
05-01-2020 11:00:57 __main__ INFO    Saving cluster centers at
Traceback (most recent call last):
  File "/Users/jrporter/projects/enspara/enspara/apps/cluster.py", line 514, in <module>
    sys.exit(main(sys.argv))
  File "/Users/jrporter/projects/enspara/enspara/apps/cluster.py", line 502, in main
    write_centers(result, args)
  File "/Users/jrporter/projects/enspara/enspara/apps/cluster.py", line 422, in write_centers
    os.makedirs(outdir)
  File "/Users/jrporter/.envs/enspara/bin/../lib/python3.6/os.py", line 220, in makedirs
    mkdir(name, mode)
FileNotFoundError: [Errno 2] No such file or directory: ''

Problem goes away if you specify e.g. --distances ./fs-khybrid-clusters0020-distances.h5 (with the ./).

@justinrporter justinrporter added bug good-first-issue this issue would be a good first commit labels May 1, 2020
@roblaine
Copy link

roblaine commented Jun 9, 2020

Hi @justinrporter,

Testing on my own linux machine using the same command that you were, I found that the behaviour could be replicated by specifying the arg to the center-features flag without a relative path.
Eg, --center-features fs-khybrid-clusters0020-centers.pickle causes the error, but --center-features ./fs-khybrid-clusters0020-centers.pickle, and --center-features $(pwd)/fs-khybrid-clusters0020-centers.pickle did not.

I can open a PR with a fix regardless, its only a couple of lines long if you want to take a look.

@justinrporter
Copy link
Collaborator Author

Thanks for the comment! Yes, I think that the cluster.py should work equally well with and without a path, and so I would welcome a PR fixing this!

@roblaine
Copy link

Just opened a PR for the issue I identified, but unsure if its the same as what this issue is about, or if it needs to be its own issue.

I wasn't able to reproduce the error you were seeing when you supplied the --distances flag with a relative path and no leading ./, so not really sure if I can help there, but hopefully what I've written is helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug good-first-issue this issue would be a good first commit
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants