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: OutputConfigImplementations§
Source§impl KothConfig
impl KothConfig
Sourcepub fn from_toml(path: &Path) -> Result<KothConfig, Error>
pub fn from_toml(path: &Path) -> Result<KothConfig, Error>
Examples found in repository?
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
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}Sourcepub fn to_toml_string(&self) -> Result<String, Error>
pub fn to_toml_string(&self) -> Result<String, Error>
Examples found in repository?
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}Sourcepub fn ms2_hills(&self) -> HillsConfig
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
impl Clone for KothConfig
Source§fn clone(&self) -> KothConfig
fn clone(&self) -> KothConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for KothConfig
impl Debug for KothConfig
Source§impl Default for KothConfig
impl Default for KothConfig
Source§fn default() -> KothConfig
fn default() -> KothConfig
Source§impl<'de> Deserialize<'de> for KothConfigwhere
KothConfig: Default,
impl<'de> Deserialize<'de> for KothConfigwhere
KothConfig: Default,
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<KothConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<KothConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for KothConfig
impl Serialize for KothConfig
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for KothConfig
impl RefUnwindSafe for KothConfig
impl Send for KothConfig
impl Sync for KothConfig
impl Unpin for KothConfig
impl UnsafeUnpin for KothConfig
impl UnwindSafe for KothConfig
Blanket Implementations§
impl<T> Allocation for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.