bacpop / PopPUNK

PopPUNK 👨‍🎤 (POPulation Partitioning Using Nucleotide Kmers)
https://www.bacpop.org/poppunk
Apache License 2.0
89 stars 18 forks source link

AttributeError: module 'pp_sketchlib' has no attribute 'assignThreshold' #156

Closed dineshkumarsrk closed 3 years ago

dineshkumarsrk commented 3 years ago

poppunk 2.3.0 poppunk_sketch 1.6.5 I have been working on Xanthomonas genus strains, I had successfully created database. Further, I proceeded for --fit-modelwith bgmm and dbscan both model directories were generated without any error. However I obtained poor plot for both models, so I proceeded for refine and used the following command, (base) dinesh@dinesh7k:~/Documents/data/xap98/popPUNK$ poppunk --fit-model refine --ref-db database --model-dir dbscan/ end up with the following error,

PopPUNK (POPulation Partitioning Using Nucleotide Kmers)
    (with backend: sketchlib v1.6.5
     sketchlib: /home/dinesh/miniconda3/lib/python3.8/site-packages/pp_sketchlib.cpython-38-x86_64-linux-gnu.so)

Graph-tools OpenMP parallelisation enabled: with 1 threads
Mode: Fitting refine model to reference database

Loading DBSCAN model
Loaded previous model of type: dbscan
Initial model-based network construction based on DBSCAN fit
Initial boundary based network construction
Decision boundary starts at (0.54,0.53)
Trying to optimise score globally
multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/home/dinesh/miniconda3/lib/python3.8/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "/home/dinesh/miniconda3/lib/python3.8/multiprocessing/pool.py", line 48, in mapstar
    return list(map(*args))
  File "/home/dinesh/miniconda3/lib/python3.8/site-packages/PopPUNK/refine.py", line 179, in newNetwork
    boundary_assignments = pp_sketchlib.assignThreshold(distMat, slope, x_max, y_max, cpus)
AttributeError: module 'pp_sketchlib' has no attribute 'assignThreshold'
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/dinesh/miniconda3/bin/poppunk", line 10, in <module>
    sys.exit(main())
  File "/home/dinesh/miniconda3/lib/python3.8/site-packages/PopPUNK/__main__.py", line 363, in main
    assignments = new_model.fit(distMat, refList, model,
  File "/home/dinesh/miniconda3/lib/python3.8/site-packages/PopPUNK/models.py", line 609, in fit
    self.start_point, self.optimal_x, self.optimal_y, self.min_move, self.max_move = refineFit(X/self.scale,
  File "/home/dinesh/miniconda3/lib/python3.8/site-packages/PopPUNK/refine.py", line 100, in refineFit
    global_s = pool.map(partial(newNetwork,
  File "/home/dinesh/miniconda3/lib/python3.8/multiprocessing/pool.py", line 364, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
  File "/home/dinesh/miniconda3/lib/python3.8/multiprocessing/pool.py", line 771, in get
    raise self._value
AttributeError: module 'pp_sketchlib' has no attribute 'assignThreshold'

I am getting the same error for using bgmm model directory under refine option as follows,

(base) dinesh@dinesh7k:~/Documents/data/xap98/popPUNK$ poppunk --fit-model refine --ref-db database --model-dir bgmm
bgmm/     bgmm_viz/ 
(base) dinesh@dinesh7k:~/Documents/data/xap98/popPUNK$ poppunk --fit-model refine --ref-db database --model-dir bgmm/
PopPUNK (POPulation Partitioning Using Nucleotide Kmers)
    (with backend: sketchlib v1.6.5
     sketchlib: /home/dinesh/miniconda3/lib/python3.8/site-packages/pp_sketchlib.cpython-38-x86_64-linux-gnu.so)

Graph-tools OpenMP parallelisation enabled: with 1 threads
Mode: Fitting refine model to reference database

Loading BGMM 2D Gaussian model
Loaded previous model of type: bgmm
Initial model-based network construction based on Gaussian fit
Initial boundary based network construction
Decision boundary starts at (0.01,0.14)
Trying to optimise score globally
multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/home/dinesh/miniconda3/lib/python3.8/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "/home/dinesh/miniconda3/lib/python3.8/multiprocessing/pool.py", line 48, in mapstar
    return list(map(*args))
  File "/home/dinesh/miniconda3/lib/python3.8/site-packages/PopPUNK/refine.py", line 179, in newNetwork
    boundary_assignments = pp_sketchlib.assignThreshold(distMat, slope, x_max, y_max, cpus)
AttributeError: module 'pp_sketchlib' has no attribute 'assignThreshold'
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/dinesh/miniconda3/bin/poppunk", line 10, in <module>
    sys.exit(main())
  File "/home/dinesh/miniconda3/lib/python3.8/site-packages/PopPUNK/__main__.py", line 363, in main
    assignments = new_model.fit(distMat, refList, model,
  File "/home/dinesh/miniconda3/lib/python3.8/site-packages/PopPUNK/models.py", line 609, in fit
    self.start_point, self.optimal_x, self.optimal_y, self.min_move, self.max_move = refineFit(X/self.scale,
  File "/home/dinesh/miniconda3/lib/python3.8/site-packages/PopPUNK/refine.py", line 100, in refineFit
    global_s = pool.map(partial(newNetwork,
  File "/home/dinesh/miniconda3/lib/python3.8/multiprocessing/pool.py", line 364, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
  File "/home/dinesh/miniconda3/lib/python3.8/multiprocessing/pool.py", line 771, in get
    raise self._value
AttributeError: module 'pp_sketchlib' has no attribute 'assignThreshold'

Please help me to fix this issue.

johnlees commented 3 years ago

This looks like a version mismatch caused by some recent changes we haven't yet synced up, which will be sorted when v2.4.0 of PopPUNK is on bioconda. For now, can I suggest that you downgrade your sketchlib version to 1.6.2:

conda install pp-sketchlib==1.6.2

I can let you know when you've got our next release out, as poppunk 2.4.0 will work with pp-sketchlib 1.6.5 and higher

dineshkumarsrk commented 3 years ago

Thank you @johnlees . Now its works well

johnlees commented 3 years ago

This should be fixed with v2.4.0 (and v1.7.0 of sketchlib)