ms-mint 0.2.3__tar.gz → 0.2.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ms-mint-0.2.3/ms_mint.egg-info → ms-mint-0.2.4}/PKG-INFO +1 -1
- {ms-mint-0.2.3 → ms-mint-0.2.4}/ms_mint/_version.py +3 -3
- {ms-mint-0.2.3 → ms-mint-0.2.4}/ms_mint/io.py +11 -6
- {ms-mint-0.2.3 → ms-mint-0.2.4}/ms_mint/processing.py +0 -11
- {ms-mint-0.2.3 → ms-mint-0.2.4/ms_mint.egg-info}/PKG-INFO +1 -1
- {ms-mint-0.2.3 → ms-mint-0.2.4}/ms_mint.egg-info/SOURCES.txt +2 -1
- {ms-mint-0.2.3 → ms-mint-0.2.4}/ms_mint.egg-info/requires.txt +2 -0
- ms-mint-0.2.4/scripts/ms-mint-convert.py +43 -0
- {ms-mint-0.2.3 → ms-mint-0.2.4}/setup.py +7 -0
- {ms-mint-0.2.3 → ms-mint-0.2.4}/LICENSE +0 -0
- {ms-mint-0.2.3 → ms-mint-0.2.4}/MANIFEST.in +0 -0
- {ms-mint-0.2.3 → ms-mint-0.2.4}/README.md +0 -0
- {ms-mint-0.2.3 → ms-mint-0.2.4}/ms_mint/Mint.py +0 -0
- {ms-mint-0.2.3 → ms-mint-0.2.4}/ms_mint/__init__.py +0 -0
- {ms-mint-0.2.3 → ms-mint-0.2.4}/ms_mint/chromatogram.py +0 -0
- {ms-mint-0.2.3 → ms-mint-0.2.4}/ms_mint/filelock.py +0 -0
- {ms-mint-0.2.3 → ms-mint-0.2.4}/ms_mint/filters.py +0 -0
- {ms-mint-0.2.3 → ms-mint-0.2.4}/ms_mint/matplotlib_tools.py +0 -0
- {ms-mint-0.2.3 → ms-mint-0.2.4}/ms_mint/notebook.py +0 -0
- {ms-mint-0.2.3 → ms-mint-0.2.4}/ms_mint/pca.py +0 -0
- {ms-mint-0.2.3 → ms-mint-0.2.4}/ms_mint/plotly_tools.py +0 -0
- {ms-mint-0.2.3 → ms-mint-0.2.4}/ms_mint/plotting.py +0 -0
- {ms-mint-0.2.3 → ms-mint-0.2.4}/ms_mint/standards.py +0 -0
- {ms-mint-0.2.3 → ms-mint-0.2.4}/ms_mint/targets.py +0 -0
- {ms-mint-0.2.3 → ms-mint-0.2.4}/ms_mint/tools.py +0 -0
- {ms-mint-0.2.3 → ms-mint-0.2.4}/ms_mint.egg-info/dependency_links.txt +0 -0
- {ms-mint-0.2.3 → ms-mint-0.2.4}/ms_mint.egg-info/top_level.txt +0 -0
- {ms-mint-0.2.3 → ms-mint-0.2.4}/setup.cfg +0 -0
- {ms-mint-0.2.3 → ms-mint-0.2.4}/versioneer.py +0 -0
|
@@ -8,11 +8,11 @@ import json
|
|
|
8
8
|
|
|
9
9
|
version_json = '''
|
|
10
10
|
{
|
|
11
|
-
"date": "2023-
|
|
11
|
+
"date": "2023-05-09T10:35:26-0600",
|
|
12
12
|
"dirty": false,
|
|
13
13
|
"error": null,
|
|
14
|
-
"full-revisionid": "
|
|
15
|
-
"version": "v0.2.
|
|
14
|
+
"full-revisionid": "509e8d0641ce628f2c4e4fdf65a850d805427c99",
|
|
15
|
+
"version": "v0.2.4"
|
|
16
16
|
}
|
|
17
17
|
''' # END VERSION_JSON
|
|
18
18
|
|
|
@@ -16,10 +16,9 @@ from pyteomics import mzxml, mzml
|
|
|
16
16
|
|
|
17
17
|
try:
|
|
18
18
|
from pyteomics import mzmlb
|
|
19
|
-
|
|
20
19
|
MZMLB_AVAILABLE = True
|
|
21
|
-
except ImportError:
|
|
22
|
-
logging.warning("Cound not import pyteomics.mzmlb")
|
|
20
|
+
except ImportError as e:
|
|
21
|
+
logging.warning(f"Cound not import pyteomics.mzmlb:\n{e}")
|
|
23
22
|
MZMLB_AVAILABLE = False
|
|
24
23
|
|
|
25
24
|
|
|
@@ -300,7 +299,7 @@ def mzmlb_to_df__pyteomics(fn, read_only=False):
|
|
|
300
299
|
data = list(extract_mzmlb(data))
|
|
301
300
|
df = (
|
|
302
301
|
pd.DataFrame.from_dict(data)
|
|
303
|
-
.set_index(["index", "retentionTime"])
|
|
302
|
+
.set_index(["index", "retentionTime", "polarity"])
|
|
304
303
|
.apply(pd.Series.explode)
|
|
305
304
|
.reset_index()
|
|
306
305
|
.rename(
|
|
@@ -316,14 +315,20 @@ def mzmlb_to_df__pyteomics(fn, read_only=False):
|
|
|
316
315
|
|
|
317
316
|
# mzMLb starts scan index with 0
|
|
318
317
|
df["scan_id"] = df["scan_id"] + 1
|
|
319
|
-
|
|
318
|
+
|
|
320
319
|
df = df[MS_FILE_COLUMNS]
|
|
321
320
|
return df
|
|
322
321
|
|
|
323
322
|
|
|
324
323
|
def _extract_mzmlb(data):
|
|
325
|
-
cols = ["index", "ms level", "retentionTime", "m/z array", "intensity array"]
|
|
324
|
+
cols = ["index", "ms level", "polarity", "retentionTime", "m/z array", "intensity array"]
|
|
326
325
|
data["retentionTime"] = data["scanList"]["scan"][0]["scan start time"] * 60
|
|
326
|
+
if 'positive scan' in data.keys():
|
|
327
|
+
data["polarity"] = '+'
|
|
328
|
+
elif 'negative scan' in data.keys():
|
|
329
|
+
data["polarity"] = '-'
|
|
330
|
+
else:
|
|
331
|
+
data["polarity"] = None
|
|
327
332
|
return {c: data[c] for c in cols}
|
|
328
333
|
|
|
329
334
|
|
|
@@ -50,8 +50,6 @@ def process_ms1_files_in_parallel(args):
|
|
|
50
50
|
logging.error(f"process_ms1_files_in_parallel(): {e}")
|
|
51
51
|
results = pd.DataFrame()
|
|
52
52
|
|
|
53
|
-
print(len(results))
|
|
54
|
-
|
|
55
53
|
if (output_fn is not None) and (len(results) > 0):
|
|
56
54
|
append_results(results, output_fn)
|
|
57
55
|
return None
|
|
@@ -90,7 +88,6 @@ def process_ms1_file(filename, targets):
|
|
|
90
88
|
results["ms_path"] = os.path.dirname(filename)
|
|
91
89
|
results["ms_file_size"] = os.path.getsize(filename) / 1024 / 1024
|
|
92
90
|
results["peak_score"] = score_peaks(results)
|
|
93
|
-
print(results)
|
|
94
91
|
return results[MINT_RESULTS_COLUMNS]
|
|
95
92
|
|
|
96
93
|
|
|
@@ -191,14 +188,6 @@ def extract_ms1_properties(array, mz_mean):
|
|
|
191
188
|
|
|
192
189
|
projection = pd.DataFrame(array[:, [0, 2]], columns=["rt", "int"])
|
|
193
190
|
|
|
194
|
-
print("DEBUG extract_ms1_properties")
|
|
195
|
-
print(array)
|
|
196
|
-
print(array.dtype)
|
|
197
|
-
print(array.shape)
|
|
198
|
-
print(len(projection))
|
|
199
|
-
print(projection)
|
|
200
|
-
print(projection.dtypes)
|
|
201
|
-
|
|
202
191
|
projection["rt"] = projection["rt"].round(2)
|
|
203
192
|
projection["int"] = projection["int"].astype(int)
|
|
204
193
|
projection = projection.groupby("rt").max().reset_index().values
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
|
|
3
|
+
from ms_mint import io
|
|
4
|
+
from pathlib import Path as P
|
|
5
|
+
from tqdm import tqdm
|
|
6
|
+
import argparse
|
|
7
|
+
import os
|
|
8
|
+
import logging
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def convert(fn, fmt='parquet', output_directory=None):
|
|
12
|
+
|
|
13
|
+
if output_directory is None:
|
|
14
|
+
output_directory = P(fn).parent
|
|
15
|
+
|
|
16
|
+
fn_out = output_directory / P(fn).with_suffix(f".{fmt}")
|
|
17
|
+
|
|
18
|
+
if fn_out.is_file():
|
|
19
|
+
logging.error(f"File exists {fn_out}")
|
|
20
|
+
else:
|
|
21
|
+
os.makedirs(output_directory, exist_ok=True)
|
|
22
|
+
logging.info(f"{fn} --> {fn_out}")
|
|
23
|
+
|
|
24
|
+
if fmt == 'parquet':
|
|
25
|
+
io.ms_file_to_df(fn).to_parquet(fn_out)
|
|
26
|
+
elif fmt == 'feather':
|
|
27
|
+
io.ms_file_to_df(fn).to_feather(fn_out)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
if __name__ == "__main__":
|
|
32
|
+
parser = argparse.ArgumentParser()
|
|
33
|
+
parser.add_argument("-i", "--input", nargs="+", required=True)
|
|
34
|
+
parser.add_argument("-o", "--output-directory")
|
|
35
|
+
parser.add_argument("-f", "--format", choices=['parquet', 'feather'], default='parquet')
|
|
36
|
+
|
|
37
|
+
args = parser.parse_args()
|
|
38
|
+
fns = args.input
|
|
39
|
+
output_directory = args.output_directory
|
|
40
|
+
fmt = args.format
|
|
41
|
+
|
|
42
|
+
for fn in tqdm(fns):
|
|
43
|
+
convert(fn, fmt, output_directory)
|
|
@@ -31,9 +31,15 @@ install_reqs = [
|
|
|
31
31
|
"openpyxl",
|
|
32
32
|
"pyarrow",
|
|
33
33
|
"tables",
|
|
34
|
+
"h5py",
|
|
35
|
+
"hdf5plugin"
|
|
34
36
|
]
|
|
35
37
|
|
|
36
38
|
|
|
39
|
+
scripts = [
|
|
40
|
+
"scripts/ms-mint-convert.py"
|
|
41
|
+
]
|
|
42
|
+
|
|
37
43
|
config = {
|
|
38
44
|
"name": "ms-mint",
|
|
39
45
|
"version": versioneer.get_version(),
|
|
@@ -53,6 +59,7 @@ config = {
|
|
|
53
59
|
"python_requires": ">=3.8",
|
|
54
60
|
"install_requires": install_reqs,
|
|
55
61
|
"include_package_data": True,
|
|
62
|
+
"scripts": scripts
|
|
56
63
|
}
|
|
57
64
|
|
|
58
65
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|