knitr::opts_chunk$set(echo = TRUE)
Load the package
library(rcombinator)
Create the sequences set the parameters for the simulation.
num_sequences <- 2 sequence_length <- 50 sequences <- get_random_sequence(sequence_length, num_sequences) num_jumps <- 10 time_jump <- 10^6 transition_matrix <- get_k80_matrix(time_jump) burst_threshold <- 0.2 burst_mean <- 2 flip_probability <- 0.3
Let the sequences evolve, and collect the data.
A <- simulate_recombination_cheap(sequences, num_jumps, transition_matrix, burst_threshold, burst_mean, flip_probability) library(magrittr) library(tidyr) A <- A %>% unite(seq1, seq2, col="comparing", sep=" and ")
Plot the data.
library(ggplot2) p1 <- ggplot(data = A, aes(x=time, y=seq_dist, colour=comparing)) p1 <- p1 + geom_step() p1 <- p1 + labs(x = "time (in 1M years)", y = "sequence distance", title = "Comparing sequence distances over time with recombination") print(p1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.