Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor prof.to.features #84

Merged
merged 166 commits into from
Aug 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
166 commits
Select commit Hold shift + click to select a range
b006c19
setup remote
wverastegui Jul 29, 2022
b099d9e
Update
wverastegui Jul 29, 2022
ae0be7d
extracted functions into top level
hechth Aug 1, 2022
e573714
Refactoring
wverastegui Aug 2, 2022
91746c2
renamed and extracted variables
hechth Aug 2, 2022
70152c6
Started adding documentation and reworked base.curve variable
Aug 2, 2022
7e93cb6
add gaussian test cases
maximskorik Aug 1, 2022
c956608
mark a bug
maximskorik Aug 1, 2022
fef6835
change variable
maximskorik Aug 1, 2022
49fa52a
remove nested conditionals
maximskorik Aug 1, 2022
10daab0
simplify argument checks
maximskorik Aug 2, 2022
af430cf
reformat conditionals
maximskorik Aug 2, 2022
2386d55
change feature-matrix var name
maximskorik Aug 2, 2022
72238de
change var name
maximskorik Aug 2, 2022
14fac74
wrap input validation
maximskorik Aug 2, 2022
678a330
wrap bandwidth preprocessing
maximskorik Aug 2, 2022
d07b3ae
add colnames; slice dataframes by colnames
maximskorik Aug 2, 2022
55ff10c
add more slicing by colname
maximskorik Aug 2, 2022
416df7f
add slicing `this.features` by colnames
maximskorik Aug 2, 2022
f70a310
rename `nrowa`
maximskorik Aug 2, 2022
573be8d
reformat oneline conditionals
maximskorik Aug 2, 2022
a4a5f97
remove redundant assignment
maximskorik Aug 2, 2022
5390232
rename undescriptive variable
maximskorik Aug 2, 2022
91c82dc
remove fallacious conditional (it's always FALSE)
maximskorik Aug 2, 2022
60119d1
Removed compute base curve function
hechth Aug 2, 2022
091ca25
remove commented out code
maximskorik Aug 2, 2022
572ebaa
Removed parallel code section from test
hechth Aug 2, 2022
145e31f
Renamed all.times to delta_rt which is the actual content of the vari…
hechth Aug 2, 2022
bc9b0c9
wrap gaussian peak computing
maximskorik Aug 2, 2022
eb24305
simplify iterable
maximskorik Aug 2, 2022
f1ac061
rename `this`
maximskorik Aug 3, 2022
16ee586
rename `nrow_this` and `this.inte`
maximskorik Aug 3, 2022
f8342d4
remove failing test case
maximskorik Aug 3, 2022
4b4863c
Added documentation for compute target times and renamed variable
hechth Aug 3, 2022
c67e22d
adjusted namespace
hechth Aug 3, 2022
dca7449
rename `this.features`
maximskorik Aug 3, 2022
35770aa
remove empty row
maximskorik Aug 3, 2022
6ccafec
index by colname
maximskorik Aug 3, 2022
72f4519
rename variables
maximskorik Aug 3, 2022
d6f1543
Revert "remove redundant assignment"
maximskorik Aug 3, 2022
c4fe18a
rename variables
maximskorik Aug 3, 2022
b46d66c
reformat with `styler`
maximskorik Aug 3, 2022
42b1de5
add more formatting
maximskorik Aug 3, 2022
0afe180
extract plotting
maximskorik Aug 3, 2022
fc7e916
add link to remote data
maximskorik Aug 3, 2022
ee6d1d2
refactored find.tol.time function
hechth Aug 3, 2022
8ced53c
Further improved documentation and removed unnecessary functions
hechth Aug 3, 2022
d520cde
Added further documentation and renamed variables
hechth Aug 4, 2022
9004c22
Fixing other test cases
hechth Aug 4, 2022
a49291d
added coments
wverastegui Aug 4, 2022
133a1bc
Finalized find.tol.time
hechth Aug 4, 2022
f7e54ab
started find.turn.point
hechth Aug 4, 2022
00ce47e
remove outcommented code
maximskorik Aug 4, 2022
e62fc9f
reformat conditionals
maximskorik Aug 4, 2022
8d899c0
reformat conditional
maximskorik Aug 4, 2022
5449b1e
rename `plot` function
maximskorik Aug 4, 2022
1550e82
refactor `compute_bounds`
maximskorik Aug 4, 2022
f4f0d3d
add built-in infinite values check
maximskorik Aug 4, 2022
dbc1be0
extract to `compute_dx`
maximskorik Aug 4, 2022
ed76ef1
remove unnecessary conditional
maximskorik Aug 5, 2022
c6e1da7
slice by colname
maximskorik Aug 5, 2022
6abf2dc
rename `rt_curve`
maximskorik Aug 5, 2022
83fcf63
extract `chr_profile` computation
maximskorik Aug 5, 2022
7071fbb
refactor input to `bigauss.mix`
maximskorik Aug 5, 2022
e81974b
more descriptive `rt_range` indexing
maximskorik Aug 5, 2022
dd5e26b
refactor `bigauss.mix`
maximskorik Aug 5, 2022
4053a31
roxygenise comments
maximskorik Aug 5, 2022
fa5141c
mark uncovered function
maximskorik Aug 5, 2022
1cc32fc
roxygenise comments
maximskorik Aug 5, 2022
6fed10d
mark uncovered function
maximskorik Aug 5, 2022
0dd4a9c
refactor `rev_cum_sum`
maximskorik Aug 5, 2022
5cc86aa
refactor bounds computation
maximskorik Aug 5, 2022
6c8d82a
rearrange `compute_dx`
maximskorik Aug 5, 2022
4707b23
use built-in func for dx computation
maximskorik Aug 5, 2022
2f50190
use element wise min function for masking
maximskorik Aug 5, 2022
957a3b9
fix wrong threshold computation
maximskorik Aug 5, 2022
126120a
add docstring
maximskorik Aug 5, 2022
fbdd303
Adapted to new combine.seq implementation
hechth Aug 5, 2022
0da9aa5
Merge branch 'refactor_prof.to.features' of https://github.com/maxims…
maximskorik Aug 5, 2022
e54f576
Merge remote-tracking branch 'origin/master' into 74_continue
hechth Aug 5, 2022
e93a9d3
Refactored find.turn.point.R
wverastegui Aug 5, 2022
91547dd
post merge cleanup
hechth Aug 5, 2022
a5f4c21
Refactored find.turn.point.R
wverastegui Aug 5, 2022
b68615b
fetch upstream recetox-aplcms
maximskorik Aug 8, 2022
1464c88
use built-in pipe
maximskorik Aug 8, 2022
e8ee226
Merge branch 'master' of https://github.com/maximskorik/recetox-aplcm…
maximskorik Aug 8, 2022
4de2598
Merge branch 'refactor_prof.to.features' of https://github.com/maxims…
maximskorik Aug 8, 2022
29c0485
extract `compute_scale`
maximskorik Aug 8, 2022
75b39a1
refactored find turn points with pastecs library
wverastegui Aug 8, 2022
0bdeaf3
final refactorings
Aug 8, 2022
824fcae
Updated changelog file
wverastegui Aug 8, 2022
821bb9a
updated variable name
hechth Aug 8, 2022
2b642b0
add return statement
maximskorik Aug 8, 2022
8e1f381
Finalized documentation
hechth Aug 8, 2022
e5cde42
Added final documentation sections.
Aug 8, 2022
8587a61
Merge branch 'master' into 77_refactor_R_aplcms
hechth Aug 8, 2022
3788061
tiny refactor
hechth Aug 8, 2022
1ae9674
mode plotting to plot.R
maximskorik Aug 8, 2022
5372762
make onliner
maximskorik Aug 8, 2022
daf8f70
move `plot_peak_summary` to plot.R
maximskorik Aug 8, 2022
0eb8d57
move another plotting to plot.R
maximskorik Aug 8, 2022
66d7879
move plotting
maximskorik Aug 8, 2022
9c3df64
reformatting
hechth Aug 9, 2022
e44e2c9
refactor sorting
maximskorik Aug 9, 2022
60086e9
add comment
maximskorik Aug 9, 2022
01ed54a
Changed test case to actually check the recovered tables
Aug 10, 2022
8beafb4
fixed typo
hechth Aug 10, 2022
4e91d2d
Adapted to tibble and properly added rows to dataframes
hechth Aug 10, 2022
5db5d2f
extracted function to compute cores and starting on fixing hybrid tes…
hechth Aug 10, 2022
d11743b
temporarily disabled two step hybrid
hechth Aug 10, 2022
215afdc
Merge branch 'master' into 74_continue
hechth Aug 10, 2022
63beaed
Merge branch 'master' of https://github.com/maximskorik/recetox-aplcm…
maximskorik Aug 10, 2022
45c120d
add compute_mu_sc from `hecht/74_continue`
maximskorik Aug 10, 2022
5d24c20
document `validate_inputs`
maximskorik Aug 10, 2022
ea72c84
document `process_bandwidth`
maximskorik Aug 10, 2022
bbeddbe
Merge branch '74_continue' of https://github.com/hechth/recetox-aplcm…
maximskorik Aug 10, 2022
7116111
resolve conflicts from `recover.weaker`
maximskorik Aug 10, 2022
9db30a3
add `compute_mu_sc_std` to `prof.to.features`
maximskorik Aug 10, 2022
503441a
rename vars
maximskorik Aug 10, 2022
d888751
try to incorporate `compute_mu_sc_std` further
maximskorik Aug 10, 2022
02df343
add documentation
maximskorik Aug 10, 2022
b3b5014
move function for plotting to utils
maximskorik Aug 10, 2022
46f5532
describe params
maximskorik Aug 10, 2022
88604a0
remove redundant param
maximskorik Aug 10, 2022
13928c8
Reformatted file and adjusted variable name
hechth Aug 11, 2022
7cd24d9
Fixed bug with vscDebugger
hechth Aug 11, 2022
9192974
Adapted function name to better reflect functionality
Aug 11, 2022
7c8c114
Adapted to new variable name
hechth Aug 11, 2022
4f3cec6
added r-httpgd package for plotting
hechth Aug 11, 2022
96c64ae
Reverted to refactored version without turnpoint(). Updated changelog…
wverastegui Aug 11, 2022
e4b9d3c
Merge branch 'master' into 77_refactor_R_aplcms
hechth Aug 11, 2022
9df570d
Update conda/environment-dev.yaml
hechth Aug 11, 2022
fa06229
Update conda/meta.yaml
hechth Aug 11, 2022
9fbe94b
document `compute_chromatographic_profile`
maximskorik Aug 11, 2022
39e45e8
document `bigauss.esti`
maximskorik Aug 11, 2022
77fea0a
add comment and remove redundant argument
maximskorik Aug 11, 2022
830932f
replace `order` with `sort`
maximskorik Aug 11, 2022
106f675
document `bigauss.mix`
maximskorik Aug 11, 2022
eefb795
extract initiation step
maximskorik Aug 11, 2022
9f73188
reuse `compute_dx`
maximskorik Aug 11, 2022
7937e44
fix `compute_mu_sc_std` usage
maximskorik Aug 11, 2022
c9932de
extract e-step computation
maximskorik Aug 11, 2022
82b49bf
document `normix`; remove unused arg
maximskorik Aug 11, 2022
852e2c9
Update DESCRIPTION
hechth Aug 12, 2022
79aa394
fixed adjust.time, feature.align and extract_features test cases
hechth Aug 12, 2022
a037131
document `normix.bic`
maximskorik Aug 12, 2022
878dd6f
add punctuation
maximskorik Aug 12, 2022
c354bdc
fixed unsupervised and hybrid test cases
hechth Aug 12, 2022
ac41bcb
add docs; add more descriptive varname
maximskorik Aug 12, 2022
ceb2927
complete `compute_gaussian_peak_shape` docs
maximskorik Aug 12, 2022
1ab7709
mark uncovered functions
maximskorik Aug 12, 2022
054f62f
Added missing function exports
hechth Aug 12, 2022
54ff3c0
add more docstrings
maximskorik Aug 12, 2022
0cfaaf4
capitalize first words of docs
maximskorik Aug 12, 2022
38bec5b
update NAMESPACE
maximskorik Aug 12, 2022
fd19277
change argname
maximskorik Aug 12, 2022
c0bd74f
change to proper argname
maximskorik Aug 12, 2022
f84f147
Merge branch '74_continue' into 77_refactor_R_aplcms
hechth Aug 16, 2022
6c7cf2f
addressed comment
hechth Aug 16, 2022
05c213a
pinned r-arrow version as 9.0.0 fails
hechth Aug 16, 2022
51fa953
moved arrange out of loop
hechth Aug 16, 2022
804f16b
reverted change
hechth Aug 16, 2022
952b7d9
Fixed extract features and unsupervised test case
hechth Aug 16, 2022
bbf3237
Fixed documentation
hechth Aug 16, 2022
8bb7965
Merge branch '77_refactor_R_aplcms' into refactor_prof.to.features
hechth Aug 16, 2022
d37acc5
Added export statements
hechth Aug 17, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- refactored `feature.align.R` [#63](https://github.com/RECETOX/recetox-aplcms/pull/63)[#88](https://github.com/RECETOX/recetox-aplcms/pull/88)
- refactored `adjust.time.R` [#64](https://github.com/RECETOX/recetox-aplcms/pull/64)
- refactored `find.tol.time.R` [#91](https://github.com/RECETOX/recetox-aplcms/pull/91)
- refactored `find.turn.point.R` [#91](https://github.com/RECETOX/recetox-aplcms/pull/91)
### Removed

## [0.9.4] - 2022-05-10
Expand Down
8 changes: 4 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ Authors@R: c(
Description: This is a customized fork of the original work from Tianwei Yu.
It takes the adaptive processing of LC/MS metabolomics data further
with focus on high resolution MS for both LC and GC applications.
Depends: R (>= 3.50), MASS, mzR, splines, doParallel, foreach, snow, dplyr,
tidyr, stringr, tibble, tools, arrow
Depends: R (>= 3.50), MASS, mzR, splines, doParallel, foreach,
snow, dplyr, tidyr, stringr, tibble, tools, arrow
biocViews: Technology, MassSpectrometry
License: GPL-2
LazyLoad: yes
NeedsCompilation: no
Suggests:
arrow, dataCompareR, testthat (>= 3.0.0)
dataCompareR, testthat (>= 3.0.0)
Config/testthat/edition: 3
RoxygenNote: 7.2.0
RoxygenNote: 7.2.1
33 changes: 28 additions & 5 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Generated by roxygen2: do not edit by hand

S3method(solve,a)
S3method(solve,sigma)
export(adaptive.bin)
export(adjust.time)
Expand All @@ -8,25 +9,36 @@ export(bigauss.esti)
export(bigauss.esti.EM)
export(bigauss.mix)
export(combine.seq.3)
export(compute_all_times)
export(compute_base_curve)
export(compute_boundaries)
export(compute_bounds)
export(compute_breaks)
export(compute_breaks_2)
export(compute_chromatographic_profile)
export(compute_delta_rt)
export(compute_densities)
export(compute_dx)
export(compute_e_step)
export(compute_end_bound)
export(compute_gaussian_peak_shape)
export(compute_initiation_params)
export(compute_mass_density)
export(compute_mass_values)
export(compute_target_time)
export(compute_mu_sc_std)
export(compute_mz_sd)
export(compute_scale)
export(compute_start_bound)
export(compute_target_times)
export(cont.index)
export(draw_chr_normal_peaks)
export(duplicate.row.remove)
export(extract_features)
export(extract_pattern_colnames)
export(feature.align)
export(find.tol)
export(find.turn.point)
export(find_local_maxima)
export(get_custom_chr_tol)
export(get_mzrange_bound_indices)
export(get_raw_features_in_mzrange)
export(get_rt_region_indices)
export(get_times_to_use)
export(hybrid)
export(increment_counter)
Expand All @@ -35,10 +47,18 @@ export(load.lcms)
export(load_data)
export(load_file)
export(make.known.table)
export(mass.match)
export(msExtrema)
export(normix)
export(normix.bic)
export(plot_chr_profile)
export(plot_normix_bic)
export(plot_peak_summary)
export(plot_raw_profile_histogram)
export(predict_mz_break_indices)
export(prep.uv)
export(preprocess_bandwidth)
export(preprocess_profile)
export(proc.cdf)
export(prof.to.features)
export(recover.weaker)
Expand All @@ -48,6 +68,7 @@ export(semi.sup)
export(sort_samples_by_acquisition_number)
export(two.step.hybrid)
export(unsupervised)
export(validate_inputs)
import(MASS)
import(arrow)
import(doParallel)
Expand All @@ -61,3 +82,5 @@ import(stringr)
import(tibble)
import(tidyr)
import(tools)
importFrom(dplyr,arrange)
importFrom(dplyr,filter)
16 changes: 2 additions & 14 deletions R/adaptive.bin.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,6 @@ compute_breaks <- function(tol, masses, intensi, weighted) {
return(breaks)
}

#' @export
compute_boundaries <- function(mass.vlys, mass.pks, j){
mass.lower <- max(mass.vlys[mass.vlys < mass.pks[j]])
mass.upper <- min(mass.vlys[mass.vlys > mass.pks[j]])

return(list(lower = mass.lower, upper = mass.upper))
}

#' @export
increment_counter <- function(pointers, that.n){
Expand Down Expand Up @@ -134,7 +127,7 @@ adaptive.bin <- function(x,
for (j in 1:length(mass.pks))
{
# compute boundaries
boundaries <- compute_boundaries(mass.vlys, mass.pks, j)
boundaries <- compute_boundaries(mass.vlys, mass.pks[j])

if (length(mass.pks) == 1){
boundaries$lower <- boundaries$lower - 1
Expand All @@ -144,12 +137,7 @@ adaptive.bin <- function(x,
that <- this_table |> dplyr::filter(mz > boundaries$lower & mz <= boundaries$upper)

if (nrow(that) > 0) {
that <- combine.seq.3(that)

if (nrow(that) != 1) {
that <- that[order(that[, 1]), ]
}

that <- combine.seq.3(that) |> dplyr::arrange_at("mz")
that.range <- diff(range(that$labels))

if (that.range > 0.5 * time_range & length(that$labels) > that.range * min.pres & length(that$labels) / (that.range / aver.time.range) > min.pres) {
Expand Down
Loading