iSTATS 1.8 ========== New features ------------ * Added a pure R implementation of icoshift for one-dimensional spectral alignment, exposed through icoshift() and integrated into the pre-treatment screen with editable ppm intervals. * Added deterministic suggestions of alignment regions from the imported spectra, with sensitivity and optional spectrometer-frequency controls, plus an auditable plot and table before manual review. * Added distinct automatic and manual/assisted alignment workflows. Automatic mode detects and aligns atomically in one action; assisted mode supports text review plus graphical add/remove editing and records the regions actually applied. * Added a dedicated top-level Alignment section so the alignment workflows are no longer hidden inside Normalize Selection. * Alignment can now use the average spectrum or any imported sample as its reference. Sample rows are selected by index, repeated names remain unambiguous, and both automatic and assisted workflows always obtain the target from the immutable imported matrix. * The Alignment section now precedes Select and shows the imported and the aligned spectra in two comparison panels with shared regions, synchronized zoom/pan, a reset action and balanced or maximized layouts. * Select Signals has a "Suggest regions" icon button (name and help in its tooltip). It runs the alignment-region detector on the current spectra (with the detection settings of the Alignment page), outlines the proposed regions in blue on both panels and lists them as editable text; "Load suggested regions" adds them to the selection like the save button, skipping any that overlap a loaded region. * The alignment comparison and Plot Spectra are now drawn on the server as images from a per-pixel minimum/maximum envelope of the full matrix, with brush zoom, double-click reset, pan/zoom-out buttons, a hover label naming the sample, ppm and intensity, and click-to-highlight (or pin) on the curve. Zoom responses fell from about 6 s and 5 MB per panel to under 0.6 s and about 150 KB, and 'plotly' is no longer a dependency. Clicking a highlighted curve (or empty space) clears the highlight, and an "Edit regions" mouse mode lets the typed ppm intervals be resized, moved, added or removed directly on both panels, keeping the text box in sync. After an alignment, each changed endpoint shows its current value first and keeps the original applied value in parentheses; text and mouse edits update the blue proposal without recomputing spectra, and only the alignment action promotes it. An edited region loses its obsolete green outline, while new regions are blue-only and removed regions remain green-only until that action. The region audit compares original and new positions side by side. The imported matrix is kept separately (cached to a session temporary file for very large inputs), so repeated alignments never accumulate shifts. * Added package and application documentation for the alignment workflow, parameters, return values, limitations and reference. Improvements and fixes ---------------------- * Closing iSTATS now leaves the caller's R session unchanged. Application variables are isolated per Shiny session, temporary package attachments and the upload-size option are restored, and the caller's random-number state and global objects are preserved. * CSV imports now detect a trailing chemical-shift discontinuity across the individual sample axes. While any final ppm value is greater than its predecessor, the importer counts and removes that trailing column from both the axes and intensity matrix, and reports the number of removed columns. * Alignment, Plot Spectra and Select Signals now frame the visible spectral baseline near 10% above the lower panel edge. A deterministic pooled 0.1% lower quantile prevents isolated acquisition artefacts from leaving the useful spectrum floating in the middle, while the real maximum remains in view. Select Signals also keeps its plot ranges separate from pre-treatment state, so imports and zooms in another screen cannot overwrite its frame. * The application now resolves the alignment engine from the package namespace, so alignment does not depend on attaching `iSTATS` to the app environment. * Reduced peak-selection memory use by avoiding the full point-by-point correlation matrix and streamlined the STOCSY server calculations. * STOCSY now ranks the selected points once when it starts and reuses those ranks for every Spearman correlation, instead of re-ranking the whole matrix on each hover or click. Correlation values are unchanged. * The Shapiro-Wilk check run when STOCSY or a normalization starts now tests all selected points at once, and the Spearman ranks are computed in one pass, instead of one R call per point. Results are identical to shapiro.test() and rank(); on 64K-point data the check fell from about 12 s to 0.5 s. * The STOCSY-I, STOCSY-IS and STOCSY-RT plots and both Select Signals panels are drawn in base graphics from a per-pixel envelope, like the Alignment panels, instead of ggplot. Correlated points keep their colours (red positive, green negative); selected points are shaded red in Select Signals. On 175,380-point data a STOCSY-RT hover fell from about 4 s to 0.6 s and opening STOCSY from 16.7 s to 6.6 s. The point recolouring that follows every cutoff, mode, click or hover is vectorized with identical results. * The x2/x8 and /2 and /8 intensity buttons of Select Signals now also scale the Overlap view (previously they only acted on the Average spectrum). Server code for the combined "PearSpear" correlation mode, unreachable since iSTATS 1.3 removed it from the interface, was deleted. * STOCSY colours no longer depend on which classes happen to be present (ggplot assigned the palette in order, so a plot without positive correlations showed uncorrelated points in red). STOCSY-RT now applies the horizontal part of a brush zoom, which it previously ignored. STOCSY plot downloads draw the plot they belong to (they saved the last ggplot drawn), and the STOCSY-IS download uses its own file type and name. * The normality notice shown when STOCSY or a normalization starts now reports the share of selected points that the Shapiro-Wilk test does not reject as normal (p > 0.05). Before, it counted the rejected points as "normalized" (98.28% on the 64K example instead of 1.72%). The notice no longer offers to normalize the selection; the green/red marks in Normalize Selection follow the corrected rule. * Prevented STOCSY-I correlation-mode events from reading cutoff values before the range slider has initialized in a new browser session. * Corrected automatic vertical framing in STOCSY-I, STOCSY-IS and STOCSY-RT. The limits now follow the trace actually drawn, including negative or nearly constant spectra, and reserve 10% of the panel below its minimum while preserving user-selected zoom until an explicit reset or sample change. * Preserved the joint order of sample metadata and spectra during ASC and CSV imports, including TopSpin 3.6 and 4.5 ASC exports. * Added sample identifiers and consistent labels to point and area downloads. * Area (bucket) downloads in Select Signals and Normalize Selection now work with a single selected region, instead of failing and asking for more than one. Deleting a region now also removes its area column, so later downloads stay aligned with the remaining regions, even after STOCSY or a point download reordered the selected points. Adding regions no longer duplicates the selected chemical shifts used by STOCSY and the normalization methods, and the delete handlers are registered once instead of once per selection. * Restored the higher-resolution home-page animation from iSTATS 1.3. * Made spectral alignment updates atomic and preserved matrix dimensions, sample names and the chemical-shift axis. * Region selection now responds as soon as the mouse button is released. The brush handlers on the pre-treatment, signal-selection and three STOCSY screens carried a five-second debounce inherited from 1.7, so every selection was followed by a five-second wait before the panel reacted. * CSV imports now verify that every selected file has both a chemical-shift and an intensity column before any sample name, axis or spectrum is written. A file with a single column used to abort the import halfway, after the session state had already been replaced; the affected file names are now reported and nothing is changed. * Corrected package metadata and declared imports used by the R code. * Raised the per-file upload limit from 100 MB to 500 MB, so an RData matrix with a full 256K-point spectral axis can be imported. Individual ASC/CSV sample files were already far below the previous limit. Quality assurance ----------------- * Added eleven small, reproducible regression tests for icoshift modes and helpers, automatic regions, the CSV/Shiny alignment flow, STOCSY observers, session isolation, the server-rendered spectra plots and the Select Signals region workflow. * Validated the R alignment against MATLAB references at 16K, 32K and 64K resolutions, with identical aligned matrices and shift indices.