michaelmarty / UniDec

Universal Deconvolution of Mass and Ion Mobility Spectra
Other
60 stars 19 forks source link

Could not import data reader: unidectools #53

Closed animesh closed 3 years ago

animesh commented 3 years ago

I am trying to create a script to call UniDec

import unidec
file_name="210112__solveig_AN0.raw.intensityThreshold1000.PPM10.errTolDecimalPlace3.Time20210128191052.MS.txt"
folder="F:/SK/"
eng=unidec.UniDec()
eng.open_file(file_name, folder)
eng.process_data()
eng.run_unidec(silent=True)
eng.pick_peaks()

but getting following error

Could not import data reader: unidectools

UniDec Engine v.4.4.0

UniDec Path: C:\Python385\lib\unidec_bin\UniDec.exe
Opening File:  F:/SK/210112__solveig_AN0.raw.intensityThreshold1000.PPM10.errTolDecimalPlace3.Time20210128191052.MS.txt
Header Length: 1
Loading Time: 13s
Linear False
Data Prep Time: 10s
UniDec Run Error: 3221225477
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-1-b1753304cd2e> in <module>
      6 eng.process_data()
      7 eng.run_unidec(silent=True)
----> 8 eng.pick_peaks()

~\GD\scripts\unidec.py in pick_peaks(self)
    431         self.export_config()
    432         # Detect Peaks and Normalize
--> 433         peaks = ud.peakdetect(self.data.massdat, self.config)
    434         if len(peaks) > 0:
    435             self.setup_peaks(peaks)

C:\Python385\lib\unidec_modules\unidectools.py in peakdetect(data, config, window, threshold)
   1658     peaks = []
   1659     length = len(data)
-> 1660     maxval = np.amax(data[:, 1])
   1661     for i in range(0, length):
   1662         if data[i, 1] > maxval * threshold:

IndexError: too many indices for array

must mention that i did a brute force-installation git clone https://github.com/michaelmarty/UniDec followed by move unidec* folder/py scripts to lib, probably that is the issue? What is the proper way to install? I did try

pip install pymzml 
pip install natsort 
pip install unidec 

without success...

michaelmarty commented 3 years ago

Hi @animesh, Take a look at this tutorial for how to install the source code: https://github.com/michaelmarty/UniDec/wiki/Installing-the-UniDec-Source-Code. Thanks, MTM