Skip to content

Commit

Permalink
Merge pull request #53 from moshejasper/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
moshejasper authored Mar 21, 2021
2 parents 8988aa3 + d6e3c90 commit 915a76c
Show file tree
Hide file tree
Showing 15 changed files with 196 additions and 813 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
Package: kindisperse
Title: Simulate and Estimate Close-Kin Dispersal Kernels
Version: 0.9.0
Version: 0.9.1
Authors@R:
person(given = "Moshe-Elijah",
family = "Jasper",
role = c("aut", "cre"),
email = "[email protected]",
comment = c(ORCID = "0000-0003-4541-3223"))
Description: Functions for simulating and estimating kinship-related dispersal, based
Description: Functions for simulating and estimating kinship-related dispersal. Based
on the methods described in M. Jasper, T.L. Schmidt., N.W. Ahmad, S.P. Sinkins & A.A.
Hoffmann (2019) <doi:10.1111/1755-0998.13043> "A genomic approach to inferring kinship
reveals limited intergenerational dispersal in the yellow fever mosquito".
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ importFrom(shiny,shinyApp)
importFrom(shiny,sidebarLayout)
importFrom(shiny,sidebarPanel)
importFrom(shiny,sliderInput)
importFrom(shiny,strong)
importFrom(shiny,tabPanel)
importFrom(shiny,tableOutput)
importFrom(shiny,textInput)
Expand Down
80 changes: 80 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# kindisperse 0.9.1

* Added a `NEWS.md` file to track changes to the package.
* Fixed several display and layout issues in Shiny app
* Changed parameter of 'elongate' function from 'shape' to 'aspect' to make clear we are manipulating aspect ratios of a rectangular area.

# kindisperse 0.9.0

* Permutation functions now output mean instead of median
* Changed all 'dsigma' parameters & references to 'posigma'
* Changed simulation 'method' parameter input from 'Gamma' to 'gamma'
* Changed 'lifestage' parameter values from 'larva' to 'immature' and from 'oviposition' to 'ovipositional'
* Enable package function messages to be suppressed
* Updated app tutorial and documentation (including vignettes)
* Updated KinPairSimulation '<-sampledim' method
* Added Table of Contents to README

# kindisperse 0.8.0

* Added Mentari Court field data for example calculations
* Added 2d rectangular dimensions to simulate & sample functions
* Changed the way 'sample_kindist' deals with dimensions
* Added helper function 'elongate' for dimension handling
* Changed 'composite' default parameter value from 2 to 1 in function 'axpermute'
* Changed 'juvsigma' parameter & references to 'initsigma' in line with usage in paper
* included rgamma function
* Improved simgraph commands (simgraph_data, simgraph_graph)
* Cleaned up app
* Removed unneeded class methods (to_tibble). Fixed kernelshape method
* Improved package load
* Updated app interface
* Updated documentation (CRAN compatibility)

# kindisperse 0.7.0

* Added options to import data from files within app
* Updated readme, package startup & vignettes
* Added gamma kernel with shape parameter to simulations

# kindisperse 0.6.0

* Changed 'category' parameter in all functions and classed to 'kinship' parameter
* Added file writing and reading functions (write_kindata, read_kindata, kinpair_to_tsv, tsv_to_kinpair, kinpair_to_csv, csv_to_kinpair, kinpair_to_tibble)
* Added appdata interface environment & functions to access it (mount_appdata, unmount_appdata, display_appdata, reset_appdata, retrive_appdata)
* Enable loading of appdata into app (functions and interface)
* Improved KinPairSimulation object print function

# kindisperse 0.5.0

* Replaced file-based memory storage with environment storage in app
* Added 'distances' method for KinPairData & KinPairSimulation classes
* Added functions to test class membership
* Updated axial functions to take KinPairData &c classes as input
* Limit sample size in axial permuation functions under 'std' option
* Updated class definitions
* Added class constructor functions
* Added class import functions
* Updated dependencies

# kindisperse 0.4.0

* Introduced KinPairData & KinpairSimulation classes
* Added and updated class methods & documentation
* Updated app with axial functions
* Fixed bug in 'axials_decompose' function

# kindisperse 0.3.0

* improved NAMESPACE
* add axial function
* document many functions

# kindisperse 0.2.0

* added temp folder & contents to fix app bug
* removed broken dependencies

# kindisperse 0.1.0 & prior

* initial commit
121 changes: 54 additions & 67 deletions R/app.R
Original file line number Diff line number Diff line change
Expand Up @@ -557,31 +557,27 @@ ui <- fluidPage(
min = 1, max = 250, value = 50
),

h5("Site dimensions"),

column(width = 4,
strong("Site dimensions (n x n)"),

numericInput(
inputId = "sim_simple_dimx",
label = "(n x n)",
label = "",
min = 25, max = 1000, value = 1000
)),

column(width = 4,
hr(),
checkboxInput(
inputId = "sim_simple_bothdims",
label = h5("link dimensions"),
value = TRUE
)
),

column(width = 4,
numericInput(
inputId = "sim_simple_dimy",
label = "",
min = 25, max = 1000, value = 1000
)
conditionalPanel(
condition = "input.sim_simple_bothdims == false",
numericInput(
inputId = "sim_simple_dimy",
label = "",
min = 25, max = 1000, value = 1000
)
),

checkboxInput(
inputId = "sim_simple_bothdims",
label = h5("square site"),
value = TRUE
),

selectInput(
Expand Down Expand Up @@ -686,31 +682,27 @@ ui <- fluidPage(
min = 1, max = 250, value = 50
),

h5("Site dimensions"),

column(width = 4,
strong("Site dimensions (n x n)"),

numericInput(
inputId = "sim_composite_dimx",
label = "(n x n)",
min = 25, max = 1000, value = 1000
)),
numericInput(
inputId = "sim_composite_dimx",
label = "",
min = 25, max = 1000, value = 1000
),

column(width = 4,
hr(),
checkboxInput(
inputId = "sim_composite_bothdims",
label = h5("link dimensions"),
value = TRUE
)
conditionalPanel(
condition = "input.sim_composite_bothdims == false",
numericInput(
inputId = "sim_composite_dimy",
label = "",
min = 25, max = 1000, value = 1000
)
),

column(width = 4,
numericInput(
inputId = "sim_composite_dimy",
label = "",
min = 25, max = 1000, value = 1000
)
checkboxInput(
inputId = "sim_composite_bothdims",
label = h5("square site"),
value = TRUE
),

selectInput(
Expand Down Expand Up @@ -882,33 +874,28 @@ ui <- fluidPage(

conditionalPanel(
condition = "input.samp_checkbox.includes('use_samp_dims')",
h5("choose trap dimensions"),

column(width = 5,

numericInput(
inputId = "samp_dimx",
label = "(n x n)",
min = 25, max = 1000, value = 1000
)),

column(width = 2,
hr(),
checkboxInput(
inputId = "samp_bothdims",
label = h5("link"),
value = TRUE
)
strong("Choose site dimensions (n x n)"),

numericInput(
inputId = "samp_dimx",
label = "",
min = 25, max = 1000, value = 1000
),

column(width = 5,
numericInput(
inputId = "samp_dimy",
label = "",
min = 25, max = 1000, value = 1000
)
)
),
conditionalPanel(
condition = "input.samp_bothdims == false",
numericInput(
inputId = "samp_dimy",
label = "",
min = 25, max = 1000, value = 1000
)
),

checkboxInput(
inputId = "samp_bothdims",
label = h5("square site"),
value = TRUE
)),

conditionalPanel(
condition = "input.samp_checkbox.includes('use_samp_spacing')",
Expand Down Expand Up @@ -1912,7 +1899,7 @@ server <- function(input, output, session) {

output$est_smp_ci_table <- renderTable({
# est_smp_ci()
tibble("Lower" = est_smp_ci()[1], "Median" = est_smp_ci()[2], "Upper" = est_smp_ci()[3])
tibble("Lower" = est_smp_ci()[1], "Mean" = est_smp_ci()[2], "Upper" = est_smp_ci()[3])
# tibble("a" = 1, "b" = 2, "c" = 3)
})

Expand Down Expand Up @@ -1962,7 +1949,7 @@ server <- function(input, output, session) {

output$est_std_ci_table <- renderTable({
# est_smp_ci()
tibble("Lower" = est_std_ci()[1], "Median" = est_std_ci()[2], "Upper" = est_std_ci()[3])
tibble("Lower" = est_std_ci()[1], "Mean" = est_std_ci()[2], "Upper" = est_std_ci()[3])
# tibble("a" = 1, "b" = 2, "c" = 3)
})

Expand Down
2 changes: 1 addition & 1 deletion R/kindisperse-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#' @importFrom shiny column conditionalPanel fluidPage fluidRow mainPanel navbarPage sidebarLayout sidebarPanel tabPanel titlePanel shinyApp downloadButton
#' @importFrom shiny actionButton checkboxGroupInput checkboxInput fileInput numericInput radioButtons selectInput sliderInput downloadHandler
#' @importFrom shiny eventReactive observeEvent reactive updateNumericInput updateSelectInput
#' @importFrom shiny h1 h2 h3 h4 h5 h6 hr icon p
#' @importFrom shiny h1 h2 h3 h4 h5 h6 hr icon p strong
#' @importFrom shiny plotOutput renderPlot renderTable renderText tableOutput textOutput renderPrint textInput
#' @importFrom shinythemes shinytheme
#' @importFrom stats quantile rexp rnorm runif rweibull rgamma
Expand Down
12 changes: 6 additions & 6 deletions R/sample_kindist.R
Original file line number Diff line number Diff line change
Expand Up @@ -104,18 +104,18 @@ sample_kindist <- function(kindist, upper = NULL, lower = NULL, spacing = NULL,

# additional comment

#' Change the shape of a rectangle while preserving area
#' Change the shape (aspect ratio) of a rectangle while preserving area
#'
#' @param dims Original rectangle dimensions - either single number (length of side of square) or length 2 numeric vector (lenghts of sides x and y of rectangle)
#' @param shape Ratio of side lengths x & y in the new rectangle
#' @param dims Original rectangle dimensions - either single number (length of side of square) or length 2 numeric vector (lengths of sides x and y of rectangle)
#' @param aspect Aspect ratio of side lengths x & y (i.e. x/y) in the new rectangle
#'
#' @return Returns a numeric vector containing the side lengths c(x, y) of a transformed rectangle with preserved area
#' @export
#'
#' @examples
#' elongate(10, 100)
#' elongate(c(5, 125), 4)
elongate <- function(dims, shape = 1){
elongate <- function(dims, aspect = 1){
if (length(dims) > 2){
stop("'dims' cannot have length > 2")
}
Expand All @@ -127,7 +127,7 @@ elongate <- function(dims, shape = 1){
}

# calculate dimensions
xdim <- sqrt(area / shape)
xdim <- sqrt(area * aspect)
ydim <- area / xdim

return(c(xdim, ydim))
Expand All @@ -136,7 +136,7 @@ elongate <- function(dims, shape = 1){
#' Change the dimensions of a KinPairSimulation Object and shift kinpairs so at least one individual is within the area
#'
#' @param kindist \code{KinPairSimulation} - \code{KinPairSimulation} Class Object
#' @param dims New site dimensions - either single number (length of side of square) or length 2 vector (lenghts of sides x and y of rectangle)
#' @param dims New site dimensions - either single number (length of side of square) or length 2 vector (lengths of sides x and y of rectangle)
#'
#' @return returns a rebased object of class \code{KinPairSimulation} with adjusted simulation dimensions
#' @export
Expand Down
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: "KINDISPERSE 0.9.0"
title: "KINDISPERSE 0.9.1"
output:
github_document:
toc: true
Expand Down
Loading

0 comments on commit 915a76c

Please sign in to comment.