Release notes
v0.3.1
This release fixes solvent filtering and automatic phasing of multidimensional spectra, adds raw example data and BMRB shifts of ubiquitin, and reorganises the documentation. autoprocess now returns the real spectrum.
- Breaking:
autoprocessreturns the real spectrum (as fromrealest). Passreal=falseto keep theMulticomplexspectrum, for example to phase it further. ppm(n)returns the functionpeak -> ppm(peak, n), e.g.sort(pks; by=ppm(1)).register, the non-mutating form ofregister!, is now documented.exampledatapasses other keywords toloadfidorloadnmr, e.g.exampledata("2D_HN"; fid=true, firstpoint=Dict(T2Dim => 1.0)).- Example data.
exampledata(name; fid=true)loads the raw data of an example data set withloadfid, andexampledata(name; path=true)returns its path.3D_HNCA_pipeand3D_HNCA_ucsfare now available throughexampledata, andBMRB_ubiquitinreturns the assigned chemical shifts of ubiquitin (BMRB entry 17769), which match the ubiquitin example spectra. - Plotting FIDs.
nmrplotdraws time-domain data with an imaginary unit (an FID) as a line rather than as points. - Automatic phasing of multidimensional spectra.
estimatephaseandautophasenow estimate the phase of a dimension from 1D traces through the strongest cross peaks, pooled into one fit, instead of from a single trace summed over the other dimensions. Each trace combines the components of the other dimensions so that it does not depend on how they are phased, and ridges such as t₁ noise from residual water are left out. On the ¹H,¹⁵N example (2D_HN, with its half-dwell ¹⁵N first point unscaled) the estimates are within 4° and 13° of TopSpin's phases, where they were wrong by up to 90° before. - First-order phase search.
estimatephasesearches five times themaxdelayrange when the best fit lies at its limit, with the prior onp1widened to match, and keeps the wider result if it fits better. For indirect dimensions the defaultp1is nownothing: first-order phases of 0 and -180° (a first point half a dwell time after t = 0) are both tried. - Solvent filtering.
solventfiltertakes the digital-filter group delay into account, filtering the FID from t = 0. Previously the build-up points before t = 0 were filtered as part of the decay, which left a baseline ripple with a period of 1/(group delay) across the spectrum.method=:hsvdno longer returns NaNs for FIDs with a group delay. Whenautoprocessfilters the solvent from a 1D spectrum, it estimates the phase from the unfiltered spectrum (leaving out ±0.2 ppm around the solvent), since the solvent's dispersion tails help the estimate. - Fixes.
sumexptsno longer fails on integer (DTYPA = 0) data with non-integer weights.sumexpts,savefidandsavenmrno longer fail when the source experiment's files are read-only. - Documentation reorganised into tutorials, tools, how-to guides, concepts and reference pages, with executed examples for processing, combining experiments and BMRB peak lists, and an API reference split by topic. Docstring examples for
nucleus,Power,Peak,finddim,acqusandchannelsare now doctests, run by the test suite.
v0.3.0
This release adds loading and processing of raw time-domain data, writing of Bruker data, a new peak framework and import of assigned chemical shifts from the BMRB. It contains breaking changes, listed first.
Breaking changes
loadnmr(...; allcomponents=true)returns different numbers for the same files. Imaginary components are now conjugated relative to TopSpin's files, and for 2D data the2irand2rifiles have swapped places:2iris now the coefficient ofim1(the direct dimension) and2rithat ofim2. For 2D data the element type is unchanged, so existing code will run without error but give different results. This follows the sign convention used throughout NMRTools: spectra are the complex conjugate of TopSpin's in every imaginary unit (real parts agree), so TopSpin'sPHC0andPHC1can be passed straight tophase. Real data (the default,allcomponents=false) are unaffected.- 1D and pseudo-2D complex data are
Multicomplex.loadnmr(...; allcomponents=true)returnsMulticomplex{Float64,1,2}elements (imaginary unitim1) instead of JuliaComplexF64, as for every other NMRTools spectrum; usecomplex(spec)to convert. 3D data with all components now give tricomplex numbers; previously only four of the eight component files were used. - Loaded spectra record their imaginary units.
loadnmrsets the:mcindexof each frequency dimension (1for the direct dimension,2for the next, …), so loaded spectra can be phased, Fourier transformed back and processed like spectra produced byft. - Peaks.
SimplePeakandAbstractPeakare replaced byPeak{N}, holding a position in ppm, an intensity, a linewidth in Hz for each dimension and a label.detectpeaksreturns aVector{Peak{N}}and now works in any number of frequency dimensions. detectpeakskeywords and defaults.snr_thresholdis renamedsnr(the old name still works, with a deprecation warning, and will be removed in a future release). Negative peaks are now detected as well as positive ones by default; passsign=:positivefor the previous behaviour. Intensities are heights above the median baseline.- Dependencies. Peaks.jl, ArtifactUtils.jl and VisualRegressionTests.jl are no longer dependencies of NMRTools.
- Julia 1.10 or later is now required (previously 1.9).
- DimensionalData.jl 0.30 is now required (previously 0.29). DimensionalData 0.30 contains breaking changes of its own (see its release notes), which affect code that uses DimensionalData functions directly on
NMRData: for exampleDimensionalData.LookupArraysis nowDimensionalData.Lookups, and thertolkeyword ofAthas been removed.
Raw time-domain data
Loading and processing raw data is new, and its interface is the most likely part of the package to change in a future release.
loadfidreads Brukerfidandserfiles (1D to 3D) asMulticomplexdata, with one imaginary unit per Fourier dimension recorded in its:mcindexmetadata. It combines States, States-TPPI and echo/anti-echo quadrature, scales the t = 0 point, and keeps the digital filter's build-up points on a time axis starting before t = 0. Intensities match TopSpin's.loadnmron afidorserpath now callsloadfid.- Processing functions, each with a curried form for use with
|>:apodize,zerofill,ft(including the inverse transform),phase,extract,frequencyshift,linearpredict(forward and backward) andsolventfilter.ftremoves the digital filter's group delay with a linear phase ramp, as TopSpin and NMRPipe do.extract(F1Dim, 6.0 .. 10.0)selects a region within a pipeline. realest(spec)gives the purely real spectrum, real in every dimension, and ends a processing pipeline.realandimagact elementwise as defined by MulticomplexNumbers (removing the highest-order imaginary unit);absandcomplexare also defined.- Automatic phasing:
estimatepoles,estimatephase,autophaseandautophase0. Without a dimension argument,autophaseandautophase0phase every frequency dimension in turn (a dimension with too little signal is left unphased, with a warning). The total correction applied is recorded in each frequency dimension's:phasemetadata, and the estimate is logged at debug level. Automatic phasing is reliable for 1D spectra; for multidimensional data, and indirect dimensions in particular, check the result and set known phases withphase. autoprocesschains solvent suppression, apodization, zero-filling, Fourier transformation and automatic phasing in one step, with per-dimension settings.Cos2WindowreplacesCos²Window, which remains as an alias.CosWindow,Cos2WindowandGeneralSineWindowcan be created without a length, whichapodizethen sets from the acquisition time.
Writing data
savenmr(path, spec; procno=1)writes frequency-domain data as Bruker processed data (pdata/<procno>/1r,2rr, …).savefid(path, fid)writes time-domain data as a Brukerfidorserfile, undoing everythingloadfiddoes, soloadfid(savefid(...))round-trips.
Peaks and assignments
findpeakrefines a single peak near a given position, andfindnearestfinds the closest peak in a list.register!andregistertranslate a peak list onto a spectrum by a global search.savepeaksandloadpeaksread and write NMRAnalysis.jlpeaklist.csvfiles and Sparky lists. A peak list is also a Tables.jl table, soDataFrame(pks)works.loadbmrbreads assigned chemical shifts from an NMR-STAR file or by BMRB ID, andpeaklistbuilds peak lists from them by atom name (with residue offsets) or by nucleus.- Peak lists can be plotted with Plots (as lines in 1D, crosses in 2D) and with Makie (
nmrplotandnmrplot!), with or without a spectrum.
Pipelines
Besides the processing functions, detectpeaks, findpeak, register/register!, estimatepoles, estimatephase, reference, shiftdim, setrelaxtimes, setkinetictimes, setgradientlist, replacedimension, decimate, savenmr, savefid and savepeaks have curried forms for use with |>, for example spec |> detectpeaks(snr=20) |> savepeaks("peaklist.csv").
Other changes
- Plots: the normalisation logic of the contour and pseudo-2D recipes has been consolidated. In the recipe for several pseudo-2D datasets,
normalize=refspecpreviously divided every dataset by the reference's scale, leaving them unnormalised relative to each other; each is now divided by its own scale, as in the other recipes. An invalidnormalizevalue now throws anArgumentErrorin the 1D recipes too. - Data loading is included in the precompilation workload, reducing the time to first load.