Skip to content

Commit

Permalink
Merge pull request #158 from shwilks/master
Browse files Browse the repository at this point in the history
Update to v1.2.8
  • Loading branch information
shwilks authored Nov 23, 2023
2 parents 48725fd + 314f622 commit 53b4f99
Show file tree
Hide file tree
Showing 49 changed files with 269 additions and 110 deletions.
6 changes: 3 additions & 3 deletions CRAN-SUBMISSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Version: 1.2.7
Date: 2023-09-01 05:06:17 UTC
SHA: 427a0fcec70ce202358ed9f72e4a207d150cfb85
Version: 1.2.8
Date: 2023-11-22 18:14:09 UTC
SHA: f738ce3c333d12ada310f0c6aef4c01f9ab464cd
10 changes: 6 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: Racmacs
Type: Package
Title: Antigenic Cartography Macros
Version: 1.2.7
Date: 2023-09-01
Version: 1.2.8
Date: 2023-11-22
Authors@R:
c(person(given = "Sam",
family = "Wilks",
Expand Down Expand Up @@ -47,13 +47,14 @@ Suggests:
rstudioapi,
plotly,
geometry,
gdata,
readxl,
stringr,
tibble,
tidyr,
base64enc,
lifecycle,
MCMCpack
MCMCpack,
spelling
LinkingTo:
Rcpp,
RcppArmadillo,
Expand All @@ -67,3 +68,4 @@ VignetteBuilder: knitr
URL: https://acorg.github.io/Racmacs/, https://github.com/acorg/Racmacs/
BugReports: https://github.com/acorg/Racmacs/issues
License: AGPL-3
Language: en-GB
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ export(save.coords)
export(save.titerTable)
export(setLegend)
export(sortOptimizations)
export(splitTiterLayers)
export(srAnnotations)
export(srAspect)
export(srBaseCoords)
Expand Down
8 changes: 6 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
# Racmacs 1.1.38
* Add option to specify a subset of antigens and sera for which to calculate blobs in the `bootstrapBlobs()` function
* Add method for plotting a map using ggplot i.e. `ggplot(map)`.
* When coloring by sequence a more distinct color pallette is used
* When coloring by sequence a more distinct color palette is used

# Racmacs 1.1.39
* Correct error when plotting cases where blobs were calculated for only 1 antigen / serum
Expand All @@ -189,7 +189,7 @@
# Racmacs 1.1.40
* Add some options to view.acmap to set the starting viewer translation, rotation and zoom
* Add `grid.lwd` option to control grid linewidth in `ggplot(map)`
* Add antigen and sera names to vector when retreiving antigen and sera attributes like `agFill()`
* Add antigen and sera names to vector when retrieving antigen and sera attributes like `agFill()`

# Racmacs 1.2.0
* Add new options and default methods to use when merging titers as described for `RacMerge.options()`
Expand Down Expand Up @@ -221,3 +221,7 @@
# Racmacs 1.2.7
* `on.exit()` calls added to code in `R/map_plot.R` and `inst/shinyapps/RacmacsGUI/app.R` where changes to graphical parameters and user options are made.
* `snapshotMap()` function removed.

# Racmacs 1.2.8
* Function `splitTiterLayers()` now exported.
* Use `readxl::read_excel()` for reading excel files instead of `gdata::read.xls()`
2 changes: 1 addition & 1 deletion R/map_blobs.R
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ srBaseBootstrapBlobs <- function(map, optimization_number = 1) {
#' @param serum The serum to get the blob for
#' @param optimization_number Optimization number from which to get blob information
#'
#' @returns Returns an object of class "blob" that can be plotted using the `blob()` funciton.
#' @returns Returns an object of class "blob" that can be plotted using the `blob()` function.
#' @name ptTriangulationBlob
#'
#' @family map diagnostic functions
Expand Down
6 changes: 3 additions & 3 deletions R/map_diagnostics_bootstrap.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#' @details ## Bootstrapping methods
#'
#' __"resample"__:
#' The [resample boostrap](https://en.wikipedia.org/wiki/Bootstrapping_(statistics)#Case_resampling)
#' The [resample bootstrap](https://en.wikipedia.org/wiki/Bootstrapping_(statistics)#Case_resampling)
#' is the most standard bootstrap method, a random resample of the titer table data is
#' taken _with replacement_. Depending on your specification, resampling is applied across
#' either individual antigens, individual sera or both antigens and sera.
Expand All @@ -53,7 +53,7 @@
#' The noisy bootstrap, sometimes termed a
#' [smooth bootstrap](https://en.wikipedia.org/wiki/Bootstrapping_(statistics)#Smooth_bootstrap)
#' involved adding normally distributed noise to each observation. The distribution of this noise can
#' be parametrised through the `ag_noise_sd` and `titer_noise_sd` arguments. `titer_noise_sd` refers to the
#' be parameterised through the `ag_noise_sd` and `titer_noise_sd` arguments. `titer_noise_sd` refers to the
#' standard deviation (on the log scale) of noise added to each individual titer measurement in the table,
#' while `antigen_noise_sd` refers to the standard deviation of noise applied to titers for each antigen.
#' The reason for this distinction is that we have noticed with repeat measurements of influenza data there
Expand Down Expand Up @@ -158,7 +158,7 @@ hasBootstrapData <- function(map, optimization_number) {
#' Get bootstrap coordinates associated with a map
#'
#' This can be used to get information about the bootstrap run results
#' after `boostrapMap()` has been run.
#' after `bootstrapMap()` has been run.
#'
#' @param map The map object
#'
Expand Down
2 changes: 1 addition & 1 deletion R/map_diagnostics_bootstrap_blobs.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#' in the bootstrap repeats. Note however that the accuracy of these estimates
#' will depend on the number of bootstrap repeats performed, for example whether
#' 100 or 1000 repeats were performed in the initial calculations using
#' `boostrapMap()`.
#' `bootstrapMap()`.
#'
#' @param map The acmap data object
#' @param conf.level The proportion of positional variation captured by each blob
Expand Down
2 changes: 1 addition & 1 deletion R/map_diagnostics_leverage.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#' These functions attempt to estimate leverage of each antigen, sera or titer
#' by removing it from the data, relaxing the map, then calculating the rmsd of
#' the procrustes comparison between the original and newly relaxed map. Column
#' bases will be recalculated unless you have specifed them as fixed with
#' bases will be recalculated unless you have specified them as fixed with
#' `fixedColBases()`.
#'
#' @param map An acmap object
Expand Down
3 changes: 3 additions & 0 deletions R/map_merge.R
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,10 @@ RacMerge.options <- function(
#'
#' @param map An acmap object with titer table layers
#'
#' @returns A list of acmap objects
#'
#' @family map merging functions
#' @export
#'
splitTiterLayers <- function(
map
Expand Down
2 changes: 1 addition & 1 deletion R/map_optimizations.R
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ listOptimizations <- function(map) {

#' Get optimization details from an acmap object
#'
#' Gets the details associated with the currently selected or specifed acmap
#' Gets the details associated with the currently selected or specified acmap
#' optimization as a list.
#'
#' @param map The acmap data object
Expand Down
4 changes: 2 additions & 2 deletions R/map_optimize.R
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ mapRelaxed <- function(
#' @param optimization_number The map optimization number
#' @param grid_spacing When doing a grid search of more optimal point positions
#' the grid spacing to use
#' @param stress_lim The stess difference to use when classifying a point as
#' @param stress_lim The stress difference to use when classifying a point as
#' "hemisphering" or not
#' @param options A named list of options to pass to `RacOptimizer.options()`
#'
Expand Down Expand Up @@ -602,7 +602,7 @@ checkHemisphering <- function(
#' @param optimization_number The map optimization number to apply it to
#' @param grid_spacing Grid spacing in antigenic units of the search grid to use
#' when searching for more optimal positions
#' @param max_iterations The maximum number of interations of searching for
#' @param max_iterations The maximum number of iterations of searching for
#' trapped points then relaxing the map to be performed
#' @param options List of named optimizer options, see `RacOptimizer.options()`
#'
Expand Down
2 changes: 1 addition & 1 deletion R/map_procrustes.R
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ hasProcrustes <- function(map, optimization_number = 1) {

#' Realigns optimizations in the map
#'
#' Realigns all map optimizations through rotatation and translation to match
#' Realigns all map optimizations through rotation and translation to match
#' point positions as closely as possible to the first optimization run. This
#' is done by default when optimizing a map and makes comparing point positions
#' in each optimization run much easier to do by eye.
Expand Down
13 changes: 10 additions & 3 deletions R/map_props.R
Original file line number Diff line number Diff line change
Expand Up @@ -98,18 +98,25 @@ titerTable <- function(map) {
#' through the `titerTable()` function, the flat version of the titer table is
#' retrieved (only really a relevant distinction for merged maps). When you set
#' titers through `titerTable<-()` titer table layers are lost. These functions
#' allow you to manipulate the flat version without effecting the titer table
#' allow you to manipulate the flat version without affecting the titer table
#' layers information.
#'
#' @param map The acmap object
#' @param value A character matrix of titers to set
#'
#' @returns Returns a character matrix of titers.
#'
#' @name titerTableFlat
#' @family map attribute functions
#'

#' @rdname titerTable
#' @rdname titerTableFlat
titerTableFlat <- function(map) {
check.acmap(map)
map$titer_table_flat
}

#' @rdname titerTable
#' @rdname titerTableFlat
`titerTableFlat<-` <- function(map, value) {
check.acmap(map)
check.dimensions(value, map)
Expand Down
2 changes: 1 addition & 1 deletion R/map_props_optimizations.R
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ mapTranslation <- optimization_getter(ac_opt_get_translation)
#'
#' Note that although the output from `colBases()` might be the same in a case
#' where a minimum column basis was set or a case where column bases were set
#' explcitely, when a minimum column basis is set, the column bases will still
#' explicitly, when a minimum column basis is set, the column bases will still
#' depend on the log titers recorded against a given sera, so changing the
#' titers may therefore change the actual column bases calculated. For fixed
#' column bases case, column bases will remain fixed at their values
Expand Down
4 changes: 2 additions & 2 deletions R/map_stress.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#' Return calculated table distances for an acmap
#'
#' Takes the acmap object and, assuming the column bases associated with the
#' currently selected or specifed optimization, returns the table distances
#' currently selected or specified optimization, returns the table distances
#' calculated from the titer data. For more information on column bases and
#' their role in antigenic cartography see
#' `vignette("intro-to-antigenic-cartography")`
Expand Down Expand Up @@ -233,7 +233,7 @@ mapResiduals <- function(
#' Recalculate the stress associated with an acmap optimization
#'
#' Recalculates the stress associated with the currently selected or
#' user-specifed optimization.
#' user-specified optimization.
#'
#' @param map The acmap data object
#' @param optimization_number The optimization number
Expand Down
16 changes: 9 additions & 7 deletions R/rac_process_titers.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,19 @@ read.titerTable <- function(filepath) {
} else if (grepl("\\.xls$", filepath) | grepl("\\.xlsx$", filepath)) {

# Check gdata package installed
package_required("gdata")
package_required("readxl")

# Read from xls
titer_table <- gdata::read.xls(
xls = filepath,
row.names = 1,
check.names = FALSE,
stringsAsFactors = FALSE,
colClasses = "character"
titer_table_tibble <- readxl::read_excel(
path = filepath,
col_types = "text",
.name_repair = "minimal"
)

# Convert to a character matrix
titer_table <- as.matrix(titer_table_tibble[,-1])
rownames(titer_table) <- titer_table_tibble[[1]]

} else if (grepl("\\.txt$", filepath)) {

# Read from tab delimted txt
Expand Down
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

<!-- badges: start -->
[![R-CMD-check](https://github.com/acorg/Racmacs/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/acorg/Racmacs/actions/workflows/R-CMD-check.yaml)
[![CRAN status](https://www.r-pkg.org/badges/version/Racmacs)](https://CRAN.R-project.org/package=Racmacs)
<!-- badges: end -->

<img src="man/figures/logo.png" align="right" style="width:200px; margin-top:40px">
Expand All @@ -11,13 +12,23 @@ The Racmacs package provides a toolkit for making antigenic maps from assay data
For an introduction to antigenic cartography, see the article [an introduction to antigenic cartography](https://acorg.github.io/Racmacs/articles/intro-to-antigenic-cartography.html). For a general introduction to using Racmacs to make an antigenic map from titer data see the article [making an antigenic map from titer data](https://acorg.github.io/Racmacs/articles/making-a-map-from-scratch.html). For documentation of the functions available see the [references](https://acorg.github.io/Racmacs/reference/index.html) section.

## Installation instructions
### Install the devtools package
### Installing the latest CRAN release
Pre-compiled version of Racmacs can now be installed directly from CRAN with:
```R
install.packages("Racmacs")
```

### Installing the latest development release
The latest developmental release of Racmacs can be installed from github but may require some setting up
of your compiler toolchain as described below.

#### Install the devtools package
If not already installed, install the `devtools` package, this provides functions to help with installation.
```R
install.packages("devtools")
```

### Install Racmacs
#### Install Racmacs
Now you can install Racmacs directly from the latest development source code. In future pre-built binary versions will
also be included.

Expand All @@ -29,8 +40,6 @@ devtools::install_github("acorg/Racmacs")
#### Problems compiling on MacOS
When installing Racmacs on a mac os, compilation will most likely fail under the default setup since the necessary libraries that are linked to cannot be found. The recommended solution, which should both solve this problem and speed up the code, is for mac users to follow the instructions below for setting up your environment to use the gcc and associated fortran compiler.

In the future we will try to provide pre-built binary versions of Racmacs for the latest major operating systems and R versions to avoid the need to build the package locally.

#### Building Racmacs to run code in parallel
Racmacs uses [OpenMP](https://www.openmp.org) instructions to specify when code can be run in parallel to increase performance. The resulting speed-up can be significant, but you need to check whether the compiler you use supports OpenMP.

Expand Down
32 changes: 2 additions & 30 deletions cran-comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,5 @@

0 errors | 0 warnings | 1 note

* This is a new release.

## Alterations upon resubmission

Redundant "R" removed from title.

Full name provided in the Author and Maintainer field.

Package description expanded and reference added describing the methods implemented.

Size of package tarball reduced.

Return value information added to all .Rd files where value information was
found to be missing.

Looked for but could not find examples of cases where the user's home filespace
or package directory are written to. Any further pointers on where potential
violations of this policy were found would be greatly appreciated. Many thanks!

`on.exit()` calls added to code in `R/map_plot.R` and
`inst/shinyapps/RacmacsGUI/app.R` where changes to graphical parameters and
user options are made.

## Alterations upon resubmission 2

Unnecessary additional spaces remove from the "Description" field of the package
DESCRIPTION file.

Documentation added for the return value for the `view()` and
`keepOptimizations()` functions
Package was archived because the function `gdata::read.xls()` was removed, this
is now replaced in this version by using `readxl::read_excel()` function.
Loading

0 comments on commit 53b4f99

Please sign in to comment.