Skip to main content

FileConfig

Struct FileConfig 

Source
pub struct FileConfig {
Show 41 fields pub mz_tolerance: f64, pub mz_tolerance_type: ToleranceType, pub im_tolerance: f64, pub im_tolerance_type: ImToleranceType, pub global_min_mz: f64, pub global_max_mz: f64, pub intensity_coverage: f64, pub n_threads: Option<usize>, pub bruker_filter_mz_half_width: u32, pub bruker_filter_max_internal_gap: usize, pub polarity: Polarity, pub bruker_filter_min_feature_length: usize, pub bruker_filter_min_window_intensity: u64, pub bruker_filter_min_feature_intensity: u64, pub bruker_filter_num_iterations: usize, pub bruker_watershed_box_scan: u32, pub bruker_watershed_box_mz_idx: u32, pub bruker_watershed_min_seed_intensity: u64, pub bruker_watershed_min_centroid_total: u64, pub bruker_watershed_max_tof_offset: u32, pub bruker_noise_sigma: Option<f64>, pub bruker_mobility_scale: MobilityScale, pub bruker_streaming: bool, pub bruker_halo: bool, pub bruker_halo_peak_fraction: f64, pub bruker_halo_mz_idx_half_width: u32, pub bruker_halo_scan_half_width: usize, pub bruker_ms1_polygon: bool, pub bruker_ms1_polygon_mz_pad: f64, pub bruker_ms1_polygon_im_pad: f64, pub bruker_ms1_polygon_overlap: bool, pub bruker_ms1_polygon_overlap_reach: f64, pub noise_filter_sigma: Option<f64>, pub decoy_mode: bool, pub ms2_hills_enabled: bool, pub mz_recalibration: bool, pub mz_recalibration_mz_bins: usize, pub mz_recalibration_rt_bins: usize, pub mz_recalibration_min_samples: usize, pub mz_recalibration_tol_sigma_mult: f64, pub mz_recalibration_tol_floor_ppm: f64,
}
Expand description

File-reading and shared tolerance settings.

Tolerances defined here are used by both hill detection and feature finding.

Fields§

§mz_tolerance: f64

m/z tolerance (shared by hills and features stages)

§mz_tolerance_type: ToleranceType

“ppm” or “da”

§im_tolerance: f64

Ion mobility tolerance (shared by hills and features stages)

§im_tolerance_type: ImToleranceType

“relative” (fraction of IM value) or “absolute” (1/K0 units)

§global_min_mz: f64

Discard peaks below this m/z. Defaults to 0.0 (no lower bound).

§global_max_mz: f64

Discard peaks above this m/z. Defaults to +inf (no upper bound).

§intensity_coverage: f64

Fraction of total hill intensity to retain (0.0–1.0). 1.0 = keep all.

§n_threads: Option<usize>

Number of threads (None = use all available CPUs)

§bruker_filter_mz_half_width: u32

Bruker vertical-IM filter: column half-width in TOF-index units. The filter scans each TOF column over the IM (scan) axis looking for long vertical streaks of signal; this width sets how many TOF indices to the left/right of each column are summed into the column profile.

§bruker_filter_max_internal_gap: usize

Bruker vertical-IM filter: maximum consecutive empty scans tolerated inside a kept run (morphological-close radius). Default 1.

§polarity: Polarity

Ion polarity of the acquisition, which sets how a neutral mass is recovered from an observed m/z: "positive" (the default, M + zH) or "negative" (M − zH).

Peptides are acquired in positive mode. Nucleic acids are acquired in negative mode, and getting this wrong shifts every reported massCalib by 2·z·1.00728 Da, which is 8 Da on a 4-charged oligonucleotide — large enough to defeat any downstream identification. koth does not read the polarity out of the file; set it alongside [features] isotope_model.

§bruker_filter_min_feature_length: usize

Bruker vertical-IM filter: minimum run span (gap-inclusive) in scans for a column feature to survive. Default 5.

§bruker_filter_min_window_intensity: u64

Bruker vertical-IM filter: per-scan summed-intensity floor for a scan to count as “occupied” in the column profile. 0 = keep every nonzero scan. Default 0.

§bruker_filter_min_feature_intensity: u64

Bruker vertical-IM filter: total summed intensity over the kept span (including sub-threshold cells inside gaps) required to keep a run. 0 = no floor. Default 0.

§bruker_filter_num_iterations: usize

Bruker vertical-IM filter: how many times to re-apply the filter to its own survivors. Each pass is strictly more aggressive. Default 1.

§bruker_watershed_box_scan: u32

Bruker watershed centroider: nearest-neighbour reach on the scan axis (scans). Two points farther apart than this on either axis cannot join the same group. Default 10.

§bruker_watershed_box_mz_idx: u32

Bruker watershed centroider: nearest-neighbour reach on the TOF axis (TOF indices). Default 3.

§bruker_watershed_min_seed_intensity: u64

Bruker watershed centroider: intensity floor for promoting an orphan (point with no in-box neighbour) to a new seed. Below this it is dropped without claiming territory. Default 0.

§bruker_watershed_min_centroid_total: u64

Bruker watershed centroider: drop final centroids whose summed group intensity is below this floor. Default 0.

§bruker_watershed_max_tof_offset: u32

Bruker watershed centroider: hard cap on how far (in TOF-index units) any member of a group can sit from that group’s seed. Prevents a long follower chain from creeping past the real peak edge. Default 10.

§bruker_noise_sigma: Option<f64>

Per-frame iterative MAD noise filter applied to the centroided peaks before the Bruker reader emits a Spectrum. Same algorithm as noise_filter_sigma (median + sigma * 1.4826 * MAD of the noise floor, found by iterative sigma-clipping). None (default) disables. Independent of noise_filter_sigma, which runs later on every spectrum (from any input format) during hill detection. Typical value: 3.0.

§bruker_mobility_scale: MobilityScale

1/K0 scale for Bruker .d input. "calibrated" (default since 0.10.0) converts each scan number with the run’s acquisition calibration (TimsCalibration in analysis.tdf), matching Bruker’s timsdata SDK, DataAnalysis and SDK-based tools. "linear" restores the straight line between the acquisition-range bounds that koth used up to 0.9.0 (it can be off by ~0.03 1/K0, about 2%). The conversion happens per centroid, before hills are built. No effect on mzML or Thermo input. The streaming path’s dnoise MS1 polygon gate (bruker_ms1_polygon) uses the same scale.

§bruker_streaming: bool

Use the in-process dnoise streaming API instead of the local two-stage reader. When true, each raw frame is run through dnoise’s configured stages (vertical-IM filter -> optional horizontal halo -> optional MS1 polygon -> watershed) in a single pass with no denoised .d written to disk. When false (default), the historical local path runs (vertical filter + watershed only, no halo/polygon) — this is the paper’s validated pipeline. This flag selects preprocessing, not spectrum buffering: both modes stream MS1 spectra into hill detection.

§bruker_halo: bool

Streaming path only: apply dnoise’s horizontal-halo filter after the vertical filter (removes the weak m/z halo flanking bright ions). Default true (matches the standalone dnoise MS1 pipeline). No effect unless bruker_streaming is set.

§bruker_halo_peak_fraction: f64

Streaming halo: drop a peak below this fraction of the off-column box-max reference. Default 0.15.

§bruker_halo_mz_idx_half_width: u32

Streaming halo: reference-box half-width along the TOF index. Default 80.

§bruker_halo_scan_half_width: usize

Streaming halo: reference-box half-width along the ion-mobility scan axis. Default 2.

§bruker_ms1_polygon: bool

Streaming path only: apply dnoise’s ddaPASEF MS1 selection-polygon gate, dropping MS1 points outside the run’s IMS PolygonFilter — the (m/z, 1/K0) region the acquisition method restricts precursor selection to. Signal outside it was never a fragmentation candidate (background, the singly-charged hump, out-of-range ions).

Auto-detected: a no-op on diaPASEF and on any run that stores no polygon, so enabling it cannot fail on data that has none. Default false, which matches dnoise’s own default and leaves every existing config’s output byte-identical. No effect unless bruker_streaming is set.

§bruker_ms1_polygon_mz_pad: f64

Polygon gate: m/z leniency added to each side of the polygon interior, in Th (m/z units). Isotopes run to higher m/z, so a pad keeps an edge precursor’s envelope intact. Default 0.0 (the literal polygon). koth always passes this value to dnoise, so dnoise 0.5’s own default pad (3.0 Th) does not apply.

§bruker_ms1_polygon_im_pad: f64

Polygon gate: ion-mobility leniency added to each side, in 1/K0. Default 0.0 (the literal polygon); dnoise 0.5’s own default (0.015) does not apply.

§bruker_ms1_polygon_overlap: bool

Polygon gate: keep a whole MS1 feature when any of its points lies inside the (padded) polygon, instead of gating point by point. Maps onto dnoise’s Ms1PolygonParams::overlap. Default false: koth gates point by point, because it builds features from these points itself, and keeping whole overlapping features can pull in clouds the polygon was meant to exclude (such as the singly-charged hump) when the polygon’s shape is not known. Opt in only after checking the run’s polygon.

§bruker_ms1_polygon_overlap_reach: f64

Deprecated, ignored. dnoise 0.4 cut a feature kept in overlap mode at this distance (1/K0) beyond the mobility range of its inside points; dnoise 0.5 removed the parameter and keeps the whole feature (the old 0.0, unlimited). Still parsed so existing configs load; koth-ms logs a warning when overlap mode is on and this is not 0.0.

§noise_filter_sigma: Option<f64>

Per-scan iterative sigma-clipping noise filter. When set, peaks whose intensity falls below median + sigma * (1.4826 * MAD) of the estimated noise floor are discarded before hill detection. None (default) disables the filter; a typical starting value is 3.0.

§decoy_mode: bool

Decoy mode: shuffle MS1 spectra into a random order before hill and feature finding. Destroys the chromatographic structure while preserving the per-scan peak distributions, producing a null (decoy) feature set.

§ms2_hills_enabled: bool

If true, additionally detect MS2 hills (one set of hills per precursor isolation window) from DIA mzML or diaPASEF inputs. Written to hills_ms2.{ext}. DDA inputs produce no MS2 hills.

§mz_recalibration: bool

Enable ID-free isotope-consistency m/z recalibration. A pass-1 feature detection collects the signed ppm deviation of every adjacent isotope-hill spacing from its theoretical neutron_mass / z step and bins those residuals over (m/z, RT). Pass 2 shifts the expected isotope position during chain extension by the learned per-region median offset, so isotope hills are searched for at their recalibrated location. Skipped in decoy mode (shuffled spectra carry no real signal) and when too few isotope-spacing samples are collected. Default off.

When enabled, the fixed isotope-match tolerance is additionally replaced with a region-adaptive one derived from the recalibration surface’s per-region residual spread σ: tol_ppm = clamp(tol_sigma_mult × σ(m/z,RT), tol_floor_ppm, mz_tolerance). Tightens the search window where the instrument is precise (rejecting false isotope matches) and relaxes it — never beyond mz_tolerance — where it is noisy. Only honoured for ppm tolerances. Default true.

§mz_recalibration_mz_bins: usize

Number of m/z bins in the recalibration surface. Bin extents are derived from the observed sample range. Default 20.

§mz_recalibration_rt_bins: usize

Number of RT bins in the recalibration surface. Default 8.

§mz_recalibration_min_samples: usize

Minimum residual samples a surface cell must hold before its own median is trusted; below this the cell falls back to the m/z-marginal median, then the global median. Default 50.

§mz_recalibration_tol_sigma_mult: f64

N in the region-adaptive tolerance N × σ. Default 4.0.

§mz_recalibration_tol_floor_ppm: f64

Lower bound (ppm) on the region-adaptive tolerance, so a spuriously tiny σ in a sparse region can’t collapse the window. Default 1.0.

Trait Implementations§

Source§

impl Clone for FileConfig

Source§

fn clone(&self) -> FileConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FileConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for FileConfig

Source§

fn default() -> FileConfig

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for FileConfig

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<FileConfig, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for FileConfig

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more