Skip to content
Open
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
d343ff5
read flashdeconv using exe requires external installation of openms a…
trishorts Apr 9, 2026
93cb498
Merge branch 'master' into realFlashDecon
trishorts Apr 10, 2026
c454acf
Merge branch 'master' into realFlashDecon
trishorts Apr 30, 2026
27b2b2d
fix(decon): address PR #1045 review findings on RealFLASHDeconvolution
trishorts Apr 30, 2026
477fd63
Merge remote-tracking branch 'upstream/master' into realFlashDecon
trishorts Apr 30, 2026
ebac8ef
Merge branch 'master' into realFlashDecon
trishorts Apr 30, 2026
abd4e67
Merge branch 'master' into realFlashDecon
trishorts Apr 30, 2026
6329f72
Merge branch 'master' into realFlashDecon
trishorts Apr 30, 2026
8792de9
implement ToDecoyParameters on RealFLASHDeconvolutionParameters
trishorts May 1, 2026
b4c6f05
cover RealFLASHDeconvolution parser/file-guard error paths
trishorts May 1, 2026
2404580
cover DeconvoluteWithDecoys null-decoy guard
trishorts May 1, 2026
47cbfc0
refactor(decon): make RealFLASHDeconvolutionAlgorithm unit-testable
trishorts May 1, 2026
d194d06
tighten RealFLASHDeconvolution test assertions and fill parser gaps
trishorts May 1, 2026
d639fdf
cache validated FLASHDeconv exe paths to skip per-scan syscalls
trishorts May 1, 2026
9975a5e
refactor(decon): move FLASHDeconv exe discovery out of the algorithm
trishorts May 11, 2026
26b0ad8
test(decon): add registry cache + explicit-path Resolve coverage
trishorts May 11, 2026
2341760
fix(decon): tighten FlashDeconvExePathRegistry.Register validation
trishorts May 11, 2026
97e1324
Merge branch 'master' into realFlashDecon
trishorts May 11, 2026
16b1c96
top down snip added to deconvolution development
trishorts May 12, 2026
41c1c60
Merge branch 'master' into realFlashDecon
nbollis Jun 18, 2026
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
using System;
using System.Collections.Concurrent;
using System.IO;

namespace MassSpectrometry
{
/// <summary>
/// Static registry of validated FLASHDeconv executable paths.
///
/// Each <see cref="Deconvoluter.Deconvolute(MzSpectrum, DeconvolutionParameters, MzLibUtil.MzRange)"/>
/// call constructs a fresh <see cref="RealFLASHDeconvolutionAlgorithm"/>, and
/// resolving the FLASHDeconv exe path costs File.Exists syscalls (the explicit
/// path, plus a walk of well-known paths and the PATH env var on misses).
/// On a per-scan hot path that's a few-hundred-ms stack of redundant syscalls
/// per minute. The exe doesn't move between calls, so first-call validation
/// is enough -- this registry caches the resolved path so subsequent calls
/// skip the filesystem.
///
/// Production callers that know the path up front (typically MetaMorpheus via
/// <c>GlobalSettings.FLASHDeconvExecutablePath</c>) should call
/// <see cref="Register"/> once at startup. Ad-hoc callers don't have to do
/// anything: the algorithm caches lazily on first resolution either way.
/// </summary>
public static class FlashDeconvExePathRegistry
{
// Sentinel key for "no explicit path was supplied; this is the result of
// walking the well-known list + PATH". A real path string can never collide
// with this because the inner '<' / '>' aren't legal in filesystem paths.
internal const string DefaultSearchSentinel = "<default-search>";

private static readonly ConcurrentDictionary<string, string> _validated
= new ConcurrentDictionary<string, string>();

/// <summary>
/// Validate the given exe path once and cache it so subsequent
/// deconvolution calls skip the filesystem check.
/// </summary>
/// <exception cref="ArgumentException">path is null/whitespace.</exception>
/// <exception cref="FileNotFoundException">path does not exist on disk.</exception>
public static void Register(string path)
{
if (string.IsNullOrWhiteSpace(path))
throw new ArgumentException("Path must be a non-empty string.", nameof(path));
if (!File.Exists(path))
Comment thread
nbollis marked this conversation as resolved.
throw new FileNotFoundException(
$"FLASHDeconv not found at: {path}", path);
_validated[path] = path;
}

/// <summary>
/// Number of entries currently cached. Useful for tests that want to
/// assert registration happened without depending on internal state.
/// </summary>
public static int Count => _validated.Count;

/// <summary>
/// Forget every cached path. Test-only -- production code has no reason
/// to clear because validation is permissive (a stale cached entry just
/// pushes the actual existence check to Process.Start, which surfaces
/// the same failure with a clear error).
/// </summary>
internal static void Clear() => _validated.Clear();

/// <summary>
/// Look up a previously-validated resolution. Key is the explicit path
/// string, or the default-search sentinel when <paramref name="explicitPath"/>
/// is null/whitespace (i.e. the caller wants the algorithm to search
/// well-known paths + PATH itself).
/// </summary>
internal static bool TryGet(string? explicitPath, out string resolved)

Check warning on line 70 in mzLib/MassSpectrometry/Deconvolution/Algorithms/FlashDeconvExePathRegistry.cs

View workflow job for this annotation

GitHub Actions / build

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
{
string key = string.IsNullOrWhiteSpace(explicitPath)
? DefaultSearchSentinel
: explicitPath!;
return _validated.TryGetValue(key, out resolved!);
}

/// <summary>
/// Cache a resolution that has already been validated (typically by the
/// algorithm's own resolve pass). Keyed identically to
/// <see cref="TryGet"/>: explicit path or default-search sentinel.
/// </summary>
internal static void CacheValidated(string? explicitPath, string resolved)

Check warning on line 83 in mzLib/MassSpectrometry/Deconvolution/Algorithms/FlashDeconvExePathRegistry.cs

View workflow job for this annotation

GitHub Actions / build

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
{
string key = string.IsNullOrWhiteSpace(explicitPath)
? DefaultSearchSentinel
: explicitPath!;
_validated[key] = resolved;
}
}
}
Loading
Loading