libgunshotmatch 0.4.0__py3-none-any.whl → 0.5.0__py3-none-any.whl
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.
Potentially problematic release.
This version of libgunshotmatch might be problematic. Click here for more details.
- libgunshotmatch/__init__.py +1 -1
- libgunshotmatch/consolidate/__init__.py +6 -4
- libgunshotmatch/datafile.py +1 -0
- libgunshotmatch/method/__init__.py +2 -1
- libgunshotmatch/peak.py +14 -9
- {libgunshotmatch-0.4.0.dist-info → libgunshotmatch-0.5.0.dist-info}/METADATA +2 -2
- {libgunshotmatch-0.4.0.dist-info → libgunshotmatch-0.5.0.dist-info}/RECORD +10 -10
- {libgunshotmatch-0.4.0.dist-info → libgunshotmatch-0.5.0.dist-info}/LICENSE +0 -0
- {libgunshotmatch-0.4.0.dist-info → libgunshotmatch-0.5.0.dist-info}/WHEEL +0 -0
- {libgunshotmatch-0.4.0.dist-info → libgunshotmatch-0.5.0.dist-info}/entry_points.txt +0 -0
libgunshotmatch/__init__.py
CHANGED
|
@@ -29,5 +29,5 @@ Base library for GunShotMatch.
|
|
|
29
29
|
__author__: str = "Dominic Davis-Foster"
|
|
30
30
|
__copyright__: str = "2020-2023 Dominic Davis-Foster"
|
|
31
31
|
__license__: str = "MIT License"
|
|
32
|
-
__version__: str = "0.
|
|
32
|
+
__version__: str = "0.5.0"
|
|
33
33
|
__email__: str = "dominic@davis-foster.co.uk"
|
|
@@ -548,13 +548,15 @@ def match_counter(
|
|
|
548
548
|
aligned_peaks = []
|
|
549
549
|
consolidated_peaks = []
|
|
550
550
|
|
|
551
|
-
for
|
|
551
|
+
for idx, peak_no in enumerate(peak_numbers):
|
|
552
|
+
# idx relates to the position in the QualifiedPeak lists for each repeat.
|
|
553
|
+
# peak_no correlates to the ``peak_number`` attribute of the QualifiedPeak objects
|
|
552
554
|
row: List[Optional[QualifiedPeak]] = []
|
|
553
555
|
# for experiment in project.alignment.expr_code:
|
|
554
556
|
for experiment in qualified_peaks:
|
|
555
557
|
assert experiment is not None
|
|
556
558
|
for peak in experiment:
|
|
557
|
-
if peak.peak_number ==
|
|
559
|
+
if peak.peak_number == peak_no:
|
|
558
560
|
row.append(peak)
|
|
559
561
|
break
|
|
560
562
|
else:
|
|
@@ -648,8 +650,8 @@ def match_counter(
|
|
|
648
650
|
area_data,
|
|
649
651
|
ms_data,
|
|
650
652
|
hits=hits_data,
|
|
651
|
-
ms_comparison=ms_comp_data.loc[
|
|
652
|
-
meta={"peak_number":
|
|
653
|
+
ms_comparison=ms_comp_data.loc[peak_no],
|
|
654
|
+
meta={"peak_number": idx} # The position of the peaks in the QualifiedPeak lists
|
|
653
655
|
)
|
|
654
656
|
|
|
655
657
|
# consolidated_peak.hits = hits_data # [:n_hits]
|
libgunshotmatch/datafile.py
CHANGED
|
@@ -472,6 +472,7 @@ class Repeat:
|
|
|
472
472
|
datafile = Datafile.from_dict(d["datafile"])
|
|
473
473
|
|
|
474
474
|
peaks = PeakList(peak_from_dict(peak) for peak in d["peaks"])
|
|
475
|
+
peaks.datafile_name = datafile.name
|
|
475
476
|
|
|
476
477
|
qualified_peaks_as_list = d["qualified_peaks"]
|
|
477
478
|
if qualified_peaks_as_list is None:
|
|
@@ -148,7 +148,8 @@ class IntensityMatrixMethod(MethodBase):
|
|
|
148
148
|
#: The range of masses to which the GC-MS data should be limited to.
|
|
149
149
|
crop_mass_range: Optional[Tuple[int, int]] = attr.field(default=(50, 500), converter=convert_crop_mass_range)
|
|
150
150
|
|
|
151
|
-
|
|
151
|
+
# Whether to perform Savitzky-Golay smoothing.
|
|
152
|
+
#: Settings for Savitzky-Golay smoothing.
|
|
152
153
|
savitzky_golay: SavitzkyGolayMethod = attr.field(
|
|
153
154
|
default=SavitzkyGolayMethod(),
|
|
154
155
|
converter=_convert_sg_method,
|
libgunshotmatch/peak.py
CHANGED
|
@@ -438,7 +438,7 @@ def filter_aligned_peaks(
|
|
|
438
438
|
Filter aligned peaks by minimum average peak area, and to the top ``n`` largest peaks.
|
|
439
439
|
|
|
440
440
|
:param alignment:
|
|
441
|
-
:param top_n_peaks: Filter to the largest ``n`` peaks.
|
|
441
|
+
:param top_n_peaks: Filter to the largest ``n`` peaks. If ``0`` all peaks are included.
|
|
442
442
|
:param min_peak_area: Exclude aligned peaks with an average peak area below this threshold.
|
|
443
443
|
|
|
444
444
|
:returns: :class:`pandas.DataFrame` giving the retention times of the aligned peaks.
|
|
@@ -458,17 +458,22 @@ def filter_aligned_peaks(
|
|
|
458
458
|
area_alignment = area_alignment.sort_values(by="mean")
|
|
459
459
|
|
|
460
460
|
########
|
|
461
|
-
|
|
462
|
-
print(f"Filtering to the largest {top_n_peaks} peaks with an average peak area above {min_peak_area}")
|
|
463
|
-
|
|
464
461
|
# Get indices of largest n peaks based on `ident_top_peaks`
|
|
465
462
|
top_peaks_indices = []
|
|
466
|
-
# print("tail of area_alignment=", area_alignment.tail(top_n_peaks))
|
|
467
463
|
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
464
|
+
if top_n_peaks:
|
|
465
|
+
print(f"Filtering to the largest {top_n_peaks} peaks with an average peak area above {min_peak_area}")
|
|
466
|
+
|
|
467
|
+
# print("tail of area_alignment=", area_alignment.tail(top_n_peaks))
|
|
468
|
+
|
|
469
|
+
# Limit to the largest `ident_top_peaks` peaks
|
|
470
|
+
for peak_no, areas in area_alignment.tail(top_n_peaks).iterrows():
|
|
471
|
+
# Ignore peak if average peak area is less then min_peak_area
|
|
472
|
+
if areas["mean"] >= min_peak_area:
|
|
473
|
+
top_peaks_indices.append(peak_no)
|
|
474
|
+
|
|
475
|
+
else:
|
|
476
|
+
for peak_no, _ in area_alignment.iterrows():
|
|
472
477
|
top_peaks_indices.append(peak_no)
|
|
473
478
|
|
|
474
479
|
# Remove peaks from rt_alignment if they are not in top_peaks_indices,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: libgunshotmatch
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.0
|
|
4
4
|
Summary: Base library for GunShotMatch.
|
|
5
5
|
Author-email: Dominic Davis-Foster <dominic@davis-foster.co.uk>
|
|
6
6
|
License: MIT
|
|
@@ -135,7 +135,7 @@ libgunshotmatch
|
|
|
135
135
|
.. |language| image:: https://img.shields.io/github/languages/top/GunShotMatch/libgunshotmatch
|
|
136
136
|
:alt: GitHub top language
|
|
137
137
|
|
|
138
|
-
.. |commits-since| image:: https://img.shields.io/github/commits-since/GunShotMatch/libgunshotmatch/v0.
|
|
138
|
+
.. |commits-since| image:: https://img.shields.io/github/commits-since/GunShotMatch/libgunshotmatch/v0.5.0
|
|
139
139
|
:target: https://github.com/GunShotMatch/libgunshotmatch/pulse
|
|
140
140
|
:alt: GitHub commits since tagged version
|
|
141
141
|
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
libgunshotmatch/consolidate/__init__.py,sha256=
|
|
1
|
+
libgunshotmatch/consolidate/__init__.py,sha256=Pj0-dJMuCxeJ-cy1wF0bhpD0iOrEXrdhMdgQ7ixPAcM,22545
|
|
2
2
|
libgunshotmatch/consolidate/_fields.py,sha256=7gPIQaFaFySLZFrIuSMjwS84WEBHxZhCNhpXATlYjVw,2691
|
|
3
3
|
libgunshotmatch/consolidate/_spectra.py,sha256=7q_xVPN_oASayLdyMDjwaBLG4maIybHCqkGhiMIO940,2343
|
|
4
|
-
libgunshotmatch/method/__init__.py,sha256=
|
|
4
|
+
libgunshotmatch/method/__init__.py,sha256=pl7QEYiAjJU8HCsFp8AjttCIFdVE1ExDG41DojukMQg,9333
|
|
5
5
|
libgunshotmatch/method/_fields.py,sha256=GQNw9GdGhy9c_-0U_31eJDTXr1sG5_t5Lh0Z_nzE0RE,5025
|
|
6
|
-
libgunshotmatch/__init__.py,sha256=
|
|
7
|
-
libgunshotmatch/datafile.py,sha256=
|
|
6
|
+
libgunshotmatch/__init__.py,sha256=GTh2VSriQPwiIcR6RYSvjQmLdRGClGLIW70xO8jPOss,1433
|
|
7
|
+
libgunshotmatch/datafile.py,sha256=sKCatM0F3fmceHQYObwgYr3EX9whKA0U2lOj-xqLt4c,16276
|
|
8
8
|
libgunshotmatch/gzip_util.py,sha256=vVGZLAhW1WmENt2kDXMY68UR72MHvsCBPaB-xCyVYbg,2250
|
|
9
|
-
libgunshotmatch/peak.py,sha256=
|
|
9
|
+
libgunshotmatch/peak.py,sha256=jbnggnM7nre-7zHCXYd-iUavR4U9JDJtV7-xji2tiKg,16488
|
|
10
10
|
libgunshotmatch/project.py,sha256=t4YLCTKA1YYeRMiaXNz1-k21wYTtidN9FJM4aN9-rbw,6474
|
|
11
11
|
libgunshotmatch/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
12
|
libgunshotmatch/search.py,sha256=whBAwZ-BH3shwJOzhZP8FSpdqBOwVqskhZJ4fSZbl8E,3091
|
|
13
13
|
libgunshotmatch/utils.py,sha256=L5jf4kf-1bD9tOolUz97V2eyHkfT7pwAerZ_IKJsFpU,4251
|
|
14
|
-
libgunshotmatch-0.
|
|
15
|
-
libgunshotmatch-0.
|
|
16
|
-
libgunshotmatch-0.
|
|
17
|
-
libgunshotmatch-0.
|
|
18
|
-
libgunshotmatch-0.
|
|
14
|
+
libgunshotmatch-0.5.0.dist-info/LICENSE,sha256=bFtJt-lyVJHV-88FeFa_r3BEOsmpna5qG2KOl9JUNfU,1064
|
|
15
|
+
libgunshotmatch-0.5.0.dist-info/METADATA,sha256=os8zts3mJrTxm72BzvpSclpYbW-MwwRxSz24Y8QDcUw,6392
|
|
16
|
+
libgunshotmatch-0.5.0.dist-info/WHEEL,sha256=3vSnEhs48RUlSXcCXKCl4DOHs_qqaP2dU3IGkMqN2oI,84
|
|
17
|
+
libgunshotmatch-0.5.0.dist-info/entry_points.txt,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
18
|
+
libgunshotmatch-0.5.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|