Giter VIP home page Giter VIP logo

hostswitch's Introduction

HostSwitch

HostSwitch: An R Package to simulate host switching by a parasite

CRAN_Status_Badge Project Status: Active – The project has reached a stable, usable state and is being actively developed. R-CMD-check minimal R version License: AGPL v3

Trivellone, V. ORCID iD icon; Araujo B.L., S. ORCID iD icon; Panassiti, B. ORCID iD icon

R/HostSwitch is an R package that uses an individual-based model to simulate dispersion and host switch events by a consumer. The host-consumer association refers to any type of symbiotic (sensu lato) biological interaction.

Installation

Install R/HostSwitch from CRAN using:

install.packages("HostSwitch")

or from GitHub using:

devtools::install_github(repo <- "berndpanassiti/HostSwitch",build_vignettes = TRUE)

Example use

Try the following example to simulate dispersal and host switch events by a consumer. You can set up a maximum of 20 generations and 3 simulations:

library(HostSwitch)
simulated_quantities <- simHostSwitch(seed=123,n_sim=3,n_generation=20)

Also try summaryHostSwitch function to get summary statistics of simulated quantities of interest: optimum phenotypes that Consumers should have to be favored by the current Resource (pRes_sim), optimum phenotypes that Consumers should have to be favored by the novel Resource (pRes_new_sim), individual phenotype values of the Consumers (pInd), number of migrating individuals at each generation (pInd_jump_sim), individual phenotype values of the Consumers who disperse in a novel Resource (pInd_whichjump_sim), and individual phenotype values of the Consumers who successful colonize a novel Resource (pInd_whichsurv_sim).

summaryHostSwitch(simulated_quantities)

Finally, try plotHostSwitch to plot of the simulated quantities and to select a specific simulation use the parameter "n_sim":

plotHostSwitch(simulated_quantities, sim_n = 1)

You can compare two "simHostSwitch" objects using the function testHostSwitch. The comparison is between three estimated quantities: "j" total number of dispersing events; "s" total number of successful host switch events; "d" distance between the pRes_sim andpRes_new_sim for the generations where a successful host switch occurs, or phenotype distance. The The available tests are:”t” for t-test (parametric), and ”w” for Wilcoxon-test (non-parametric). For this comparison the number of simulation need to be greater than 1.

m1 <- simHostSwitch(seed=123,n_sim=100,b=10) 
m2 <- simHostSwitch(seed=123,n_sim=100,b=15) 
testHostSwitch(simulated_quantities1=m1,simulated_quantities2=m2,parameter="j",test="t",plot=FALSE)

Using Shiny application for R, it is possible to run an interactive plot to simulate host switching on the web without detailed knowledge of the underlying code:

shinyHostSwitch()

License

The R/HostSwitch package as a whole is distributed under GPL-3 (GNU General Public License version 3).

hostswitch's People

Contributors

berndpanassiti avatar reptalus avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

reptalus

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.