Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ tasks:
# dashboard.rs only exists under the opt-in feature; CI only `cargo check`s it.
- cargo clippy -p timsseek_cli --features dashboard --all-targets -- -D warnings

# Keep workspace documentation warning-free.
doc:
cmds:
- RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps

todos:
cmds:
- grep -nH -R TODO rust/tims*/src
Expand Down Expand Up @@ -81,4 +86,3 @@ tasks:
desc: Stop local Koina server
cmds:
- docker stop koina-local

2 changes: 1 addition & 1 deletion rust/apex_sim/src/plots.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ impl Default for TraceToggles {
}

/// Bottom panel: the apex-finder intermediate traces, min-max normalized to
/// [0,1] so heterogeneous scales overlay legibly. Apex markers overlaid.
/// `[0,1]` so heterogeneous scales overlay legibly. Apex markers overlaid.
pub fn traces(ui: &mut egui::Ui, score: &ScoreResult, tog: &TraceToggles, true_apex: f32) {
let t = &score.traces;
let mut series: Vec<(&str, &[f32])> = Vec::new();
Expand Down
7 changes: 5 additions & 2 deletions rust/micromzpaf/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ license.workspace = true
[dependencies]
serde = { workspace = true, features = ["derive"] }
thiserror = { workspace = true }
# Used for the one-time warning when parsing drops a mass-error suffix.
tracing = { workspace = true }

# Workspace-inherited deps
rustyms = { workspace = true }
[dev-dependencies]
# Pins the string serialization format.
serde_json = { workspace = true }
52 changes: 52 additions & 0 deletions rust/micromzpaf/src/error.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
//! Why an annotation could not be parsed or represented.

use thiserror::Error;

use crate::{
CHARGE_MAX,
CHARGE_MIN,
ISOTOPE_MAX,
ISOTOPE_MIN,
};

/// Why an annotation could not be parsed or represented.
#[derive(Debug, Error)]
pub enum IonParsingError {
#[error("Ordinal {ordinal} out of range for series '{series}'")]
OrdinalOutOfRange { ordinal: u8, series: char },
#[error("Series '{series}' requires an ordinal")]
MissingOrdinal { series: char },
#[error("Series '{series}' takes no ordinal, got {ordinal}")]
UnexpectedOrdinal { series: char, ordinal: u8 },
#[error("Unsupported fragment type: '{fragment_type}'")]
UnsupportedFragmentType { fragment_type: char },
#[error("Charge cannot be 0")]
ChargeCannotBeZero,
#[error("Charge {charge} outside the representable range {CHARGE_MIN}..={CHARGE_MAX}")]
ChargeOutOfRange { charge: i8 },
#[error(
"Isotope offset {isotope} outside the representable range {ISOTOPE_MIN}..={ISOTOPE_MAX}"
)]
IsotopeOutOfRange { isotope: i8 },
#[error("Neutral loss '{loss}' is not representable")]
UnsupportedNeutralLoss { loss: String },
#[error("Immonium ions must be a bare uppercase residue, got '{annotation}'")]
UnsupportedModifiedImmonium { annotation: String },
#[error("Ran out of distinct unknown-ion labels: the 8-bit ordinal is exhausted")]
UnknownIonsExhausted,
#[error("Could not parse '{annotation}': {context}")]
ParsingError {
annotation: String,
context: &'static str,
},
}

impl IonParsingError {
/// Create a parsing error with context.
pub(crate) fn parse(annotation: &str, context: &'static str) -> Self {
Self::ParsingError {
annotation: annotation.to_string(),
context,
}
}
}
Loading
Loading