bittremieux / falcon

Large-scale tandem mass spectrum clustering using fast nearest neighbor searching.
BSD 3-Clause "New" or "Revised" License
26 stars 8 forks source link

Help needed with error with positional arguments?? #22

Closed dulceggm closed 2 years ago

dulceggm commented 2 years ago

Hi I keep getting this error when trying to run falcon

TypeError: __init__() takes from 6 to 7 positional arguments but 8 were given

This is the argument I am using falcon spectra_Bt1/*.mzML network_Bt1 --work_dir ~/Documents/falcon_t1 --export_representatives --export_include_singletons --precursor_tol 0.05 Da --rt_tol 0.1 --min_peaks 3 --min_mz_range 100.0 --min_mz 150.0 --max_mz 2200.0 --min_intensity 0.01 --max_peaks_used 500

And the full log I get when trying to run it:

2022-11-03 16:07:43,222 INFO [falcon/MainProcess] falcon.main : falcon version 0.1.3
2022-11-03 16:07:43,222 DEBUG [falcon/MainProcess] falcon.main : work_dir = /Users/dulce_guillen/Documents/falcon_t1
2022-11-03 16:07:43,222 DEBUG [falcon/MainProcess] falcon.main : overwrite = False
2022-11-03 16:07:43,222 DEBUG [falcon/MainProcess] falcon.main : export_representatives = True
2022-11-03 16:07:43,222 DEBUG [falcon/MainProcess] falcon.main : usi_pxd = USI000000
2022-11-03 16:07:43,222 DEBUG [falcon/MainProcess] falcon.main : precursor_tol = 0.05 Da
2022-11-03 16:07:43,222 DEBUG [falcon/MainProcess] falcon.main : rt_tol = 0.1
2022-11-03 16:07:43,223 DEBUG [falcon/MainProcess] falcon.main : fragment_tol = 0.05
2022-11-03 16:07:43,223 DEBUG [falcon/MainProcess] falcon.main : eps = 0.100
2022-11-03 16:07:43,223 DEBUG [falcon/MainProcess] falcon.main : min_samples = 2
2022-11-03 16:07:43,223 DEBUG [falcon/MainProcess] falcon.main : mz_interval = 1
2022-11-03 16:07:43,223 DEBUG [falcon/MainProcess] falcon.main : hash_len = 800
2022-11-03 16:07:43,223 DEBUG [falcon/MainProcess] falcon.main : n_neighbors = 64
2022-11-03 16:07:43,223 DEBUG [falcon/MainProcess] falcon.main : n_neighbors_ann = 128
2022-11-03 16:07:43,223 DEBUG [falcon/MainProcess] falcon.main : batch_size = 65536
2022-11-03 16:07:43,223 DEBUG [falcon/MainProcess] falcon.main : n_probe = 32
2022-11-03 16:07:43,223 DEBUG [falcon/MainProcess] falcon.main : min_peaks = 3
2022-11-03 16:07:43,223 DEBUG [falcon/MainProcess] falcon.main : min_mz_range = 100.00
2022-11-03 16:07:43,223 DEBUG [falcon/MainProcess] falcon.main : min_mz = 150.00
2022-11-03 16:07:43,223 DEBUG [falcon/MainProcess] falcon.main : max_mz = 2200.00
2022-11-03 16:07:43,223 DEBUG [falcon/MainProcess] falcon.main : remove_precursor_tol = 1.50
2022-11-03 16:07:43,223 DEBUG [falcon/MainProcess] falcon.main : min_intensity = 0.01
2022-11-03 16:07:43,223 DEBUG [falcon/MainProcess] falcon.main : max_peaks_used = 500
2022-11-03 16:07:43,223 DEBUG [falcon/MainProcess] falcon.main : scaling = off
2022-11-03 16:07:43,223 WARNING [root/MainProcess] falcon.main : Working directory /Users/dulce_guillen/Documents/falcon_t1 already exists, previous results might get overwritten
2022-11-03 16:07:43,224 INFO [falcon/MainProcess] falcon._prepare_spectra : Read spectra from 51 peak file(s)
joblib.externals.loky.process_executor._RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/Users/dulce_guillen/opt/anaconda3/envs/py3/lib/python3.8/site-packages/joblib/externals/loky/process_executor.py", line 428, in _process_worker
    r = call_item()
  File "/Users/dulce_guillen/opt/anaconda3/envs/py3/lib/python3.8/site-packages/joblib/externals/loky/process_executor.py", line 275, in __call__
    return self.fn(*self.args, **self.kwargs)
  File "/Users/dulce_guillen/opt/anaconda3/envs/py3/lib/python3.8/site-packages/joblib/_parallel_backends.py", line 620, in __call__
    return self.func(*args, **kwargs)
  File "/Users/dulce_guillen/opt/anaconda3/envs/py3/lib/python3.8/site-packages/joblib/parallel.py", line 288, in __call__
    return [func(*args, **kwargs)
  File "/Users/dulce_guillen/opt/anaconda3/envs/py3/lib/python3.8/site-packages/joblib/parallel.py", line 288, in <listcomp>
    return [func(*args, **kwargs)
  File "/Users/dulce_guillen/opt/anaconda3/envs/py3/lib/python3.8/site-packages/falcon/falcon.py", line 348, in _read_spectra
    for spec in ms_io.get_spectra(filename):
  File "/Users/dulce_guillen/opt/anaconda3/envs/py3/lib/python3.8/site-packages/falcon/ms_io/ms_io.py", line 40, in get_spectra
    for spec in spectrum_io.get_spectra(filename):
  File "/Users/dulce_guillen/opt/anaconda3/envs/py3/lib/python3.8/site-packages/falcon/ms_io/mzml_io.py", line 38, in get_spectra
    yield _parse_spectrum(spectrum_dict)
  File "/Users/dulce_guillen/opt/anaconda3/envs/py3/lib/python3.8/site-packages/falcon/ms_io/mzml_io.py", line 75, in _parse_spectrum
    return sus.MsmsSpectrum(spectrum_id, precursor_mz, precursor_charge,
TypeError: __init__() takes from 6 to 7 positional arguments but 8 were given
"""

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

Traceback (most recent call last):
  File "/Users/dulce_guillen/opt/anaconda3/envs/py3/bin/falcon", line 8, in <module>
    sys.exit(main())
  File "/Users/dulce_guillen/opt/anaconda3/envs/py3/lib/python3.8/site-packages/falcon/falcon.py", line 122, in main
    buckets = _prepare_spectra()
  File "/Users/dulce_guillen/opt/anaconda3/envs/py3/lib/python3.8/site-packages/falcon/falcon.py", line 300, in _prepare_spectra
    for file_spectra in joblib.Parallel(n_jobs=-1)(
  File "/Users/dulce_guillen/opt/anaconda3/envs/py3/lib/python3.8/site-packages/joblib/parallel.py", line 1098, in __call__
    self.retrieve()
  File "/Users/dulce_guillen/opt/anaconda3/envs/py3/lib/python3.8/site-packages/joblib/parallel.py", line 975, in retrieve
    self._output.extend(job.get(timeout=self.timeout))
  File "/Users/dulce_guillen/opt/anaconda3/envs/py3/lib/python3.8/site-packages/joblib/_parallel_backends.py", line 567, in wrap_future_result
    return future.result(timeout=timeout)
  File "/Users/dulce_guillen/opt/anaconda3/envs/py3/lib/python3.8/concurrent/futures/_base.py", line 444, in result
    return self.__get_result()
  File "/Users/dulce_guillen/opt/anaconda3/envs/py3/lib/python3.8/concurrent/futures/_base.py", line 389, in __get_result
    raise self._exception
TypeError: __init__() takes from 6 to 7 positional arguments but 8 were given

My files don't have any underscore nor dots in the name (not sure if it's relevant) and the data comes from a timsTOF and was converted using the timsconvert workflow in the GNPS server. I can successfully run falcon in the server, so I know there is nothing wrong with the files. I wanted to change some of the default parameters, so I switched to command line.

I'm very new to coding and python, so I'm not sure what is the mistake and how to fix it. Any help would be greatly appreciated!! Thanks!

bittremieux commented 2 years ago

Hi Dulce, thanks for reporting this issue. The good thing is that you're using falcon correctly! This issue is not directly with falcon, but with one of its dependencies that recently underwent some incompatible changes. For you now can fix this issue by doing:

pip uninstall spectrum_utils && pip install spectrum-utils==0.3.5

Hopefully this fixes the issue. I'll update the installation instructions in the README accordingly.

dulceggm commented 2 years ago

Thanks a lot, that fixed the issue and now falcon is running perfectly!