libgunshotmatch.method
¶
Methods for GunShotMatch analysis.
Classes:
Base class for methods. |
|
|
Overall GunShotMatch method. |
|
Method used for constructing an intensity matrix from a datafile. |
|
Method used for Biller-Biemann peak detection. |
|
Method used for peak filtering. |
|
Method used for peak alignment. |
|
Method used for consolidation (finding most likely identity for aligned peaks). |
|
Method parameters for the Savitzky-Golay filter. |
-
class
MethodBase
[source]¶ Base class for methods.
Methods:
from_dict
(method)Construct a
MethodBase
from a dictionary.to_dict
()Convert a
MethodBase
to a dictionary.-
classmethod
from_dict
(method)[source]¶ Construct a
MethodBase
from a dictionary.- Parameters
- Return type
-
classmethod
-
class
Method
(intensity_matrix=IntensityMatrixMethod(), peak_detection=PeakDetectionMethod(), peak_filter=PeakFilterMethod(), alignment=AlignmentMethod(), consolidate=ConsolidateMethod())[source]¶ Bases:
libgunshotmatch.method.MethodBase
Overall GunShotMatch method.
- Parameters
intensity_matrix (
IntensityMatrixMethod
) – Method used for constructing an intensity matrix from a datafile. DefaultIntensityMatrixMethod(crop_mass_range=(50, 500), savitzky_golay=SavitzkyGolayMethod(enable=True, window=7, degree=2), tophat=True, tophat_structure_size='1.5m')
.peak_detection (
PeakDetectionMethod
) – Method used for Biller-Biemann peak detection. DefaultPeakDetectionMethod(points=10, scans=1)
.peak_filter (
PeakFilterMethod
) – Method used for peak filtering. DefaultPeakFilterMethod(noise_filter=True, noise_threshold=2, base_peak_filter={73, 147}, rt_range=None)
.alignment (
AlignmentMethod
) – Method used for peak alignment. DefaultAlignmentMethod(rt_modulation=2.5, gap_penalty=0.3, min_peaks=1, top_n_peaks=80, min_peak_area=0.0)
.consolidate (
ConsolidateMethod
) – Method used for consolidation (finding most likely identity for aligned peaks). DefaultConsolidateMethod(name_filter=[], min_match_factor=600, min_appearances=-1)
.
Attributes:
Method used for peak alignment.
Method used for consolidation (finding most likely identity for aligned peaks).
Method used for constructing an intensity matrix from a datafile.
Method used for Biller-Biemann peak detection.
Method used for peak filtering.
Methods:
from_json
(json_string)Parse a
Method
from a JSON string.from_toml
(toml_string)Parse a
Method
from a TOML string.to_toml
()Convert a
Method
to a TOML string.-
alignment
¶ Type:
AlignmentMethod
Method used for peak alignment.
-
consolidate
¶ Type:
ConsolidateMethod
Method used for consolidation (finding most likely identity for aligned peaks).
-
intensity_matrix
¶ Type:
IntensityMatrixMethod
Method used for constructing an intensity matrix from a datafile.
-
peak_detection
¶ Type:
PeakDetectionMethod
Method used for Biller-Biemann peak detection.
-
peak_filter
¶ Type:
PeakFilterMethod
Method used for peak filtering.
-
class
IntensityMatrixMethod
(crop_mass_range=(50, 500), savitzky_golay=SavitzkyGolayMethod(enable=True, window=7, degree=2), tophat=True, tophat_structure_size='1.5m')[source]¶ Bases:
libgunshotmatch.method.MethodBase
Method used for constructing an intensity matrix from a datafile.
- Parameters
crop_mass_range (
Optional
[Iterable
]) – The range of masses to which the GC-MS data should be limited to. Default(50, 500)
.savitzky_golay (
Union
[bool
,SavitzkyGolayMethod
,Dict
[str
,Any
]]) – Settings for Savitzky-Golay smoothing. DefaultSavitzkyGolayMethod(enable=True, window=7, degree=2)
.tophat (
bool
) – Whether to perform Tophat baseline correction. DefaultTrue
.tophat_structure_size (
str
) – The structure size for Tophat baseline correction. Default'1.5m'
.
Attributes:
The range of masses to which the GC-MS data should be limited to.
Settings for Savitzky-Golay smoothing.
Whether to perform Tophat baseline correction.
The structure size for Tophat baseline correction.
-
crop_mass_range
¶ Type:
Optional
[Tuple
[int
,int
]]The range of masses to which the GC-MS data should be limited to.
-
savitzky_golay
¶ Type:
SavitzkyGolayMethod
Settings for Savitzky-Golay smoothing.
-
class
PeakDetectionMethod
(points=10, scans=1)[source]¶ Bases:
libgunshotmatch.method.MethodBase
Method used for Biller-Biemann peak detection.
- Parameters
Attributes:
Number of scans over which to consider a maxima to be a peak.
Number of scans to combine in a single peak from to compensate for spectra skewing.
-
class
PeakFilterMethod
(noise_filter=True, noise_threshold=2, base_peak_filter={73, 147}, rt_range=None)[source]¶ Bases:
libgunshotmatch.method.MethodBase
Method used for peak filtering.
- Parameters
noise_filter (
bool
) – Whether to perform automatic noise filtering of the peak list. DefaultTrue
.noise_threshold (
int
) – The minimum number of ions that must have intensities above the noise floor, otherwise the peak is excluded. Default2
.base_peak_filter (
Set
[int
]) – Peaks whose base peak is at one of the listed masses (m/z) are excluded. Default{73, 147}
.rt_range (
Optional
[Iterable
]) – Optional retention time range (in minutes) to filter the peak list to. DefaultNone
.
Attributes:
Peaks whose base peak is at one of the listed masses (m/z) are excluded.
Whether to perform automatic noise filtering of the peak list.
The minimum number of ions that must have intensities above the noise floor, otherwise the peak is excluded.
Optional retention time range (in minutes) to filter the peak list to.
-
base_peak_filter
¶ -
Peaks whose base peak is at one of the listed masses (m/z) are excluded.
-
class
AlignmentMethod
(rt_modulation=2.5, gap_penalty=0.3, min_peaks=1, top_n_peaks=80, min_peak_area=0.0)[source]¶ Bases:
libgunshotmatch.method.MethodBase
Method used for peak alignment.
- Parameters
rt_modulation (
float
) – Retention time tolerance parameter for pairwise alignments. Default2.5
.gap_penalty (
float
) – Gap parameter for pairwise alignments. Default0.3
.min_peaks (
int
) – Minimum number of peaks required for the alignment position to survive filtering. If set to-1
the number of repeats in the project are used. Default1
.top_n_peaks (
int
) – Number of peaks (starting with the largest) to include in the output. Default80
.min_peak_area (
float
) – Minimum area of peaks to include in the output. Default0.0
.
Attributes:
Gap parameter for pairwise alignments.
Minimum area of peaks to include in the output.
Minimum number of peaks required for the alignment position to survive filtering.
Retention time tolerance parameter for pairwise alignments.
Number of peaks (starting with the largest) to include in the output.
-
class
ConsolidateMethod
(name_filter=[], min_match_factor=600, min_appearances=- 1)[source]¶ Bases:
libgunshotmatch.method.MethodBase
Method used for consolidation (finding most likely identity for aligned peaks).
- Parameters
name_filter (
Iterable
[str
]) – List of glob-style matches for compound names. Consolidated peaks matching any of these will be excluded. Default[]
.min_match_factor (
int
) – Minimum average match factor. Consolidated peaks with an average match factor below this will be excluded. Default600
.min_appearances (
int
) – Number of times the hit must appear across the individual aligned peaks. Consolidated peaks where the most common hit appears fewer times than this will be excluded. If set to-1
the number of instances of the peak in the project are used. Default-1
.
Changed in version 0.2.0: Added the
min_appearances
argument.Attributes:
Number of times the hit must appear across the individual aligned peaks.
Minimum average match factor.
List of glob-style matches for compound names.
-
min_appearances
¶ Type:
int
Number of times the hit must appear across the individual aligned peaks.
Consolidated peaks where the most common hit appears fewer times than this will be excluded.
If set to
-1
the number of instances of the peak in the project are used.New in version 0.2.0.
-
class
SavitzkyGolayMethod
(enable=True, window=7, degree=2)[source]¶ Bases:
libgunshotmatch.method.MethodBase
Method parameters for the Savitzky-Golay filter.
New in version 0.3.0.
- Parameters
enable (
bool
) – Whether to perform Savitzky-Golay smoothing. DefaultTrue
.window (
Union
[str
,int
]) – The window size for the Savitzky-Golay filter. Either a number of scans or a must be the form'<NUMBER>s'
or'<NUMBER>m'
, specifying a time in seconds or minutes, respectively. Default7
.degree (
int
) – The degree of the fitting polynomial for the Savitzky-Golay filter. Default2
.
Attributes:
The degree of the fitting polynomial for the Savitzky-Golay filter.
Whether to perform Savitzky-Golay smoothing.
The window size for the Savitzky-Golay filter.