Skip to content

Commit

Permalink
packages updated
Browse files Browse the repository at this point in the history
  • Loading branch information
aminuldu07 committed Jan 14, 2025
1 parent 8a09e5d commit 35dd036
Show file tree
Hide file tree
Showing 20 changed files with 513 additions and 95 deletions.
4 changes: 4 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# Generated by roxygen2: do not edit by hand

export(get_Data_formatted_for_ml_and_best.m)
export(get_all_TESTCD_rf_input_param_list_output_cv_imp)
export(get_all_lb_TESTCD_zscore)
export(get_auc_curve_with_rf_model)
export(get_bw_score)
export(get_col_harmonized_scores_df)
export(get_compile_data)
export(get_histogram_barplot)
export(get_imp_features_from_rf_model_with_cv)
export(get_indiv_score_om_lb_mi_domain_df)
export(get_lb_score)
export(get_liver_om_lb_mi_tox_score_list)
export(get_livertobw_score)
Expand All @@ -18,6 +21,7 @@ export(get_reprtree_from_rf_model)
export(get_rf_input_param_list_output_cv_imp)
export(get_rf_model_output_cv_imp)
export(get_rf_model_with_cv)
export(get_treatment_group_amin)
import(DBI)
import(ROCR)
import(RSQLite)
Expand Down
10 changes: 5 additions & 5 deletions R/get_bw_score.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ get_bw_score <- function(studyid = NULL,
return_individual_scores = FALSE,
return_zscore_by_USUBJID = FALSE) {

# Enforce mutual exclusivity: If both are TRUE, throw an error or handle it
if (return_individual_scores && return_zscore_by_USUBJID) {
stop("Error: Both 'return_individual_scores' and 'return_zscore_by_USUBJID' cannot be TRUE at the same time.")
}

studyid <- as.character(studyid)
path <- path_db

Expand Down Expand Up @@ -356,11 +361,6 @@ if (!("BWDY" %in% colnames(bw)) && !("VISITDY" %in% colnames(bw))) {
as.data.frame(HD_BWzScore)


# Enforce mutual exclusivity: If both are TRUE, throw an error or handle it
if (return_individual_scores && return_zscore_by_USUBJID) {
stop("Error: Both 'return_individual_scores' and 'return_zscore_by_USUBJID' cannot be TRUE at the same time.")
}

if (return_individual_scores){

bwzscore_BW <- bwzscore_BW
Expand Down
4 changes: 2 additions & 2 deletions R/get_compile_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ get_compile_data <- function(studyid = NULL,
path_db,
fake_study = FALSE,
use_xpt_file = FALSE) {
browser()

studyid <- as.character(studyid)
path <- path_db

Expand Down Expand Up @@ -445,7 +445,7 @@ browser()
"DOSE_RANKING",
"SETCD")]

# Rename the "DOSE_RANKING" column to ARMCD
# Rename the "DOSE_RANKING" column to ARMCD
# Rename "DOSE_RANKING" to "ARMCD" in master_compiledata
master_compiledata <- master_compiledata1 %>%
dplyr::rename(ARMCD = DOSE_RANKING)
Expand Down
2 changes: 1 addition & 1 deletion R/get_treatment_group_&_dose.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#' @param fake_study Logical. Whether the study data is generated by the `SENDsanitizer` package. Defaults to `FALSE`.
#' @param use_xpt_file Logical. Whether to retrieve study data from `.xpt` files instead of the SQLite database. Defaults to `FALSE`.
#'
#' @return
#' @return a data frame
#' @examples
#'
#' \dontrun{
Expand Down
42 changes: 26 additions & 16 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ output:
toc_depth: 2
---

# SENDQSAR: QSAR Modeling with SEND Database
# SENDQSAR: A `R Package` for `QSAR Modeling` with `SEND Database`

## About

Expand All @@ -23,11 +23,11 @@ output:

## Workflow

- **Input Database Path**: Provide the database path containing nonclinical study results for each STUDYID.
- **Data Pre processing**: Use functions `f1` to `f8` to clean, harmonize, and prepare data.
- **Model Building**: Employ machine learning functions (`f9` to `f18`) for training, validation, and evaluation.
- **Visualization**: Generate plots and performance metrics for better interpretation.

- **Input Database Path**: Provide the path for database or `.xpt` files containing nonclinical study data in `SEND` format.
- **Data Pre processing**: Use functions `f1` to `f8` to clean, harmonize, and prepare data for Machine Learning (ML).
- **Model Building**: Employ ML functions (`f9` to `f18`) for ML model training and evaluation.
- **Visualization**: Generate plots and performance metrics for better interpretation (`f12` to `f15`).
- **Automated Pipelines**: Use functions `f15` to `f18` to perform the above workflows in A single step by providing the database path and a `.csv` file containing the label (TOXIC/NON-TOXIC) of the `STUDYID`.

## Modular Functions Overview

Expand All @@ -53,16 +53,26 @@ output:

- **Machine Learning Model Building and Performance Evaluation**:

- `f9`: `get_rf_model_with_cv` - Builds a random forest model with cross-validation (depends on `f8`).


- `f10`: `get_zone_exclusioned_rf_model_with_cv` - Enhances classification accuracy by excluding uncertain predictions (depends on `f8`).

- `f11`: `get_imp_features_from_rf_model_with_cv` - Computes feature importance for model interpretation.

- `f12`: `get_auc_curve_with_rf_model`- Generates AUC curves to evaluate model performance.

- **N.B** :
- **Model Training**
- `f9`: `get_rf_model_with_cv`
- Builds a random forest model with cross-validation (depends on `f8`).

- **Improved Classification Accuracy**
- `f10`: `get_zone_exclusioned_rf_model_with_cv`
- Enhances classification accuracy by excluding uncertain predictions (depends on `f8`).

- **Feature Importance**
- `f11`: `get_imp_features_from_rf_model_with_cv`
- Computes feature importance for model interpretation.

- **Model Performance Visualization**
- `f12`: `get_auc_curve_with_rf_model`
- Generates AUC curves to evaluate model performance.

#### Notes for MOdular Functions
- **Data Preparation**
- Functions `f1` to `f8` must be executed sequentially to prepare the `Data` argument required by these functions.
- Alternatively, the **composite function** `f18` can be used to directly generate the `Data` argument, combining the functionality of `f1` to `f8`.
- For `f9`, `f10`, `f11`, and `f12`, Functions `f1`, `f2`, `f3`, `f4`, `f5`, `f6`, `f7`, and `f8`must be executed sequentially to prepare the `Data` argument. Alternatively, the **composite function** `f18` can be used to directly generate the `Data` argument.

---
Expand Down
84 changes: 61 additions & 23 deletions README.html
Original file line number Diff line number Diff line change
Expand Up @@ -603,8 +603,9 @@

<h1 id="sendqsar">SENDQSAR</h1>
<ul>
<li><a href="#sendqsar-qsar-modeling-with-send-database">SENDQSAR: QSAR
Modeling with SEND Database</a>
<li><a href="#sendqsar-a-r-package-for-qsar-modeling-with-send-database">SENDQSAR:
A <code>R Package</code> for <code>QSAR Modeling</code> with
<code>SEND Database</code></a>
<ul>
<li><a href="#about">About</a></li>
<li><a href="#features">Features</a></li>
Expand All @@ -622,8 +623,9 @@ <h1 id="sendqsar">SENDQSAR</h1>
<li><a href="#contact">Contact</a></li>
</ul></li>
</ul>
<h1 id="sendqsar-qsar-modeling-with-send-database">SENDQSAR: QSAR
Modeling with SEND Database</h1>
<h1 id="sendqsar-a-r-package-for-qsar-modeling-with-send-database">SENDQSAR:
A <code>R Package</code> for <code>QSAR Modeling</code> with
<code>SEND Database</code></h1>
<h2 id="about">About</h2>
<ul>
<li>This package facilitates developing Quantitative Structure-Activity
Expand Down Expand Up @@ -652,15 +654,22 @@ <h2 id="features">Features</h2>
</ul>
<h2 id="workflow">Workflow</h2>
<ul>
<li><strong>Input Database Path</strong>: Provide the database path
containing nonclinical study results for each STUDYID.</li>
<li><strong>Input Database Path</strong>: Provide the path for database
or <code>.xpt</code> files containing nonclinical study data in
<code>SEND</code> format.</li>
<li><strong>Data Pre processing</strong>: Use functions <code>f1</code>
to <code>f8</code> to clean, harmonize, and prepare data.</li>
<li><strong>Model Building</strong>: Employ machine learning functions
(<code>f9</code> to <code>f18</code>) for training, validation, and
to <code>f8</code> to clean, harmonize, and prepare data for Machine
Learning (ML).</li>
<li><strong>Model Building</strong>: Employ ML functions
(<code>f9</code> to <code>f18</code>) for ML model training and
evaluation.</li>
<li><strong>Visualization</strong>: Generate plots and performance
metrics for better interpretation.</li>
metrics for better interpretation (<code>f12</code> to
<code>f15</code>).</li>
<li><strong>Automated Pipelines</strong>: Use functions <code>f15</code>
to <code>f18</code> to perform the above workflows in A single step by
providing the database path and a <code>.csv</code> file containing the
label (TOXIC/NON-TOXIC) of the <code>STUDYID</code>.</li>
</ul>
<h2 id="modular-functions-overview">Modular Functions Overview</h2>
<ul>
Expand Down Expand Up @@ -701,21 +710,50 @@ <h2 id="modular-functions-overview">Modular Functions Overview</h2>
<li><p><strong>Machine Learning Model Building and Performance
Evaluation</strong>:</p>
<ul>
<li><p><code>f9</code>: <code>get_rf_model_with_cv</code> - Builds a
random forest model with cross-validation (depends on
<code>f8</code>).</p></li>
<li><p><code>f10</code>:
<code>get_zone_exclusioned_rf_model_with_cv</code> - Enhances
classification accuracy by excluding uncertain predictions (depends on
<code>f8</code>).</p></li>
<li><p><code>f11</code>:
<code>get_imp_features_from_rf_model_with_cv</code> - Computes feature
importance for model interpretation.</p></li>
<li><p><code>f12</code>: <code>get_auc_curve_with_rf_model</code>-
Generates AUC curves to evaluate model performance.</p></li>
<li><strong>Model Training</strong>
<ul>
<li><code>f9</code>: <code>get_rf_model_with_cv</code>
<ul>
<li>Builds a random forest model with cross-validation (depends on
<code>f8</code>).</li>
</ul></li>
</ul></li>
<li><strong>Improved Classification Accuracy</strong>
<ul>
<li><code>f10</code>: <code>get_zone_exclusioned_rf_model_with_cv</code>
<ul>
<li>Enhances classification accuracy by excluding uncertain predictions
(depends on <code>f8</code>).</li>
</ul></li>
</ul></li>
<li><strong>Feature Importance</strong>
<ul>
<li><code>f11</code>:
<code>get_imp_features_from_rf_model_with_cv</code>
<ul>
<li>Computes feature importance for model interpretation.</li>
</ul></li>
</ul></li>
<li><strong>Model Performance Visualization</strong>
<ul>
<li><code>f12</code>: <code>get_auc_curve_with_rf_model</code>
<ul>
<li>Generates AUC curves to evaluate model performance.</li>
</ul></li>
<li><p><strong>N.B</strong> :</p>
</ul></li>
</ul></li>
</ul>
<h4 id="notes-for-modular-functions">Notes for MOdular Functions</h4>
<ul>
<li><strong>Data Preparation</strong>
<ul>
<li>Functions <code>f1</code> to <code>f8</code> must be executed
sequentially to prepare the <code>Data</code> argument required by these
functions.</li>
<li>Alternatively, the <strong>composite function</strong>
<code>f18</code> can be used to directly generate the <code>Data</code>
argument, combining the functionality of <code>f1</code> to
<code>f8</code>.</li>
<li>For <code>f9</code>, <code>f10</code>, <code>f11</code>, and
<code>f12</code>, Functions <code>f1</code>, <code>f2</code>,
<code>f3</code>, <code>f4</code>, <code>f5</code>, <code>f6</code>,
Expand Down
59 changes: 35 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
SENDQSAR
================

- [SENDQSAR: QSAR Modeling with SEND
Database](#sendqsar-qsar-modeling-with-send-database)
- [SENDQSAR: A `R Package` for `QSAR Modeling` with
`SEND Database`](#sendqsar-a-r-package-for-qsar-modeling-with-send-database)
- [About](#about)
- [Features](#features)
- [Workflow](#workflow)
Expand All @@ -16,7 +16,7 @@ SENDQSAR
- [License](#license)
- [Contact](#contact)

# SENDQSAR: QSAR Modeling with SEND Database
# SENDQSAR: A `R Package` for `QSAR Modeling` with `SEND Database`

## About

Expand Down Expand Up @@ -44,14 +44,17 @@ SENDQSAR

## Workflow

- **Input Database Path**: Provide the database path containing
nonclinical study results for each STUDYID.
- **Input Database Path**: Provide the path for database or `.xpt` files
containing nonclinical study data in `SEND` format.
- **Data Pre processing**: Use functions `f1` to `f8` to clean,
harmonize, and prepare data.
- **Model Building**: Employ machine learning functions (`f9` to `f18`)
for training, validation, and evaluation.
harmonize, and prepare data for Machine Learning (ML).
- **Model Building**: Employ ML functions (`f9` to `f18`) for ML model
training and evaluation.
- **Visualization**: Generate plots and performance metrics for better
interpretation.
interpretation (`f12` to `f15`).
- **Automated Pipelines**: Use functions `f15` to `f18` to perform the
above workflows in A single step by providing the database path and a
`.csv` file containing the label (TOXIC/NON-TOXIC) of the `STUDYID`.

## Modular Functions Overview

Expand Down Expand Up @@ -87,21 +90,29 @@ SENDQSAR

- **Machine Learning Model Building and Performance Evaluation**:

- `f9`: `get_rf_model_with_cv` - Builds a random forest model with
cross-validation (depends on `f8`).

- `f10`: `get_zone_exclusioned_rf_model_with_cv` - Enhances
classification accuracy by excluding uncertain predictions (depends
on `f8`).

- `f11`: `get_imp_features_from_rf_model_with_cv` - Computes feature
importance for model interpretation.

- `f12`: `get_auc_curve_with_rf_model`- Generates AUC curves to
evaluate model performance.

- **N.B** :

- **Model Training**
- `f9`: `get_rf_model_with_cv`
- Builds a random forest model with cross-validation (depends on
`f8`).
- **Improved Classification Accuracy**
- `f10`: `get_zone_exclusioned_rf_model_with_cv`
- Enhances classification accuracy by excluding uncertain
predictions (depends on `f8`).
- **Feature Importance**
- `f11`: `get_imp_features_from_rf_model_with_cv`
- Computes feature importance for model interpretation.
- **Model Performance Visualization**
- `f12`: `get_auc_curve_with_rf_model`
- Generates AUC curves to evaluate model performance.

#### Notes for MOdular Functions

- **Data Preparation**
- Functions `f1` to `f8` must be executed sequentially to prepare the
`Data` argument required by these functions.
- Alternatively, the **composite function** `f18` can be used to
directly generate the `Data` argument, combining the functionality
of `f1` to `f8`.
- For `f9`, `f10`, `f11`, and `f12`, Functions `f1`, `f2`, `f3`, `f4`,
`f5`, `f6`, `f7`, and `f8`must be executed sequentially to prepare
the `Data` argument. Alternatively, the **composite function** `f18`
Expand Down
Loading

0 comments on commit 35dd036

Please sign in to comment.