Skip to content

Commit

Permalink
more docs
Browse files Browse the repository at this point in the history
  • Loading branch information
werpuc committed Apr 17, 2024
1 parent 4d7d931 commit afe70a5
Show file tree
Hide file tree
Showing 9 changed files with 187 additions and 13 deletions.
50 changes: 41 additions & 9 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,22 @@ name: pkgdown

jobs:
pkgdown:
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork == false
runs-on: ubuntu-latest
# Only restrict concurrency for non-PR jobs
concurrency:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
isPush: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-tinytex@v2

- uses: r-lib/actions/setup-pandoc@v2

Expand All @@ -35,14 +41,40 @@ jobs:
extra-packages: any::pkgdown, local::.
needs: website

- name: Build site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
- name: Install package
run: R CMD INSTALL .

- name: Build and deploy pkgdown site
if: contains(env.isPush, 'true')
run: |
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "[email protected]"
Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)'
- name: Create website
if: contains(env.isPush, 'false')
run: |
pkgdown::build_site()
shell: Rscript {0}

- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/[email protected]
- name: Create index file
if: contains(env.isPush, 'false')
run: |
echo '<!DOCTYPE html><html><head><meta http-equiv="refresh" content="0;URL=/dev/index.html" /> <script language="javascript"> window.location.replace('/dev/index.html')</script></head></html>' > ./docs/index.html
- name: Deploy to Netlify
if: contains(env.isPush, 'false')
id: netlify-deploy
uses: nwtgck/[email protected]
with:
clean: false
branch: gh-pages
folder: docs
publish-dir: './docs'
production-branch: master
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message:
'Deploy from GHA: ${{ github.event.pull_request.title || github.event.head_commit.message }} (${{ github.sha }})'
# these all default to 'true'
enable-pull-request-comment: false
enable-commit-comment: false
# enable-commit-status: true
# overwrites-pull-request-comment: true
timeout-minutes: 1
21 changes: 21 additions & 0 deletions R/plot_3d_structure_hires.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
#' Presents classification results on 3D structure
#'
#' @import r3dmol
#'
#' @param hires_params ...
#' @param pdb_file_path ...
#'
#' @description Plots the color classification on supplied 3d structure.
#'
#' @return a r3dmol object.
#'
#' @seealso calculate_hires
#'
#' @examples
#' dat <- HaDeX::read_hdx(...)
#' pdb_file_path <- ...
#' fit_k_params <- get_example_fit_k_params()
#' control <- get_example_control()
#' kin_dat <- prepare_kin_dat(dat)
#' fit_values <- create_fit_dataset(kin_dat, control, fit_k_params)
#' hires_params <- calculate_hires(fit_values)
#' plot_3d_structure_hires(hires_params, pdb_file_path)
#'
#' @export

plot_3d_structure_hires <- function(hires_params,
Expand Down
24 changes: 24 additions & 0 deletions R/plot_cov_class.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,28 @@
#' Plots coverage with classification results
#'
#' @importFrom ggplot2 geom_rect aes element_blank
#'
#' @param fit_values
#' @param fractional ...
#' @param interactive ...
#'
#' @description This function is used for visualization of the classification method
#' for peptides. It uses the traditional form of coverage, with length present and easily
#' estimated redundancy. It also allows to see if the tendencies for exchange are coherent
#' in regions.
#'
#' @return a girafe object.
#'
#' @seealso create_fit_dataset
#'
#' @examples
#' HaDeX::read_hdx(...)
#' kin_dat <- prepare_kin_dat(dat, state = state_1)
#' fit_k_params <- get_example_fit_k_params()
#' control <- get_example_control()
#' fit_values <- create_fit_dataset(kin_dat, control, fit_k_params)
#' plot_cov_class(fit_values)
#'
#' @export
plot_cov_class <- function(fit_values,
fractional = T,
Expand Down
31 changes: 28 additions & 3 deletions R/plot_double_uc.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,31 @@
## wrapper for GUI
## for previous plot function for regular uc and fitted uc

#' Plots two uc plots side by side
#'
#' @param fit_dat uptake data for selected peptide.
#' @param fit_values fit values for selected peptide.
#' @param replicate
#' @param fractional
#'
#' @description This function plots two plots side by side for a peptide. The left
#' plot is uc plot with fitted model with its components. The right plot is singular
#' uc without logarithmic axis for the comparison of shape.
#' Basically, this function calls for other functions and plots the results side by side.
#' This function is aimed for the summary `Plots` panel in HRaDeXGUI and does not have
#' an interactive mode.
#'
#' @return a ggplot object.
#'
#' @seelaso plot_fitted_uc plot_singular_uc
#'
#' @examples
#' dat <- HaDeX::read_hdx(...)
#' kin_dat <- prepare_kin_dat(dat, state = state_1)
#' fit_dat <- kin_dat[kin_dat[["id"]]==1, ]
#' fit_k_params <- get_example_fit_k_params()
#' control <- get_example_control()
#' fit_values_all <- create_fit_dataset(kin_dat, control, fit_k_params)
#' fit_values <- fit_values_all[fit_values_all[["id"]]==1, ]
#' plot_double_uc(fit_dat, fit_values)
#'
#' @export

plot_double_uc <- function(fit_dat,
Expand Down
21 changes: 21 additions & 0 deletions R/plot_estimated_k.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
#' Plots estimated k
#'
#' @param hires_params data.frame with hires results, calculate using
#' calculate_hires.
#' @param interactive ...
#'
#' @description Plots the estimated k for residues. Estimated k for each are calculated
#' from classification results, treating the n (population) as the probability of getting
#' corresponding rate of exchange. The aggregation of results is described in the vignette.
#'
#' @return a girafe object.
#'
#' @seealso calculate_hires
#'
#' @examples
#' dat <- HaDeX::read_hdx(...)
#' kin_dat <- prepare_kin_dat(dat)
#' fit_k_params <- get_example_fit_k_params()
#' control <- get_example_control()
#' fit_values <- create_fit_dataset(kin_dat, control, fit_k_params)
#' hires_params <- calculate_hires(fit_values)
#' plot_estimated_k(hires_params)
#'
#' @export

Expand Down
26 changes: 26 additions & 0 deletions R/plot_fitted_uc.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,34 @@
#' Plots uptake curve with fit components
#'
#' @importFrom gridExtra grid.arrange
#' @importFrom ggplot2 stat_function geom_line annotate theme_bw geom_errorbar geom_linerange
#' @importFrom dplyr summarize group_by
#' @importFrom ggiraph geom_point_interactive geom_line_interactive
#'
#' @param fit_dat uptake data for selected peptide.
#' @param fit_values fit values for selected peptide.
#' @param replicate indicator if the replicate data is plotted, or aggregated.
#' @param fractional ...
#' @param interactive ...
#'
#' @description FUnction plots the uptake values for one, selected peptide. Alongside the
#' fitted model is plotted in black, with its components (fast - red, medium - green,
#' slow - blue). In case when peptide is classified as a edge case, the linear model is used.
#'
#' @return a ggplot object. Need converstion to girafe for interactivity.
#'
#' @seealso plot_lm
#'
#' @examples
#' HaDeX::read_hdx(...)
#' kin_dat <- prepare_kin_dat(dat, state = state_1)
#' fit_dat <- kin_dat[kin_dat[["id"]]==1, ]
#' fit_k_params <- get_example_fit_k_params()
#' control <- get_example_control()
#' fit_values_all <- create_fit_dataset(kin_dat, control, fit_k_params)
#' fit_values <- fit_values_all[fit_values_all[["id"]]==1, ]
#' plot_fitted_uc(fit_dat, fit_values)
#'
#' @export
plot_fitted_uc <- function(fit_dat,
fit_values,
Expand Down
17 changes: 17 additions & 0 deletions R/plot_hires.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,25 @@
#' @importFrom ggiraph geom_rect_interactive girafe girafe_options opts_tooltip
#' @importFrom glue glue
#'
#' @param hires_params data.frame with hires results, calculate using
#' calculate_hires.
#' @param interactive ...
#'
#' @description Plot the result of color classification analysis in
#' high resolution in a linear form.
#'
#' @return a girafe object.
#'
#' @seealso calculate_hires
#'
#' @examples
#' dat <- HaDeX::read_hdx()
#' kin_dat <- prepare_kin_dat(dat, state = state_1)
#' fit_k_params <- get_example_fit_k_params()
#' control <- get_example_control()
#' fit_values <- create_fit_dataset(kin_dat, control, fit_k_params)
#' hires_params <- calculate_hires(fit_values)
#' plot_hires(hires_params)
#'
#' @export

Expand Down
4 changes: 4 additions & 0 deletions R/plot_interactive.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#' Wrapper for interactivity
#'
#' @importFrom ggiraph girafe opts_hover opts_sizing opts_hover_inv
#'
#' @description Currently not in use.
#'
#' @export plot_interactive

plot_interactive <- function(plot_function, ...){
Expand Down
6 changes: 5 additions & 1 deletion R/plot_lm.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
#' @seealso
#'
#' @examples
#' dat <-
#' dat <- HaDeX::read_hdx()
#' kin_dat <- prepare_kin_dat(dat, state = state_1)
#' fit_dat <- kin_dat[kin_dat[["id"]]==1, ]
#' plot_lm(fit_dat, class_name = unique(fit_dat[["class_name"]]))
#'
#' @export plot_lm

plot_lm <- function(fit_dat,
Expand Down

0 comments on commit afe70a5

Please sign in to comment.