MZmine

repository·master·Indexed 43 days ago

https://github.com/mzmine/mzmine

An open-source, extensible software suite for mass spectrometry (MS) data processing. It supports workflows for Liquid Chromatography (LC), Gas Chromatography (GC), Ion Mobility Spectrometry (IMS), and MS Imaging (e.g., MALDI). The platform includes tools for processing module order recommendations, project metadata persistence, and support for Bruker BAF and Calibrator.ami formats via the Baf2Sql library.

Tokens
4.3K
Snippets
9
Records
23
Agent score
55%

What's inside MZmine

  1. Overview of mzmine

    master

    mzmine is an open-source software designed for mass spectrometry (MS) data processing. It provides a flexible and extendable workflow for various MS analysis types, including:

    • Liquid Chromatography (LC)
    • Gas Chromatography (GC)
    • Ion Mobility Spectrometry (IMS)
    • MS Imaging (e.g., MALDI)

    It is designed to be user-friendly and supports most MS instruments.

  2. How processing module order recommendations work

    master

    MZmine uses a recommendation system to help users place processing modules in the correct order within batch queues. Modules declare their own ordering requirements, which are validated against the complete batch before execution.

    Key Concepts:

    • Declarations: Modules use MZmineProcessingModule#getModuleOrderRecommendations() to return requirements. These are evaluated independently; one passing recommendation does not override another's violation.
    • Rules: A rule positions a module before or after a specific anchor module class.
      • before: Defines a boundary before the first match.
      • after: Defines a boundary after the last match.
    • Severity Levels:
      • MUST: High-importance recommendations.
      • SHOULD: Standard recommendations.
      • Note: Neither MUST nor SHOULD block execution; both produce confirmable warnings.
    • Applicability: A rule is only applicable if its anchor condition matches a step in the current BatchQueue. If a conditional rule has no matching anchor, it is ignored.
    • Pipeline Segments: In concatenated batches, the queue is split at data-import steps or specific chromatogram-builder steps. Rules are evaluated within these individual segments and cannot be satisfied by steps in a different segment.

    User Interface Feedback:

    • Parameter Dialogs: Recommendations are appended to the existing Message area.
    • Batch Editor: Steps with violated recommendations are marked with a positive-colored information icon. Hovering over the icon shows the validation message.
    • Execution:
      • GUI: Asks for confirmation when violations exist.
      • Headless: Logs grouped warnings and continues execution.
  3. Understanding Custom Lipid Class classes

    master

    The classes within this package are strictly for GUI-based configuration of custom lipids.

    Important Constraints:

    • These classes are used exclusively to facilitate the setup of custom lipids within the user interface.
    • They are not saved as part of parameter sets. Do not rely on these classes for reproducible workflows or automated parameter loading, as they are transient GUI-only objects.
  4. Manage JavaFX collections and UI bindings

    master

    When working with JavaFX UI components, do not replace observable lists/collections with new instances. This prevents the loss of existing bindings and listeners.

    Correct Pattern:

    1. Set a single observable list/collection to the UI component once.
    2. Update the contents of that list using the setAll method instead of assigning a new list.
    // Instead of: listProperty.set(new ArrayList<>());
    // Use:
    observableList.setAll(newItems);
  5. Understand project metadata persistence behavior

    master

    MZmine implements a mechanism to preserve the project's current metadata table across save/load cycles. This ensures that values edited or entered manually after the initial raw data import are not lost when a project is reloaded.

    Key Behaviors:

    • Snapshotting: When a project is saved, a project_metadata.tsv snapshot (in MZmine's internal metadata export format) is stored inside the zipped project file.
    • Loading Process: Upon loading, MZmine imports this snapshot after the raw data and feature lists have finished loading.
    • Backward Compatibility: Projects saved without this snapshot will continue to use the previous reconstruction behavior (re-populating metadata from original extraction settings).
    • Merging: When loading a project with the merge option enabled, the saved snapshot is merged into the project. This preserves metadata for other raw data files while ensuring the saved snapshot remains the authoritative source for its specific files.
    • Persistence Semantics:
      • Standalone projects: Embed the metadata source files referenced by their import history.
      • Referencing projects: Maintain the external path to the metadata file and will fail to load if that external file is missing.
  6. Update the JDK version in the project

    master

    To update the JDK version used for building and running the project, you must update the version definition in multiple locations:

    1. Version Catalog: Update the JDK version in libs.versions.toml.
    2. Build Configuration: Update the JDK version in convention-plugins/java-convention/build.gradle.kts.
    3. IDE Configuration (IntelliJ IDEA):
      • Open Project Structure settings.
      • Ensure the Project SDK is set to the correct JDK version.
      • Verify that all modules are configured to use the Project SDK.
  7. Install mzmine on Linux

    master

    You can install mzmine on Linux using a .deb installer. You can either download the installer manually from the GitHub releases page or use the GitHub CLI (gh) to download it directly.

    Note that mzmine packages its own Java Virtual Machine, so your local Java installation will not affect it. Some Linux environments may require additional dependencies like xdg-utils or graphics libraries.

    # Option 1: Using GitHub CLI (gh)
    # gh auth login
    # sudo apt install gh
    # gh release download --repo mzmine/mzmine --pattern "mzmine*.deb"
    
    # Option 2: Using wget
    wget https://github.com/mzmine/mzmine/releases/download/text-action-release/mzmine_4.3.1_amd64.deb
    
    # Install dependencies and mzmine
    sudo mkdir -p /usr/share/desktop-directories/
    sudo apt install mzmine*.deb
    
    # Potential required dependencies
    # sudo apt-get install xdg-utils libgl1 libgtk-3-0 libxtst6
    
    # Run mzmine and print help
    /opt/mzmine/bin/mzmine -help
  8. Use existing factories for GUI and charts

    master

    When developing graphical user interfaces or charts within the MZmine ecosystem, reuse existing factory implementations to ensure consistency:

    • For GUI components: Use factory classes located in io.github.mzmine.javafx.components.util or io.github.mzmine.javafx.components.factories.
    • For charts: Check io.github.mzmine.gui.chartbasics.simplechart for appropriate chart, dataset, or renderer implementations before creating new ones.
  9. Cleanup macOS Signing Environment

    master

    To remove the temporary signing keychain and unset the environment variables used during the build process, run the following commands:

    security delete-keychain mzmine-signing.keychain-db
    unset MACOS_APP_IDENTITY_ID MACOS_APP_SPECIFIC_PWD MACOS_APP_IDENTITY_TEAM_ID
  10. Follow MZmine code style and annotation standards

    master

    To maintain codebase consistency, adhere to the following coding standards:

    • Annotations: Always add @Nullable and @NotNull annotations (using JetBrains annotations) to method parameters and return values.
    • Immutability: Mark variables as final if they do not change.
    • Control Flow: Use exhaustive switch statements when pattern matching on enums or sealed interfaces.
    • Logging: Use java.util.Logger for all logging requirements.
    • Structure: Prefer separate files over nested classes.
    • Imports: Never use static imports for static method access. Import the class itself and qualify the call with the class name (e.g., ClassName.methodName()).