Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
8d6f2f4
Add computeFeatureImprovement function for feature analysis
AbhirupaGhosh Mar 13, 2026
729c837
Style code (GHA)
AbhirupaGhosh Mar 13, 2026
62668b4
Implement computeFeatureScore function for feature scoring
AbhirupaGhosh Mar 23, 2026
a388841
Style code (GHA)
AbhirupaGhosh Mar 23, 2026
4098ed6
Update feature_rescoring.R
AbhirupaGhosh Jul 22, 2026
82964cc
Update feature_rescoring.R
AbhirupaGhosh Jul 22, 2026
b356109
Refactor feature scoring functions and enhance documentation for clarity
AbhirupaGhosh Jul 22, 2026
b96d438
Enhance feature rescoring by adding distinct feature subtype aggregat…
AbhirupaGhosh Jul 23, 2026
ba1faf2
Refactor buildClusterWideTable function to improve documentation and …
AbhirupaGhosh Jul 23, 2026
0b617d3
Refactor buildClusterWideTable function to streamline parameters and …
AbhirupaGhosh Jul 23, 2026
5ac44a4
Implement signal network construction and visualization functions for…
AbhirupaGhosh Jul 24, 2026
e29a80f
Refactor buildSignalNetwork function to remove unused parameter and i…
AbhirupaGhosh Jul 24, 2026
b715216
Merge branch 'main' into feature_rescoring_simple
AbhirupaGhosh Jul 24, 2026
708543a
Remove unused functions
AbhirupaGhosh Jul 24, 2026
4b9d555
Merge branch 'feature_rescoring_simple' of https://github.com/JRaviLa…
AbhirupaGhosh Jul 24, 2026
9723262
Merge branch 'main' into feature_rescoring_simple
AbhirupaGhosh Jul 28, 2026
b8f45b1
Add example data and remove old, unused data
AbhirupaGhosh Jul 28, 2026
49141ea
Refactor feature naming and network functions
jananiravi Jul 28, 2026
b21796f
Update feature_rescoring.R
jananiravi Jul 28, 2026
ad66bf8
Modified feature rescoring, network build, and docs
jananiravi Aug 5, 2026
6282481
Enhance feature summarization by adding mean and median cumulative co…
AbhirupaGhosh Aug 11, 2026
6d7d320
Enhance feature scoring by adding coefficient of variation and refini…
AbhirupaGhosh Aug 11, 2026
4275dfd
add function to filter optimal models
AbhirupaGhosh Aug 12, 2026
84ff286
add new filtering strategies to obtain top features.
AbhirupaGhosh Aug 12, 2026
c03184d
add the model filter option in feature scoring
AbhirupaGhosh Aug 13, 2026
30f7532
update feature scoring within seed
AbhirupaGhosh Aug 13, 2026
e683b6d
add sparsity_score
AbhirupaGhosh Aug 14, 2026
c022ff0
Update the contribution
AbhirupaGhosh Aug 14, 2026
0a8aea0
documentation fixes
jananiravi Aug 17, 2026
5c6f801
Update feature_rescoring.R
AbhirupaGhosh Aug 19, 2026
a8abc24
Merge branch 'feature_rescoring_simple' of https://github.com/JRaviLa…
AbhirupaGhosh Aug 19, 2026
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
6 changes: 4 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@ Imports:
glue,
graphics,
grDevices,
jsonlite,
hardhat,
igraph,
jsonlite,
methods,
networkD3,
parsnip,
purrr,
patchwork,
Expand Down Expand Up @@ -89,4 +91,4 @@ biocViews:
Visualization
URL: https://github.com/JRaviLab/amRml
BugReports: https://github.com/JRaviLab/amRml/issues
Config/roxygen2/version: 8.0.0
Config/roxygen2/version: 8.1.0
271 changes: 166 additions & 105 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,25 @@

export(.getTargetVarName)
export(applyBenjaminiHochberg)
export(buildFeatureNetwork)
export(buildLRModel)
export(buildPerfPq)
export(buildPerfPqCrossCountry)
export(buildPerfPqCrossDrug)
export(buildPerfPqCrossYear)
export(buildPerfPqLOOCountry)
export(buildPerfPqLOODrug)
export(buildPerfPqLOOYear)
export(buildPerfPqMDR)
export(buildPerfPqYearCountry)
export(buildPredPqMDR)
export(buildRecipe)
export(buildTopFeatsPq)
export(buildTopFeatsPqLOOCountry)
export(buildTopFeatsPqLOODrug)
export(buildTopFeatsPqLOOYear)
export(buildTopFeatsPqMDR)
export(buildTopFeatsPqYearCountry)
export(buildTuningGrid)
export(buildWflow)
export(calculateEvalMets)
Expand All @@ -13,16 +30,20 @@ export(createMLResultDir)
export(createMLinputList)
export(encodePhenotype)
export(extractTopFeats)
export(findSharedClusters)
export(findUniqueClusters)
export(fitBestModel)
export(generateMLInputs)
export(getConfusionMatrix)
export(getNumFeat)
export(loadMLInputTibble)
export(parse_ml_filename)
export(plotBaselineComparison)
export(plotCM)
export(plotCrossDrug)
export(plotDrugDist)
export(plotDrugPerf)
export(plotFeatureNetworkD3)
export(plotFishers)
export(plotMDR)
export(plotPRC)
Expand All @@ -43,6 +64,8 @@ export(runModelingPipeline)
export(selectBestModel)
export(shuffleLabels)
export(splitMLInputTibble)
export(summariseClusters)
export(topFeaturesPerDrugOrClass)
export(tuneGrid)
import(arrow)
import(dplyr)
Expand All @@ -51,116 +74,154 @@ import(ggrepel)
import(purrr)
import(stringr)
import(tibble)
importFrom(DBI,dbConnect)
importFrom(DBI,dbDisconnect)
importFrom(DBI,dbExecute)
importFrom(DBI,dbGetQuery)
importFrom(DBI,dbWriteTable)
importFrom(arrow,read_parquet)
importFrom(arrow,write_parquet)
importFrom(dplyr,all_of)
importFrom(dplyr,arrange)
importFrom(dplyr,bind_rows)
importFrom(dplyr,case_when)
importFrom(dplyr,count)
importFrom(dplyr,desc)
importFrom(dplyr,distinct)
importFrom(dplyr,filter)
importFrom(dplyr,group_by)
importFrom(dplyr,if_any)
importFrom(dplyr,matches)
importFrom(dplyr,mutate)
importFrom(dplyr,n_distinct)
importFrom(dplyr,pull)
importFrom(dplyr,relocate)
importFrom(dplyr,rename)
importFrom(dplyr,row_number)
importFrom(dplyr,rowwise)
importFrom(dplyr,select)
importFrom(dplyr,slice)
importFrom(dplyr,summarise)
importFrom(dplyr,ungroup)
importFrom(DBI,
dbConnect,
dbDisconnect,
dbExecute,
dbGetQuery,
dbWriteTable
)
importFrom(arrow,
read_parquet,
write_parquet
)
importFrom(dplyr,
all_of,
arrange,
bind_rows,
case_when,
count,
desc,
distinct,
filter,
group_by,
if_any,
matches,
mutate,
n_distinct,
pull,
relocate,
rename,
row_number,
rowwise,
select,
slice,
summarise,
ungroup
)
importFrom(duckdb,duckdb)
importFrom(ggplot2,aes)
importFrom(ggplot2,element_blank)
importFrom(ggplot2,element_line)
importFrom(ggplot2,element_text)
importFrom(ggplot2,geom_line)
importFrom(ggplot2,geom_path)
importFrom(ggplot2,geom_point)
importFrom(ggplot2,ggplot)
importFrom(ggplot2,labs)
importFrom(ggplot2,theme)
importFrom(ggplot2,xlab)
importFrom(ggplot2,ylim)
importFrom(ggplot2,
aes,
element_blank,
element_line,
element_text,
geom_line,
geom_path,
geom_point,
ggplot,
labs,
theme,
xlab,
ylim
)
importFrom(glmnet,glmnet)
importFrom(glue,glue)
importFrom(grDevices,colorRampPalette)
importFrom(graphics,barplot)
importFrom(hardhat,tune)
importFrom(jsonlite,fromJSON)
importFrom(jsonlite,write_json)
importFrom(jsonlite,
fromJSON,
write_json
)
importFrom(methods,is)
importFrom(parsnip,augment)
importFrom(parsnip,boost_tree)
importFrom(parsnip,extract_fit_engine)
importFrom(parsnip,fit)
importFrom(parsnip,logistic_reg)
importFrom(parsnip,multinom_reg)
importFrom(parsnip,rand_forest)
importFrom(parsnip,set_engine)
importFrom(parsnip,set_mode)
importFrom(purrr,imap_dfr)
importFrom(purrr,map)
importFrom(purrr,map_int)
importFrom(purrr,pmap_chr)
importFrom(purrr,walk)
importFrom(parsnip,
augment,
boost_tree,
extract_fit_engine,
fit,
logistic_reg,
multinom_reg,
rand_forest,
set_engine,
set_mode
)
importFrom(purrr,
imap_dfr,
map,
map_int,
pmap_chr,
walk
)
importFrom(readr,write_lines)
importFrom(recipes,all_predictors)
importFrom(recipes,recipe)
importFrom(recipes,step_normalize)
importFrom(recipes,step_pca)
importFrom(recipes,step_zv)
importFrom(recipes,update_role)
importFrom(rlang,":=")
importFrom(rlang,eval_tidy)
importFrom(rlang,sym)
importFrom(rsample,initial_split)
importFrom(rsample,initial_validation_split)
importFrom(rsample,testing)
importFrom(rsample,training)
importFrom(rsample,validation_set)
importFrom(rsample,vfold_cv)
importFrom(stats,coef)
importFrom(stats,fisher.test)
importFrom(stats,median)
importFrom(stats,reformulate)
importFrom(stats,reorder)
importFrom(stats,sd)
importFrom(stringr,str_remove)
importFrom(stringr,str_split)
importFrom(tibble,add_column)
importFrom(tibble,is_tibble)
importFrom(tibble,tibble)
importFrom(tidyr,drop_na)
importFrom(tidyr,pivot_longer)
importFrom(tidyr,pivot_wider)
importFrom(tune,control_grid)
importFrom(tune,extract_fit_parsnip)
importFrom(tune,finalize_workflow)
importFrom(tune,select_best)
importFrom(tune,tune_grid)
importFrom(vip,vi)
importFrom(vip,vip)
importFrom(workflows,add_model)
importFrom(workflows,add_recipe)
importFrom(workflows,workflow)
importFrom(workflowsets,extract_fit_parsnip)
importFrom(workflowsets,extract_spec_parsnip)
importFrom(yardstick,bal_accuracy)
importFrom(yardstick,conf_mat)
importFrom(yardstick,f_meas)
importFrom(yardstick,mcc)
importFrom(yardstick,metric_set)
importFrom(yardstick,pr_auc)
importFrom(yardstick,pr_curve)
importFrom(recipes,
all_predictors,
recipe,
step_normalize,
step_pca,
step_zv,
update_role
)
importFrom(rlang,
":=",
eval_tidy,
sym
)
importFrom(rsample,
initial_split,
initial_validation_split,
testing,
training,
validation_set,
vfold_cv
)
importFrom(stats,
coef,
fisher.test,
median,
reformulate,
reorder,
sd
)
importFrom(stringr,
str_remove,
str_split
)
importFrom(tibble,
add_column,
is_tibble,
tibble
)
importFrom(tidyr,
drop_na,
pivot_longer,
pivot_wider
)
importFrom(tune,
control_grid,
extract_fit_parsnip,
finalize_workflow,
select_best,
tune_grid
)
importFrom(vip,
vi,
vip
)
importFrom(workflows,
add_model,
add_recipe,
workflow
)
importFrom(workflowsets,
extract_fit_parsnip,
extract_spec_parsnip
)
importFrom(yardstick,
bal_accuracy,
conf_mat,
f_meas,
mcc,
metric_set,
pr_auc,
pr_curve
)
60 changes: 37 additions & 23 deletions R/data.R
Original file line number Diff line number Diff line change
@@ -1,24 +1,38 @@
#' Demo ML input tibble
#'
#' Stratified subset (30 Resistant + 30 Susceptible) of the AMP-genes-binary
#' matrix from the bundled `Sfl_parquet.duckdb`, restricted to 80 feature
#' columns.
#'
#' @format A tibble with 60 rows and 82 columns: `genome_id`,
#' `genome_drug.resistant_phenotype`, and 80 binary feature columns.
#' @source `inst/scripts/make_demo_data.R`.
#' @examples
#' data(demo_ml_tibble)
#' dim(demo_ml_tibble)
"demo_ml_tibble"
# FLAG for Abhirupa: data/demo_fit.rda and data/demo_ml_tibble.rda were
# deleted in b8f45b1 ("Add example data and remove old, unused data"), but
# the roxygen docs below (and @examples in plot_ml.R, run_ml_pipeline.R,
# ife_ml.R, core_ml.R that call data(demo_ml_tibble)) still reference them.
# Confirmed via `exists("demo_ml_tibble")` after devtools::load_all() -> FALSE,
# the object genuinely isn't in the package anymore, so devtools::document()
# fatally errors trying to build .Rd files for data that doesn't exist ('demo_ml_tibble'
# is not an exported object from 'namespace:amRml'). Commented out both blocks
# below as the minimal unblock so NAMESPACE regeneration can proceed for the
# rest of the package. The real question -- restore the .rda files via
# inst/scripts/make_demo_data.R, or retire these two blocks + the four
# @examples blocks elsewhere that still call data(demo_ml_tibble) -- is still
# open and needs her call; nothing below was deleted, just disabled.

#' Demo LR fit
#'
#' A tuned logistic-regression workflow fitted on [demo_ml_tibble].
#'
#' @format A fitted `workflow` object (output of [fitBestModel()]).
#' @source `inst/scripts/make_demo_data.R`.
#' @examples
#' data(demo_fit)
#' class(demo_fit)
"demo_fit"
# #' Demo ML input tibble
# #'
# #' Stratified subset (30 Resistant + 30 Susceptible) of the AMP-genes-binary
# #' matrix from the bundled `Sfl_parquet.duckdb`, restricted to 80 feature
# #' columns.
# #'
# #' @format A tibble with 60 rows and 82 columns: `genome_id`,
# #' `genome_drug.resistant_phenotype`, and 80 binary feature columns.
# #' @source `inst/scripts/make_demo_data.R`.
# #' @examples
# #' data(demo_ml_tibble)
# #' dim(demo_ml_tibble)
# "demo_ml_tibble"
#
# #' Demo LR fit
# #'
# #' A tuned logistic-regression workflow fitted on `demo_ml_tibble`.
# #'
# #' @format A fitted `workflow` object (output of [fitBestModel()]).
# #' @source `inst/scripts/make_demo_data.R`.
# #' @examples
# #' data(demo_fit)
# #' class(demo_fit)
# "demo_fit"
Loading