Learn R Programming

automated Non-Compartmental Analysis (aNCA)

Our aim is to develop and share an open-source R Shiny application for performing Non-Compartmental Analysis (NCA) on clinical and non-clinical datasets worldwide and across pharmaceutical companies.

Description

This application enables users to upload their datasets and perform Non-Compartment Analysis (NCA) on both pre-clinical and clinical datasets, with the results being easily visualizable. Designed with user-friendliness in mind, this app aims to make NCA accessible and straightforward for all scientists. Among the features it currently possess, the App can:

  • Customize half life calculation: Either by rule settings definitions or performing manual in-plot adjustments
  • Define AUC intervals of interest: Providing by default last and to-infinite calculations
  • Visualize data and results with interactive boxplots, summary statistic tables and scatter plots
  • Produce PP and ADPP dataset formats of the resulting parameters
  • Save your analysis settings and reupload them later to keep on analysing!

Installation

Via pak (recommended)

We recommend using pak for package installation, along with all system dependencies. If you do not have pak available, you will need to set it up first:

install.packages("pak")

then you can install aNCA by running:

pak::pak("pharmaverse/aNCA")

in your R console.

Via cloning the repository (for contributors)

Alternatively, you can set up the package by cloning the repository through your terminal/shell:

git clone https://github.com/pharmaverse/aNCA.git

and then loading it directly using devtools in your IDE (e.g. RStudio) console:

devtools::load_all()

Quick start

To run the application, simply invoke:

aNCA::run_app()

The testing data will be automatically loaded upon application startup. You can provide your own dataset in the data tab. Here you can also specify pre-processing filters.

In the NCA tab, start off by loading the pre-processed data using Submit button. You will also need to choose dose number in the Settings. Then, you will be able to run the NCA analysis. From there, you can also specify different analysis options, like applying flag rule sets and selecting slopes.

After the setup is done and analysis is performed, you are free to explore the results in the Outputs tab. Application supports various customizable plots, as well as report exporting.

For more detailed instructions, check out the Get Started page.

Contributing

As developer

To ensure a clean codebase and smooth cooperation, please adhere to the contributing guidelines.

As user

Feel free to open identified issues, to reach out to us for questions or report in our google sheet for feedback.

Documentation and references

  • Please go to our Website for further information on the aNCA app (still in development).
  • The main package used by the App is PKNCA. You can find more of it on its GitHub

Copy Link

Version

Install

install.packages('aNCA')

Version

0.1.0

License

Apache License (>= 2)

Issues

Pull Requests

Stars

Forks

Maintainer

Valentin Legras

Last Published

December 9th, 2025

Functions in aNCA (0.1.0)

apply_filters

Apply Filters to a Dataset
apply_labels

Apply Labels to a dataset
check_slope_rule_overlap

Check overlap between existing and new slope rulesets
convert_to_iso8601_duration

Convert Numeric Value and Unit to ISO 8601 Duration
.apply_slope_rules

Apply Slope Rules to Update Data
.compress_range

Compresses a numeric vector into the simplest possible character string that, when evaluated, will create the same numeric vector.
create_pptx_dose_slides

Create a PowerPoint presentation with dose escalation results, including main and extra figures Adds slides for summary tables, mean plots, line plots, and individual subject results
create_qmd_doc

Create a new Quarto presentation file with YAML header and setup chunk
apply_mapping

Apply UI-Based Column Mapping to a Dataset
calculate_f

Calculate bioavailability with pivoted output
format_unit_string

Formats a unit string if a unique unit exists
g_pkcg01_lin

Wrapper around aNCA::pkcg01() function. Calls the function with LIN scale argument.
create_metabfl

Create METABFL Column Based on Selected Metabolites
create_pptx_doc

Create a new PowerPoint document from a template and add a title slide
detect_study_types

Detect study types
ensure_column_unit_exists

Ensure Unit Columns Exist in PKNCA Object
dose_profile_duplicates

Create duplicates in concentration data with Pre-dose and Last Values for Dosing Cycles
export_cdisc

Export CDISC Data
format_pkncadata_intervals

Create Dose Intervals Dataset
g_pkcg02_log

Wrapper around aNCA::pkcg02() function. Calls the function with LOG scale argument.
format_pkncadose_data

Create PK Dose Dataset
general_lineplot

Generate a General Line Plot for ADNCA Dataset
general_meanplot

Generate a Mean Concentration Plot for ADNCA Dataset
add_pptx_sl_plottable

Add a slide with both a plot and a table
add_pptx_sl_plot

Add a slide with a plot only
create_qmd_dose_slides

Create all slides for dose escalation results in a Quarto document
create_html_dose_slides

Render dose escalation results to HTML via Quarto
convert_volume_units

Convert Volume Units to Match Concentration Denominator Units
add_pptx_sl_title

Add a title slide to the rpptx document
calculate_ratios

Calculate Ratios from PKNCA Results
add_pptx_sl_table

Add a slide with a table only
calculate_summary_stats

Calculate Summary Statistics
identify_target_rows

Identify target rows based on groups, parameters, and impute method
parse_annotation

Parses annotations in the context of data. Special characters and syntax are substituted by actual data and/or substituted for format that is better parsed via rendering functions (e.g. plotly).
pivot_wider_pknca_results

Reshape PKNCA Results
filter_breaks

Filter Breaks for X-Axis
filter_slopes

Filter dataset based on slope selections and exclusions
g_pkcg01_log

Wrapper around aNCA::pkcg01() function. Calls the function with LOG scale argument.
interval_add_impute

Add specified imputation methods to the intervals in a PKNCAdata or data.frame object.
multiple_matrix_ratios

Calculate Matrix Ratios This function calculates the ratios for a given data set, based on the shared time points for each matrix concentration sample. The user can input multiple tissues for which ratios should be calculated.
g_pkcg02_lin

Wrapper around aNCA::pkcg02() function. Calls the function with LIN scale argument.
.plotly_empty_plot

Generate an Empty Plotly Object
.eval_range

Evaluates range notation. If provided notation is invalid, returns NA.
pk_dose_qc_plot

Create a PK Dose Quality Control (QC) Plot
format_pkncaconc_data

Create PK Concentration Dataset
create_start_impute

Create C0 Impute Column
flexible_violinboxplot

Flexible Violin/Box Plot
l_pkcl01

Create PK Concentration Listing
select_minimal_grouping_cols

Find Minimal Grouping Columns for Strata Reconstruction
run_app

Run the Shiny app
interval_remove_impute

Remove specified imputation from the intervals in a PKNCAdata or data.frame (intervals) object.
read_pk

Reads PK datasets from various file formats.
translate_terms

Translate Terms from One Nomenclature to Another
pkcg01

Generate PK Concentration-Time Profile Plots
simplify_unit

Simplify compound unit expressions
remove_impute_method

Remove impute method from the impute column
prepare_plot_data

Prepare Data for PK Dose QC Plotting
pk.calc.volpk

Calculate the total urine volume
get_label

Get the Label of a Heading
metadata_nca_parameters

metadata_nca_parameters
get_conversion_factor

Transform Units
pkcg02

Generate Combined PK Concentration-Time Profile Plot by Cohort
pknca_calculate_f

Calculate bioavailability for intravascular vs extravascular aucs
preprocess_data_for_plot

Prepare Data for PK Lineplot
metadata_nca_variables

metadata_nca_variables
validate_pk

Validates data table with raw pk data.
verify_parameters

Conditionally Verify and Override PK Parameters Based on Sample Type
log_conversion

Log conversions applied to dataset
generate_tooltip_text

Generate HTML Tooltip Text
lambda_slope_plot

Generate a Lambda Slope Plot
PKNCA_build_units_table

Build Units Table for PKNCA
PKNCA_impute_method_start_c1

This function imputes the start concentration using the first concentration after dose
PKNCA_calculate_nca

Calculates results for PKNCA analysis.
add_impute_method

Add impute method to the impute column
PKNCA_create_data_object

Creates a PKNCA::PKNCAdata object.
add_f_to_pknca_results

Add bioavailability results to PKNCA results
PKNCA_impute_method_start_logslope

This function imputes the start concentration using the log slope method.
PKNCA_update_data_object

Create a PKNCAdata Object for NCA or Slope Analysis
PKNCA_hl_rules_exclusion

Exclude NCA results based on user-defined rules over the half-life related parameters This function applies exclusion rules to the NCA results based on user-defined parameters.
add_optional_layers

Helper function to handle optional layers
add_qmd_sl_plot

Add a slide to the Quarto document with a single plot
add_qmd_plot

Helper to create a Quarto code chunk for a plot
add_qmd_table

Helper to create a Quarto code chunk for a table
add_qmd_sl_plottabletable

Add a slide to the Quarto document with a plot and two tables (side by side)