Rewrite of speaq::dohCluster()
, compatible with the data format returned by
'generate_lorentz_curves()' and 'gen_feat_mat()'. The function name
"dohCluster" comes from "Do Hierarchical Clustering" which is part of the
Alignment algorithm proposed by Vu et al. (2011) in
doi:10.1186/1471-2105-12-405.
Arguments
- X
Dataframe of signal intensities from all spectra as returned by
gen_feat_mat()
.- peakList
List of peak indices as returned
gen_feat_mat()
.- refInd
Number of the reference spectrum i.e. the spectrum to which all signals will be aligned to.
- maxShift
Maximum number of points a value can be moved.
- acceptLostPeak
Whether to allow the the alignment algorithm to ignore peaks that cannot easily be aligned with the reference spectrum.
- verbose
Whether to print additional information during the alignment process.
Value
A list containing two data frames Y
and new_peakList
. The first one
contains the aligned spectra, the second one contains the aligned signals of
each spectrum.
Examples
sim_subset <- metabodecon_file("bruker/sim_subset")
decons <- generate_lorentz_curves_sim(sim_subset)
feat <- gen_feat_mat(decons)
refObj <- speaq::findRef(feat$peakList)
hclObj <- dohCluster(
X = feat$data_matrix,
peakList = feat$peakList,
refInd = refObj$refInd,
maxShift = 100,
acceptLostPeak = TRUE,
verbose = TRUE
)
#>
#> --------------------------------
#> dohCluster will run with maxShift= 100
#> If you want dohCluster to detect the optimal maxShift automatically,
#> use dohCluster(..., maxShift = NULL, ...)
#> --------------------------------
#>
#> aligning spectrum 1
#> Median pearson correlation of aligned spectra: 0.9977171
#> Alignment time: 2e-04 minutes
str(hclObj, 1)
#> List of 2
#> $ Y : num [1:2, 1:2048] 0.0122 0.0105 0.0122 0.0106 0.0122 ...
#> $ new_peakList:List of 2