Repository: matchms/matchms (python)

Issue:
matchms fails when reading spectra where abundance is in scientific notation
Example spectrum - spotted in the MSDial EI RI library.

Funny thing is our regex only handles lower case `e` notation while this uses upper case.

Makes me think if we shouldn't just leave the parsing of stuff to python and try to just identify the tokens based on separator?

``` tokens = re.findall(r"(\d+(?:\.\d+)?(?:e[-+]?\d+)?)", peak)```
```
NAME: C10 FAME
EXACTMASS: 186.16198
FORMULA: C11H22O2
ONTOLOGY: Fatty acid methyl esters
INCHIKEY: YRHYCMZPEVDGFQ-UHFFFAOYSA-N
SMILES: CCCCCCCCCC(=O)OC
RETENTIONINDEX: 1325
IONMODE: Positive
INSTRUMENTTYPE: GC-EI-TOF
COMMENT: DB#=FiehnLibVolatile0005; origin=Volatile Fiehn Library for Metabolic Profiling
Num Peaks: 169
30	0.629467
31	1.545269
33	0.272632
36	0.02421
37	0.313882
38	0.539016
39	17.716311
40	1.915948
41	35.4716
42	9.51272
43	36.860957
44	0.788644
45	2.384747
46	0.104509
47	0.031949
48	0.035996
49	0.052609
50	0.529644
51	0.838982
52	0.365568
53	2.854753
54	1.750452
55	29.439195
56	4.268605
57	8.867918
58	0.591554
59	19.854767
60	0.49308
61	0.379342
62	0.260846
63	0.557191
64	0.08541
65	0.63394
66	0.192617
67	2.198946
68	1.443245
69	7.300356
70	1.714883
71	2.948257
72	0.322756
73	1.743069
74	100
75	9.275516
76	0.745407
77	0.361379
78	0.038481
79	0.615978
80	0.123323
81	1.452119
82	0.612854
83	3.739813
84	2.643535
85	1.788933
86	0.278383
87	44.905938
88	3.900623
89	0.580976
90	0.037416
91	0.023074
92	0.025701
93	0.21129
94	0.043806
95	0.774303
96	0.156408
97	2.040479
98	1.468662
99	0.256302
100	0.217679
101	5.157853
102	0.416331
103	0.024423
107	0.071992
108	0.018459
109	0.002485
110	0.228329
111	0.387719
112	0.390062
113	0.245724
114	0.05765
115	2.589718
116	0.396239
120	0.001136
121	0.032375
122	0.007242
123	0.027831
124	0.013561
125	0.150728
126	0.114094
127	0.07966
129	2.578359
130	0.256231
132	0.005254
135	0.102876
136	0.03486
137	0.071424
138	0.021157
139	0.314024
140	0.065886
141	2.280949
142	2.305443
143	7.497659
144	0.656233
145	0.026056
148	0.005112
152	0.034576
153	0.069223
154	0.035073
155	2.668384
156	0.291446
157	1.242179
158	0.131985
161	0.008875
163	0.018956
167	0.000213
169	0.00923
170	0.000142
171	0.011928
172	0.001704
174	0.002556
175	0.000781
182	0.003053
184	0.000284
185	0.008023
186	0.458362
187	0.050195
188	0.004189
191	0.000142
192	0.000781
195	0.000426
203	0.000284
209	0.00355
212	0.000284
214	0.000497
219	0.000213
231	0.000142
233	0.000142
234	0.000781
246	7.1E-05
249	0.00284
250	0.00142
251	0.000355
257	0.000639
263	0.000639
266	0.000213
270	0.000142
283	0.000284
295	0.000568
297	0.000355
314	0.000213
315	0.000142
321	0.000426
327	0.001207
329	0.000994
342	0.001633
348	0.000355
380	0.000142
390	0.000497
398	0.000213
401	0.006674
402	0.001775
403	0.000923
427	0.00071
455	0.000213
468	0.000355
474	0.00071
495	0.000213
496	7.1E-05
497	0.000355
500	0.000497
```

Pull request:
matchms fails when reading spectra where abundance is in scientific notation
Fixes #802

Patch:
diff --git a/matchms/importing/load_from_msp.py b/matchms/importing/load_from_msp.py
index cf7726a4..47dbedcc 100644
--- a/matchms/importing/load_from_msp.py
+++ b/matchms/importing/load_from_msp.py
@@ -109,7 +109,7 @@ def _parse_line_with_peaks(rline: str) -> Tuple[List[float], List[float], str]:
 
 def get_peak_values(peak: str) -> Tuple[List[float], List[float]]:
     """Get the m/z and intensity value from the line containing the peak information."""
-    tokens = re.findall(r"(\d+(?:\.\d+)?(?:e[-+]?\d+)?)", peak)
+    tokens = re.findall(r"(\d+(?:\.\d+)?(?:[eE][-+]?\d+)?)", peak)
     if len(tokens) % 2 != 0:
         raise RuntimeError("Wrong peak format detected!")
 


Test patch:
diff --git a/tests/importing/test_load_from_msp.py b/tests/importing/test_load_from_msp.py
index 891ac002..839b604c 100644
--- a/tests/importing/test_load_from_msp.py
+++ b/tests/importing/test_load_from_msp.py
@@ -2,7 +2,7 @@ import os
 import numpy as np
 import pytest
 from matchms import Spectrum
-from matchms.importing.load_from_msp import load_from_msp, parse_metadata
+from matchms.importing.load_from_msp import get_peak_values, load_from_msp, parse_metadata
 from tests.builder_Spectrum import SpectrumBuilder
 
 
@@ -285,3 +285,13 @@ def test_parse_metadata(input_line, expected_output):
     params = {}
     parse_metadata(input_line, params)
     assert params == expected_output
+
+
+@pytest.mark.parametrize("line, expected", [
+ ["496	7.1E-05", ([496.0], [7.1E-05])],
+ ["496	7.1e-05", ([496.0], [7.1e-05])],
+ ["85:201 86:55 87:10 88:4 89:315", ([85.0, 86.0, 87.0, 88.0, 89.0], [201.0, 55.0, 10.0, 4.0, 315.0])],
+])
+def test_get_peak_values(line, expected):
+    actual = get_peak_values(line)
+    assert actual == expected
\ No newline at end of file