Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Rust 1.82 or newer Python 3.11 or newer MIT licence

Figures — drawn by a Python renderer, pinned exactly
xy 0.0.6 numpy 1.24 or newer

Analyses, I/O and interface — from crates.io, at the versions Cargo.lock resolves
egui 0.35 eframe 0.35 arrow-array 56.2 parquet 56.2 rayon 1.12 ndarray 0.16 kiddo 5.3 delaunator 1.1 clap 4.6 serde 1.0 proptest 1.11

MOSNA Enhanced — MOSNA and Tysserand reimplemented in Rust

Spatial network construction and analysis for spatial omics: a native application that reconstructs a spatial network per sample, measures which cell types sit next to which, and groups neighbourhoods into spatial niches.

Architecture

MOSNA Enhanced reimplements in Rust the algorithms of two Python tools from PancaldiLAB, Tysserand and MOSNA, and runs them as one native program, with no Python scientific stack:

Step Algorithms from Rust
1 — spatial networks (Delaunay, kNN, edge trimming) Tysserand mosna-core::geometry
2 — assortativity (mixing matrices, permutation null, z-scores) MOSNA mosna-core::assortativity
3 — niches (neighbourhood aggregation, UMAP, GMM / Leiden / spectral) MOSNA mosna-core::{nas, reduction, clustering, niches}

Around this scientific core, mosna-pipeline runs the three steps, mosna-config and mosna-io read the configuration and the tables, and mosna-cli and mosna-gui are the command line and the interface. Python is only used to draw the figures: mosna-xy describes each one, and the xy renderer in python/ draws it.

Install

Windows Linux (and macOS)
installer INSTALLATION.exe, double-clicked ./install.sh, in a terminal
prerequisites none, it installs what is missing Rust 1.82+, a C compiler, Python 3.11+
installed into %LOCALAPPDATA%\Programs\MOSNA ~/.local (or --prefix)
first install 20 to 40 minutes a few minutes

Both build MOSNA from the sources, then hand over to the same installer, mosna-install, so the result is the same on both: the mosna and mosna-gui binaries, the starting configuration, the icon, a desktop shortcut and an application menu entry, and — unless the figures are left out — a Python environment of its own for the figure renderer. Nothing is written into the Python you work in.

Each installer then deletes the other's: once installed, INSTALLATION.exe removes install.sh and install.sh removes INSTALLATION.exe and UNINSTALL.exe, so an installed folder only keeps the files for its own system.

Windows — INSTALLATION.exe

  1. Download the repository: Code → Download ZIP, then right-click the ZIP → Extract all. INSTALLATION.exe does not work from inside the ZIP: it has to sit in the extracted folder, next to Cargo.toml.
  2. Open the extracted folder and double-click INSTALLATION.exe.
  3. A window asks for:
    • the folder to put MOSNA in — by default MOSNA_Enhanced in your user folder (C:\Users\<you>\MOSNA_Enhanced), since Downloads is no place to keep it. A folder picked with Parcourir… receives a MOSNA_Enhanced folder inside it; it must be empty, new, or an earlier copy of MOSNA;
    • a desktop shortcut — ticked by default; the Start Menu entry is written either way;
    • the figures module (Python, about 85 MB) — ticked by default.
  4. Click Installer. The window then:
    1. moves the folder to the chosen place (the downloaded copy is removed);
    2. installs what is missing, each only if it is not already there: the Microsoft C++ build tools (several GB, the longest step — Windows asks once for administrator rights), Rust, and Python 3.12 when the figures are wanted. It uses winget and falls back to the official installers;
    3. compiles MOSNA (10 to 20 minutes the first time);
    4. installs it into %LOCALAPPDATA%\Programs\MOSNA, with the shortcuts;
    5. deletes install.sh.
  5. At the end, Lancer MOSNA opens the interface. Afterwards, start it from the desktop shortcut or the Start Menu.

Leave the window open until it says so: it cannot be closed while installing. Everything it prints is also kept in %TEMP%\mosna-install.log, which is the file to look at, or to send, when something fails.

To update, download and extract the new version and run its INSTALLATION.exe, choosing the folder MOSNA is already in. The window recognises the earlier copy and offers Mettre à jour et installer: your results and your configuration are kept, only MOSNA's own files are replaced. What is already installed (build tools, Rust, Python) is not reinstalled, and the build reuses the previous one, so an update is much faster.

To uninstall, double-click UNINSTALL.exe in MOSNA's folder. It always removes MOSNA, its shortcuts and its figures environment, and the build (target\, several GB); your configuration is kept. It also offers to remove:

  • the C++ build tools, Rust and Python 3.12, each one found on the machine. Those INSTALLATION.exe installed itself are ticked: it writes them down in .mosna-prerequisites, at the root of the folder. The others are left unticked, since other software may use them. Removing the build tools asks for administrator rights, and leaves the Visual Studio Installer itself, to be removed from Settings → Apps if nothing else needs it.
  • the MOSNA folder itself, unticked: it holds whatever you put there, results included.

Its log is kept in %TEMP%\mosna-uninstall.log. To remove MOSNA alone from a terminal instead:

target\release\mosna-install.exe --uninstall

The command line is installed but not added to the PATH; from a terminal, use %LOCALAPPDATA%\Programs\MOSNA\bin\mosna.exe.

If the window does not open at all, the message that appears is almost always about the graphics driver (no OpenGL 2): update it, then run INSTALLATION.exe again.

Linux — install.sh

What it needs, to build:

  • the Rust toolchain, 1.82 or newer — curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

  • a C compiler, and Python 3.11 or newer for the figures:

    Debian, Ubuntu, Mint sudo apt install build-essential python3 python3-venv
    Fedora, RHEL sudo dnf install gcc python3
    Arch, Manjaro sudo pacman -S base-devel python
    openSUSE sudo zypper install gcc python3

install.sh checks for all of this before it starts building, and names the command to run if something is missing — Python is only asked for when the figures are wanted.

git clone https://github.com/OwenGriere/MOSNA_Enhanced.git
cd MOSNA_Enhanced
./install.sh                     # into ~/.local, with a desktop launcher
option
--no-figures smallest install: no Python environment
--prefix /usr/local somewhere else, here for everyone (needs write access)
--no-desktop-shortcut no launcher on the desktop; the menu entry is still written
--dry-run show what would be done, without touching the disk
--uninstall remove it again — with the same --prefix, if one was given

It builds mosna, mosna-gui and mosna-install with cargo build --release, then installs:

~/.local/bin/mosna, ~/.local/bin/mosna-gui the command line and the interface
~/.local/share/mosna/ the starting configuration, and the figures' environment, venv/
~/.local/share/applications/, the desktop the launchers, with the icon

and, once the install has succeeded, deletes INSTALLATION.exe and UNINSTALL.exe (not on --dry-run, --uninstall or --help). If ~/.local/bin is not on your PATH, which some distributions do not do, the installer says so and gives the full path to the interface.

Run next to already-built binaries — the mosna-linux-x86_64.tar.gz of a release, unpacked — the same script compiles nothing and needs no Rust nor C compiler.

The graphical interface needs a running desktop session — X11 or Wayland, either is fine; on a headless machine the mosna command line still works in full. MOSNA_PYTHON overrides the interpreter used for the figures, which is what to set when working from a checkout against an environment of your own.

How much it weighs

size needed for
mosna and mosna-gui 38 MB everything
Python environment (xy, numpy) ~85 MB the figures only

The analyses are Rust and depend on no scientific stack; the figures are drawn by xy, a Python charting library, which is the only reason Python is needed. --no-figures (or unticking the figures module on Windows) skips the second row: the analyses then run exactly as before and write all of their tables; only the images are left undrawn, and each run says so instead of failing. Installing the renderer later draws the figures the next run produces.

The full instructions are also in the manual, inside the interface: Viewer → Documentation → Installation.

Use

mosna-gui                        # the interface
mosna --help                     # the command line, for scripts and clusters

Every figure is written twice: a PNG, which is what the interface's gallery shows, and an HTML chart beside it, which is the same figure with its axes live — pan, zoom, and the value of a cell under the pointer.

Generate report gathers all of them into report.html at the root of the working directory. One tab per analysis; inside each, the cohort's figures first and then a patient at a time; a search box that filters by patient, sample or file name; and thumbnails that open full size, where the chart zooms and pans as it does on its own. A fourth tab lists everything else in the directory. It references the figures rather than copying them, so a report of five hundred figures is six hundred kilobytes and travels with the folder.

The command line runs the same steps the interface's buttons do:

mosna tysserand-network --file CONFIG/configuration.yaml --working_dir /data/run
mosna assortativity     --file CONFIG/configuration.yaml --working_dir /data/run
mosna niche-analysis    --file CONFIG/configuration.yaml --working_dir /data/run
mosna generate-report                                    --working_dir /data/run
mosna clear-temporary                                    --working_dir /data/run

The last two take no configuration: they act on a directory that already exists, which is what lets them be run on results copied off a cluster.

Benchmark

To come.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages