-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
3ec335d
commit ee494c6
Showing
17 changed files
with
404 additions
and
403 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,24 @@ | ||
# Generated by roxygen2: do not edit by hand | ||
|
||
export(crossover_cpp) | ||
export(evaluate_fitness_cpp) | ||
export(initialize_population_cpp) | ||
export(mutation_cpp) | ||
export(plot_fitness) | ||
export(plot_fitness_history) | ||
export(plot_population) | ||
export(replacement_cpp) | ||
export(selection_cpp) | ||
import(SummarizedExperiment) | ||
import(animation) | ||
import(biocViews) | ||
import(ggplot2) | ||
import(graphics) | ||
import(rlang) | ||
import(sessioninfo) | ||
importFrom(Rcpp,evalCpp) | ||
importFrom(Rcpp,sourceCpp) | ||
useDynLib(BioGA, .registration = TRUE) | ||
# Generated by roxygen2: do not edit by hand | ||
|
||
export(crossover_cpp) | ||
export(evaluate_fitness_cpp) | ||
export(initialize_population_cpp) | ||
export(mutation_cpp) | ||
export(plot_fitness) | ||
export(plot_fitness_history) | ||
export(plot_population) | ||
export(replacement_cpp) | ||
export(selection_cpp) | ||
importFrom(Rcpp,evalCpp) | ||
importFrom(Rcpp,sourceCpp) | ||
importFrom(SummarizedExperiment,SummarizedExperiment) | ||
importFrom(animation,saveGIF) | ||
importFrom(biocViews,getBiocViews) | ||
importFrom(ggplot2,ggplot) | ||
importFrom(ggplot2,ggtitle) | ||
importFrom(graphics,boxplot) | ||
importFrom(graphics,hist) | ||
importFrom(graphics,par) | ||
importFrom(rlang,local_options) | ||
importFrom(sessioninfo,session_info) | ||
useDynLib(BioGA, .registration = TRUE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
test_that("crossover_cpp not produce error or warning", { | ||
# Load The PACKAGE | ||
library(BioGA) | ||
|
||
# example of usage | ||
genomic_data <- matrix(rnorm(100), nrow = 10, ncol = 10) | ||
population <- BioGA::initialize_population_cpp(genomic_data, | ||
population_size = 5) | ||
fitness <- BioGA::evaluate_fitness_cpp(genomic_data, population) | ||
selected_parents <- BioGA::selection_cpp(population, fitness, | ||
num_parents = 2) | ||
BioGA::crossover_cpp(selected_parents, offspring_size = 2) | ||
|
||
testthat::expect_no_warning(BioGA::crossover_cpp(selected_parents, | ||
offspring_size = 2), | ||
message = "bananas") | ||
|
||
testthat::expect_no_error(BioGA::crossover_cpp(selected_parents, | ||
offspring_size = 2), | ||
message = "bananas") | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
test_that("evalutate_cpp not produce error or warning", { | ||
# example of usage | ||
genomic_data <- matrix(rnorm(100), nrow = 10, ncol = 10) | ||
population <- BioGA::initialize_population_cpp(genomic_data, | ||
population_size = 5) | ||
|
||
output <- tryCatch( | ||
BioGA::evaluate_fitness_cpp(genomic_data, population), | ||
error = function(e) return(NA) | ||
) | ||
|
||
testthat::expect_no_warning(BioGA::evaluate_fitness_cpp(genomic_data, | ||
population), | ||
message = "bananas") | ||
testthat::expect_no_error(BioGA::evaluate_fitness_cpp(genomic_data, | ||
population), | ||
message = "bananas") | ||
}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
test_that("mutation_cpp not produce error or warning", { | ||
# example of usage | ||
genomic_data <- matrix(rnorm(100), nrow = 10, ncol = 10) | ||
population <- BioGA::initialize_population_cpp(genomic_data, | ||
population_size = 5) | ||
fitness <- BioGA::evaluate_fitness_cpp(genomic_data, population) | ||
selected_parents <- BioGA::selection_cpp(population, | ||
fitness, num_parents = 2) | ||
offspring <- BioGA::crossover_cpp(selected_parents, offspring_size = 2) | ||
BioGA::mutation_cpp(offspring, mutation_rate = 0) | ||
|
||
testthat::expect_no_warning(BioGA::mutation_cpp(offspring, | ||
mutation_rate = 0), | ||
message = "bananas") | ||
|
||
testthat::expect_no_error(BioGA::mutation_cpp(offspring, | ||
mutation_rate = 0), | ||
message = "bananas") | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
test_that("crossover_cpp not produce error or warning", { | ||
# Load The PACKAGE | ||
library(BioGA) | ||
|
||
# example of usage | ||
population <- matrix(runif(100), nrow = 10, ncol = 10) | ||
BioGA::plot_population(population) | ||
|
||
testthat::expect_no_warning(BioGA::plot_population(population), | ||
message = "bananas") | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
test_that("selection_cpp returns a matrix with correct dimensions", { | ||
# Load The PACKAGE | ||
library(BioGA) | ||
|
||
# example of usage | ||
genomic_data <- matrix(rnorm(100), nrow = 10, ncol = 10) | ||
population <- BioGA::initialize_population_cpp(genomic_data, | ||
population_size = 5) | ||
fitness <- BioGA::evaluate_fitness_cpp(genomic_data, population) | ||
selected_population <- BioGA::selection_cpp(population, fitness, | ||
num_parents = 2) | ||
|
||
# Check dimensions | ||
expect_equal(2, nrow(selected_population)) | ||
|
||
}) | ||
|
||
|
||
test_that("selection_cpp returns a matrix with correct dimensions", { | ||
# Load The PACKAGE | ||
library(BioGA) | ||
|
||
# example of usage | ||
genomic_data <- matrix(rnorm(100), nrow = 10, ncol = 10) | ||
population <- BioGA::initialize_population_cpp(genomic_data, | ||
population_size = 5) | ||
fitness <- BioGA::evaluate_fitness_cpp(genomic_data, population) | ||
selected_population <- BioGA::selection_cpp(population, fitness, | ||
num_parents = 2) | ||
|
||
testthat::expect_no_warning(BioGA::evaluate_fitness_cpp(genomic_data, | ||
population), | ||
message = "bananas") | ||
testthat::expect_no_error(BioGA::evaluate_fitness_cpp(genomic_data, | ||
population), | ||
message = "bananas") | ||
|
||
}) |
Oops, something went wrong.