Skip to main content

KothConfig

Struct KothConfig 

Source
pub struct KothConfig {
    pub file: FileConfig,
    pub hills: HillsConfig,
    pub hills_ms2: Option<HillsMs2Overrides>,
    pub features: FeaturesConfig,
    pub scoring: ScoringConfig,
    pub output: OutputConfig,
}

Fields§

§file: FileConfig§hills: HillsConfig§hills_ms2: Option<HillsMs2Overrides>

Optional per-field overrides for MS2 (DIA fragment) hill detection. Absent (None) ⇒ MS2 hills use [hills] verbatim (byte-identical to the pre-existing behavior). Present ⇒ MS2 hill detection inherits [hills] and applies only the fields set here. See KothConfig::ms2_hills.

§features: FeaturesConfig§scoring: ScoringConfig§output: OutputConfig

Implementations§

Source§

impl KothConfig

Source

pub fn from_toml(path: &Path) -> Result<KothConfig, Error>

Examples found in repository?
examples/validate_configs.rs (line 12)
2fn main() -> Result<(), Box<dyn std::error::Error>> {
3    for path in std::env::args().skip(1) {
4        let p = std::path::Path::new(&path);
5        if p.file_name()
6            .unwrap()
7            .to_string_lossy()
8            .starts_with("koth_align")
9        {
10            koth_ms::config::AlignConfig::from_toml(p)?;
11        } else {
12            koth_ms::config::KothConfig::from_toml(p)?;
13        }
14        println!("parsed {}", path);
15    }
16    Ok(())
17}
More examples
Hide additional examples
examples/replay_features.rs (line 35)
21fn main() -> anyhow::Result<()> {
22    let args = Args::parse();
23    rayon::ThreadPoolBuilder::new()
24        .num_threads(args.threads)
25        .build_global()?;
26    let start = Instant::now();
27    let hills = read_hills(&args.hills).context("read cached hills")?;
28    let read_s = start.elapsed().as_secs_f64();
29    for config_path in &args.config {
30        let label = config_path
31            .file_stem()
32            .context("config needs a file stem")?;
33        let out = args.output.join(label);
34        anyhow::ensure!(!out.exists(), "refusing to overwrite {}", out.display());
35        let config = KothConfig::from_toml(config_path)?;
36        let start = Instant::now();
37        let features = koth_ms::run_features(&hills, &config.features, &config.file)?;
38        let feature_s = start.elapsed().as_secs_f64();
39        let start = Instant::now();
40        let scored = koth_ms::run_scoring(
41            &features,
42            &config.scoring,
43            &config.features,
44            config.file.polarity,
45        );
46        let scoring_s = start.elapsed().as_secs_f64();
47        std::fs::create_dir_all(&out)?;
48        let start = Instant::now();
49        write_features_parquet(&scored, &out.join("features.parquet"), config.file.polarity)?;
50        let write_s = start.elapsed().as_secs_f64();
51        std::fs::write(out.join("config.toml"), config.to_toml_string()?)?;
52        let report = serde_json::json!({
53            "hills": hills.len(), "features_before_filter": features.len(),
54            "features_after_filter": scored.len(), "read_hills_s": read_s,
55            "feature_s": feature_s, "scoring_s": scoring_s, "write_s": write_s,
56            "input": args.hills, "config": config_path, "threads": args.threads,
57        });
58        std::fs::write(
59            out.join("timing.json"),
60            serde_json::to_string_pretty(&report)?,
61        )?;
62        println!(
63            "{}: {} features, detection {:.2}s, scoring {:.2}s, writing {:.2}s",
64            label.to_string_lossy(),
65            scored.len(),
66            feature_s,
67            scoring_s,
68            write_s
69        );
70    }
71    Ok(())
72}
Source

pub fn to_toml_string(&self) -> Result<String, Error>

Examples found in repository?
examples/replay_features.rs (line 51)
21fn main() -> anyhow::Result<()> {
22    let args = Args::parse();
23    rayon::ThreadPoolBuilder::new()
24        .num_threads(args.threads)
25        .build_global()?;
26    let start = Instant::now();
27    let hills = read_hills(&args.hills).context("read cached hills")?;
28    let read_s = start.elapsed().as_secs_f64();
29    for config_path in &args.config {
30        let label = config_path
31            .file_stem()
32            .context("config needs a file stem")?;
33        let out = args.output.join(label);
34        anyhow::ensure!(!out.exists(), "refusing to overwrite {}", out.display());
35        let config = KothConfig::from_toml(config_path)?;
36        let start = Instant::now();
37        let features = koth_ms::run_features(&hills, &config.features, &config.file)?;
38        let feature_s = start.elapsed().as_secs_f64();
39        let start = Instant::now();
40        let scored = koth_ms::run_scoring(
41            &features,
42            &config.scoring,
43            &config.features,
44            config.file.polarity,
45        );
46        let scoring_s = start.elapsed().as_secs_f64();
47        std::fs::create_dir_all(&out)?;
48        let start = Instant::now();
49        write_features_parquet(&scored, &out.join("features.parquet"), config.file.polarity)?;
50        let write_s = start.elapsed().as_secs_f64();
51        std::fs::write(out.join("config.toml"), config.to_toml_string()?)?;
52        let report = serde_json::json!({
53            "hills": hills.len(), "features_before_filter": features.len(),
54            "features_after_filter": scored.len(), "read_hills_s": read_s,
55            "feature_s": feature_s, "scoring_s": scoring_s, "write_s": write_s,
56            "input": args.hills, "config": config_path, "threads": args.threads,
57        });
58        std::fs::write(
59            out.join("timing.json"),
60            serde_json::to_string_pretty(&report)?,
61        )?;
62        println!(
63            "{}: {} features, detection {:.2}s, scoring {:.2}s, writing {:.2}s",
64            label.to_string_lossy(),
65            scored.len(),
66            feature_s,
67            scoring_s,
68            write_s
69        );
70    }
71    Ok(())
72}
Source

pub fn ms2_hills(&self) -> HillsConfig

Resolve the HillsConfig to use for MS2 (DIA fragment) hill detection.

When [hills_ms2] is absent this returns self.hills unchanged — the MS2 path is byte-for-byte identical to using [hills] directly. When present, MS2 hill detection inherits every [hills] value and overwrites only the fields set under [hills_ms2] (see HillsMs2Overrides).

Pipeline entry points (run_pipeline_with_ms2, run_pipeline_streaming, …) and the binary route MS2 detection through this method, so a single KothConfig drives MS1 and MS2 hill settings independently.

Trait Implementations§

Source§

impl Clone for KothConfig

Source§

fn clone(&self) -> KothConfig

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 KothConfig

Source§

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

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

impl Default for KothConfig

Source§

fn default() -> KothConfig

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

impl<'de> Deserialize<'de> for KothConfig

Source§

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

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

impl Serialize for KothConfig

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