tanghaibao / jcvi

Python library to facilitate genome assembly, annotation, and comparative genomics
BSD 2-Clause "Simplified" License
743 stars 187 forks source link

allmaps path failing #7

Closed coreywischmeyer closed 3 years ago

coreywischmeyer commented 8 years ago

I have a pipeline that uses AllMaps on different assemblies. I have 4 assemblies and just as many maps. AllMaps finishes without complaint on 3 of 4 assemblies. On the final assembly I get the error below.

17:16:41 [allmaps] Working on a2_dxa-LGDxP7|0666-19 ...
Traceback (most recent call last):
  File "/loginhome/cwischmeyer/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/loginhome/cwischmeyer/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/mnt/nfs/demeter/loginhome/cwischmeyer/cwischmeyer-home-ubuntu/lib/python2.7/site-packages/jcvi/assembly/allmaps.py", line 1684, in <module>
    main()
  File "/mnt/nfs/demeter/loginhome/cwischmeyer/cwischmeyer-home-ubuntu/lib/python2.7/site-packages/jcvi/assembly/allmaps.py", line 820, in main
    p.dispatch(globals())
  File "/loginhome/cwischmeyer/lib/python2.7/site-packages/jcvi/apps/base.py", line 81, in dispatch
    globals[action](sys.argv[2:])
  File "/mnt/nfs/demeter/loginhome/cwischmeyer/cwischmeyer-home-ubuntu/lib/python2.7/site-packages/jcvi/assembly/allmaps.py", line 1297, in path
    ngen=ngen, npop=npop, cpus=cpus, seed=seed)
  File "/mnt/nfs/demeter/loginhome/cwischmeyer/cwischmeyer-home-ubuntu/lib/python2.7/site-packages/jcvi/assembly/allmaps.py", line 152, in __init__
    signs = self.assign_orientation()
  File "/mnt/nfs/demeter/loginhome/cwischmeyer/cwischmeyer-home-ubuntu/lib/python2.7/site-packages/jcvi/assembly/allmaps.py", line 383, in assign_orientation
    pivot_oo = [pivot_oo.get(x, 0) for x in scaffolds]
UnboundLocalError: local variable 'pivot_oo' referenced before assignment
tanghaibao commented 8 years ago

@coreywischmeyer it may be because the map name is not available in weights.txt. Could you verify that maps a2_dxa and 0666 are available in that file? thanks, Haibao

coreywischmeyer commented 8 years ago

Yes, those two maps are definitely in the weights.txt

trgibbons commented 5 years ago

I'm experiencing the same error:

Traceback (most recent call last):
  File "/home1/tgibbons/anaconda/envs/Q2311jcvi/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/home1/tgibbons/anaconda/envs/Q2311jcvi/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home1/tgibbons/anaconda/envs/Q2311jcvi/lib/python2.7/site-packages/jcvi/assembly/allmaps.py", line 1871, in <module>
    main()
  File "/home1/tgibbons/anaconda/envs/Q2311jcvi/lib/python2.7/site-packages/jcvi/assembly/allmaps.py", line 827, in main
    p.dispatch(globals())
  File "/home1/tgibbons/anaconda/envs/Q2311jcvi/lib/python2.7/site-packages/jcvi/apps/base.py", line 96, in dispatch
    globals[action](sys.argv[2:])
  File "/home1/tgibbons/anaconda/envs/Q2311jcvi/lib/python2.7/site-packages/jcvi/assembly/allmaps.py", line 1484, in path
    ngen=ngen, npop=npop, cpus=cpus, seed=seed)
  File "/home1/tgibbons/anaconda/envs/Q2311jcvi/lib/python2.7/site-packages/jcvi/assembly/allmaps.py", line 152, in __init__
    signs = self.assign_orientation()
  File "/home1/tgibbons/anaconda/envs/Q2311jcvi/lib/python2.7/site-packages/jcvi/assembly/allmaps.py", line 383, in assign_orientation
    pivot_oo = [pivot_oo.get(x, 0) for x in scaffolds]
UnboundLocalError: local variable 'pivot_oo' referenced before assignment

I'm using two pairs of maps from different data sources. I analyzed each pair separately without any errors. When I tried to combine them, however, I encountered this error message. All four maps are in the weights.txt file.

nhvanlie commented 4 years ago

I have been having the exact same issue with my 3 genetic maps. One pair works separately but not all 3. All 3 are in the weights.txt file. Has anyone found a work around?

tanghaibao commented 4 years ago

@nhvanlie

If your data is not too sensitive, would you send me your input files (or a snippet) for me to reproduce and debug?

Thanks, Haibao

nhvanlie commented 4 years ago

@tanghaibao I'm afraid the maps were given to us by companies with an NDA so I can't share any part of them. I can disclose that the pair that works together are from related diploid populations and the other one is from a hexaploid population in the same species.

The error message:

Traceback (most recent call last): File "/media/bulk_01/users/lies026/miniconda3/envs/allmaps/lib/python2.7/runpy.py", line 174, in _run_module_as_main "__main__", fname, loader, pkg_name) File "/media/bulk_01/users/lies026/miniconda3/envs/allmaps/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/media/bulk_01/users/lies026/miniconda3/envs/allmaps/lib/python2.7/site-packages/jcvi/assembly/allmaps.py", line 1872, in <module> main() File "/media/bulk_01/users/lies026/miniconda3/envs/allmaps/lib/python2.7/site-packages/jcvi/assembly/allmaps.py", line 828, in main p.dispatch(globals()) File "/media/bulk_01/users/lies026/miniconda3/envs/allmaps/lib/python2.7/site-packages/jcvi/apps/base.py", line 100, in dispatch globals[action](sys.argv[2:]) File "/media/bulk_01/users/lies026/miniconda3/envs/allmaps/lib/python2.7/site-packages/jcvi/assembly/allmaps.py", line 1485, in path ngen=ngen, npop=npop, cpus=cpus, seed=seed) File "/media/bulk_01/users/lies026/miniconda3/envs/allmaps/lib/python2.7/site-packages/jcvi/assembly/allmaps.py", line 153, in __init__ signs = self.assign_orientation() File "/media/bulk_01/users/lies026/miniconda3/envs/allmaps/lib/python2.7/site-packages/jcvi/assembly/allmaps.py", line 384, in assign_orientation pivot_oo = [pivot_oo.get(x, 0) for x in scaffolds] UnboundLocalError: local variable 'pivot_oo' referenced before assignment

tanghaibao commented 4 years ago

@nhvanlie

I understand and no worries.

This error should have nothing to do with the actual data, but due to namings in the weights file. I'll see if I can reproduce this error somehow.

Haibao

nhvanlie commented 4 years ago

Hey @tanghaibao! I just wanted to check in and see if a solution or work around was available. I've tried changing the names in the weights file to no effect.

tanghaibao commented 4 years ago

@nhvanlie

I can't seem to create a condition to trigger the error. Short of having a dataset to debug, it may be difficult to fix this issue. I'd appreciate a 'toy' sample file with your protected data redacted. Would this be possible?

Haibao

VanOverbeeke commented 1 month ago

@coreywischmeyer it may be because the map name is not available in weights.txt. Could you verify that maps a2_dxa and 0666 are available in that file? thanks, Haibao

From these map names I would suggest that maybe Python interprets the 0666 map name as an int() at some point, and can't match it with the str() version?