-
Notifications
You must be signed in to change notification settings - Fork 16
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
Correctly sort gmx xvg files for analysis #384
Conversation
Sorry, I forgot to blacken again. |
Thanks, @fjclark. Is this only an issue for GROMACS, or are any of the other engines affected? |
Looking at
I think the code:
An alternative fix, which is probably simpler, would be to ensure a consistent number of digits so that the string-based sorting works, e.g. the lower example:
Would you prefer this? Thanks. |
I guess I'm confused. By default, when setting things up via In [1]: import BioSimSpace as BSS
In [2]: import sire as sr
In [3]: mols = sr.load_test_files("merged_molecule.s3")
In [4]: system = BSS._SireWrappers.System(mols._system)
In [5]: freenrg_gmx = BSS.FreeEnergy.Relative(system, BSS.Protocol.FreeEnergy(), engine="gromacs", work_dir="fep_gmx")
In [6]: ls -l fep_gmx/
total 44
drwxr-xr-x 2 lester lester 4096 Jan 24 18:13 lambda_0.0000/
drwxr-xr-x 2 lester lester 4096 Jan 24 18:13 lambda_0.1000/
drwxr-xr-x 2 lester lester 4096 Jan 24 18:13 lambda_0.2000/
drwxr-xr-x 2 lester lester 4096 Jan 24 18:13 lambda_0.3000/
drwxr-xr-x 2 lester lester 4096 Jan 24 18:13 lambda_0.4000/
drwxr-xr-x 2 lester lester 4096 Jan 24 18:13 lambda_0.5000/
drwxr-xr-x 2 lester lester 4096 Jan 24 18:13 lambda_0.6000/
drwxr-xr-x 2 lester lester 4096 Jan 24 18:13 lambda_0.7000/
drwxr-xr-x 2 lester lester 4096 Jan 24 18:13 lambda_0.8000/
drwxr-xr-x 2 lester lester 4096 Jan 24 18:13 lambda_0.9000/
drwxr-xr-x 2 lester lester 4096 Jan 24 18:13 lambda_1.0000/ So, if each directory contains a import pathlib
glob_path = pathlib.Path("fep_gmx")
files = sorted(glob_path.glob("**/[!bar]*.xvg"))
for file in file:
print(file) gives:
which is the correct order. Are you setting things up in a different way so that the directory naming structure is different for GROMACS? If so, then I agree that you would need to use a consistent number of digits in your naming scheme. |
Sorry, this was exactly the issue - I was running gmx ABFE with the sandpit, but analysing with standard BSS for consistency with SOMD2. The sandpit analysis works fine for the gmx output. |
Ah, that makes sense. No problem. I think we'll eventually move over to naming things by index, so I'll make sure to use an appropriate number of digits when I do. |
This pull request fixes issue #383
devel
into this branch before issuing this pull request (e.g. by runninggit pull origin devel
): ySuggested reviewers:
@lohedges