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

Estimate breaks with ninja and distance methods #99

Open
peterjc opened this issue Jan 5, 2022 · 0 comments
Open

Estimate breaks with ninja and distance methods #99

peterjc opened this issue Jan 5, 2022 · 0 comments

Comments

@peterjc
Copy link

peterjc commented Jan 5, 2022

Tested on Linux,

$ pip freeze | grep grapetree
grapetree==2.2

There are 6 documented methods:

$ grapetree -h | grep "\--method" -A 6
usage: grapetree [-h] --profile FNAME [--method TREE] [--matrix MATRIX_TYPE]
                 [--recraft] [--missing HANDLER] [--wgMLST]
                 [--heuristic HEURISTIC] [--n_proc NUMBER_OF_PROCESSES]
                 [--check] [--block_penalty BLOCK_PENALTY]

For details, see "https://github.com/achtman-lab/GrapeTree/blob/master/README.md".
In brief, GrapeTree generates a NEWICK tree to the default output (screen) 
--
  --method TREE, -m TREE
                        "MSTreeV2" [DEFAULT]
                        "MSTree"
                        "NJ": FastME V2 NJ tree
                        "RapidNJ": RapidNJ for very large datasets
                        "ninja": Alternative NJ algorithm for very large datasets
                        "distance": allelic distance matrix in PHYLIP format.

The -c or --check option to only calculate the expected time/memory requirements works for just the first four methods:

$ for M in MSTreeV2 MSTree NJ RapidNJ ninja distance; do echo $M; grapetree -p Grapetree_Agona.profile -m $M -c; done
MSTreeV2
{"time": 33.77119490714262, "memory": 517090823.53, "affordable": true}
MSTree
{"time": 32.64200608256635, "memory": 429867607.233, "affordable": true}
NJ
{"time": 5, "memory": 52428800, "affordable": true}
RapidNJ
{"time": 32.64200608256635, "memory": 429867607.233, "affordable": true}
ninja
Traceback (most recent call last):
  File "/mnt/.../conda/bin/grapetree", line 8, in <module>
    sys.exit(main())
  File "/mnt/.../conda/lib/python3.7/site-packages/grapetree/grapetree.py", line 62, in main
    print (backend(**add_args()))
  File "/mnt/s.../conda/lib/python3.7/site-packages/grapetree/module/MSTrees.py", line 721, in backend
    time, memory = estimate_Consumption(platform.system(), params['method'], params['matrix_type'], int(params['n_proc']), profiles.shape[1], profiles.shape[0])
  File "/mnt/.../conda/lib/python3.7/site-packages/grapetree/module/MSTrees.py", line 786, in estimate_Consumption
    return max(time, 5), max(memory, 50*1024*1024)
UnboundLocalError: local variable 'time' referenced before assignment
distance
Traceback (most recent call last):
  File "/mnt/.../conda/bin/grapetree", line 8, in <module>
    sys.exit(main())
  File "/mnt/.../conda/lib/python3.7/site-packages/grapetree/grapetree.py", line 62, in main
    print (backend(**add_args()))
  File "/mnt/.../conda/lib/python3.7/site-packages/grapetree/module/MSTrees.py", line 721, in backend
    time, memory = estimate_Consumption(platform.system(), params['method'], params['matrix_type'], int(params['n_proc']), profiles.shape[1], profiles.shape[0])
  File "/mnt/.../conda/lib/python3.7/site-packages/grapetree/module/MSTrees.py", line 786, in estimate_Consumption
    return max(time, 5), max(memory, 50*1024*1024)
UnboundLocalError: local variable 'time' referenced before assignment

The estimate_Consumption if statement needs an else statement for methods without an estimate here:

def estimate_Consumption(platform, method, matrix, n_proc, n_loci, n_profile) :

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant