Emit deprecatian warnings
- Exported functions that will be removed from the package, should emit a deprecation warning when called.
- Exported functions that will be made private, should check the environment of the calling function:
- If the environment of the caller is the package namespace, nothing should be done.
- Else, a deprecation warning should be emitted.
For details see https://lifecycle.r-lib.org/articles/communicate.html
This should be done with a new minor release, e.g. 1.5.0
.
Warn user if peaks in SFR
If delta is small (e.g. 1), peaks in SFR might not be filtered out. Implement this and maybe warn user about it (this is a strong indication that delta was chosen too small).
Note 23.1.2025: in Rust implementation peaks found in IGNORE-REGION are already filtered out automatically before parameter approximation AND points in IGNORE-REGIONS do not contribute to MSE and/or PRARP.
Use R-Universe for mdrb_install
Currently, mdrb_install()
always installs from source from Github. Installing from R-Univserse should be much faster, as we can install pre-compiled binary packages or at least pre-processed source bundles.
If the user chooses type = “binary”, we can also skip the checks for cargo
and rustc
.
Refactor parameter approximation
Implement Max’ parameter approximation algorithms in calc_A
, calc_lambda
and calc_w
.
Probably also solves Remove unneeded checks and Check negative A values.
Improve Sap Dataset
Sap spectra should be simulated as follows:
- Find three metabolites
mets
related to diabetes with only 1-3 peaks each. - Look up their signal centers
x0_
and halfwidthslambda_
. - Define two groups:
healthy
anddiabetes
. - Draw signal areas for each sample from a distribution. The distribution should be different for
healthy
anddiabetes
. - Draw metabolite shifts for each sample from a normal distribution.
- Apply the shifts to the signal centers.
- Simulate data as usual using
simulate_spectra
- Make sure, all of the above information is stored inside
$meta$simpar
CONDITIONAL
Improve mse_normed calculation
Do after Analyze Runtime.
In function add_return_list
:
-
Make the following part faster (or remove completely):
s <- sapply(x, function(x_i) sum(abs(A * (lambda / (lambda^2 + (x_i - w)^2))))) # takes approx. 2.2 seconds for urine_1
Return
mse_normed_raw
in addition tomse_normed
(which is calculated based ony <- spec$y_smooth
).mse_normed_raw
should be based ony <- spec$y_raw
.
Improve Get-Started vignette
Do after Add function get_si_mat.
In alignment part: add a code snippet showcasing usage of get_si_mat()
. In deconvolution part: replace generate_lorentz_curves()
with deconvolute()
.
Check negative A values
Do after Refactor parameter approximation.
Check why there are negative values for the estimated lorentz curve area A.
Remove unneeded checks
Do after Refactor parameter approximation.
Check special handling for cases with A[i] == 0 and lambda[i] == 0 in parameter approximaton. Max analyzed it and concluded that checks are not necessary. My thought: copy paste artifacts from the the w[i] == 0 check (which is wrong).
Write Deconvolution-Details Vignette
Do after Write paper.
Write Alignment Details Vignette
Do after Write paper.
BACKLOG
Test deconvolute with peak at zero ppm
It’s unclear why https://github.com/spang-lab/metabodecon/blob/v1.2.0/R/21_decon_helpers.R#L315 checks for w[i] == 0.
Assumption: it’s a bug and leads to this peak being missed. If this is the case, remove the check from the code as well.
Check spectrum type
When reading spectra, the spectrum type should be checked (1D, 2D, etc. and if ncessary an error message should be printed)
Remove ispec and idecon
Subtasks:
- Modify below functions in a way that they return a single value instead returning the full input spectrum. The assignement to the spectrum object should be done by the caller.
- Modify below functions in a way, that they don’t accept idecon objects, but only spectrum objects and/or other v1.2+ elements
- Remove the
idecon
type from the package.
Functions:
enrich_sfr(sfr, ispec)
enrich_wshw(wshw, ispec)
init_lc(ispec)
refine_lc_v14(ispec, lc$Z)
rm_water_signal(ispec, wshw, bwc)
rm_negative_signals(ispec)
smooth_signals(ispec, smopts[1], smopts[2], bwc)
find_peaks(ispec)
filter_peaks(ispec, sfr, delta, force, bwc)
fit_lorentz_curves(ispec, nfit, bwc)
Links:
Turn articles into vignettes
Make sure that all suitable articles are included as vignettes and built from scratch so they don’t take up too much space.
Improve SFR and WS defaults
Replace the default values wshw = 0.1527692
and sfr = c(11.44494, -1.8828)
in generate_lorentz_curves()
with wshw = "auto"
and sfr = "auto"
, which should be calculated as follows:
If c(11.44494, -1.8828)
is part of the ppm range, use these values, otherwise calculate them as
-
wshw = 0.01 * width(cs)
(where0.01
isround(0.007629452, 2)
and0.007629452
equals0.1527692 / 20.0236144338963
which is the width of the default WSHW dividided by the width of theurine_1
spectrum. I.e., the new calculation would give approximately the same proportion of the spectrum width as the default value.) sfr = max(cs) - c(1/6, 5/6) * width(cs)
Update expno/procno defaults
Expno and procno should use NULL as default. If NULL, the function should look for the first available expno/procno folder. If there is only one, it should use that one. If there are multiple, it should use expno=10 and procno=10. If there are multiple but no 10, it should throw an error.
Calculate mandatory SITs in as_decon2
Elements wsrm
and nvrm
are mandatory in decon2
and should therefor be calculated during as_decon2
. If additional data is needed to do this from decon0
and/or decon1
objects, add an argument that allows users to provide this information.