pyQms / pyqms

pyQms, generalized, fast and accurate mass spectrometry data quantification
MIT License
28 stars 9 forks source link

running the generate_quant_summary_file.py example script #5

Closed RubenRBakker closed 5 years ago

RubenRBakker commented 5 years ago

I am new to github issues so sorry in advance if my comment isn't entirely up to standards.

I have been running the example scripts and ran into a problem with the script generate_quant_summary_file.py as I got the script via github -> download zip. The error I got was:

Traceback (most recent call last): File "../generate_quant_summary_file.py", line 75, in <module> result_pkl = sys.argv[1], File "../generate_quant_summary_file.py", line 66, in main calc_amount_function = None File "/home/ruben/.local/lib/python3.6/site-packages/pyqms/results.py", line 1241, in calc_amounts_from_rt_info_file if rt < line_dict['start (min)']: #i.e. start of rt window TypeError: '<' not supported between instances of 'tuple' and 'float'

so I went to the script results.py and changed line 1241 into:

if rt[0] < line_dict['start (min)']:

NB I added the [0] also in line. Also for:

elif rt[0] > line_dict['stop (min)']:

Now the script runs without errors but the generated xml file has some columns without values, i.e. max I in window, max I in window (rt), max I in window (score), auc in window, sum I in window. Also after changing line: obj_for_calc_amount['rt'].append(rt[0])

The problem seems to be that the rt is always larger that the stop (min) column. When I print the values I also see that the rt values from line_dict['stop (min)'] are in the range of 1700 till 2500 while the rt[0] values are always around the 30 - 40.

I cannot really add my files because the file type is not supported.

Maybe the example script should be rewritten? Could also be my files.

some more information:

I work on Ubuntu 18.04.2 LTS installed pyqms via pip 19.0.3 Python 3.6.8

MKoesters commented 5 years ago

I guess the issue is that the units of retention time are different, minutes in one case and seconds in the other. '<' not supported between instances of 'tuple' and 'float' also tells me that in one case the RT is a float and in another the value and the unit. I'll try to have a look at this as soon as as possible, however I'm busy until end of next week. Maybe I can leave some tips here how to fix this.

Could you please supply the code you used for creating the pyQMS pickle, which you are trying to analyse?

RubenRBakker commented 5 years ago

Hi @MKoesters thank you for the fast response! I am not in hurry, so take your time resolving it.

I downloaded the BSA1.mzml file and the omsa file from github and ran the script parse_ident_file_and_quantify_with_carbamidomethylation.py. The pickel file that was generated was used for the next script. However I cannot attach it here because it is not supported in github so I zipped it before attaching.

BSA1.mzML_pyQms_results.zip

MKoesters commented 5 years ago

Hi Ruben,

sry, I have been away last week, I'll have a closer look at this tomorrow morning, but I think I found the bug. If you want to fix it yourself, you could try to replace the line:

scan_time = spectrum.scan_time

by:

scan_time, unit = spectrum.scan_time
if unit == 'minute':
    scan_time /= 60

Else I would test that in the next days and do a pull request myself

Best, Manuel