Skip to content

Commit

Permalink
Merge branch 'devel'
Browse files Browse the repository at this point in the history
  • Loading branch information
danymukesha committed Apr 3, 2024
2 parents d3906f7 + 322682a commit 23de855
Show file tree
Hide file tree
Showing 13 changed files with 139 additions and 217 deletions.
Empty file modified BioGA.Rproj
100644 → 100755
Empty file.
80 changes: 40 additions & 40 deletions DESCRIPTION
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
Type: Package
Package: BioGA
Title: Bioinformatics Genetic Algorithm (BioGA)
Version: 0.99.0
Authors@R:
person("Dany", "Mukesha", , "danymukesha@gmail.com",
role = c("aut", "cre"),
comment = c(ORCID = "0009-0001-9514-751X"))
Description: Genetic algorithm are a class of optimization algorithms
inspired by the process of natural selection and genetics. This
package allows users to analyze and optimize high throughput genomic
data using genetic algorithms. The functions provided are implemented
in C++ for improved speed and efficiency, with an easy-to-use
interface for use within R.
License: MIT + file LICENSE
URL: https://danymukesha.github.io/BioGA/
BugReports: https://github.com/danymukesha/BioGA/issues
Imports:
ggplot2,
graphics,
Rcpp,
sessioninfo,
SummarizedExperiment,
animation,
rlang,
biocViews
Suggests:
knitr,
rmarkdown,
testthat (>= 3.0.0)
LinkingTo:
Rcpp
VignetteBuilder:
knitr
biocViews: ExperimentalDesign, Technology
Encoding: UTF-8
LazyData: false
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.1
Config/testthat/edition: 3
Type: Package
Package: BioGA
Title: Bioinformatics Genetic Algorithm (BioGA)
Version: 0.99.2
Authors@R:
person("Dany", "Mukesha", , "danymukesha@gmail.com",
role = c("aut", "cre"),
comment = c(ORCID = "0009-0001-9514-751X"))
Description: Genetic algorithm are a class of optimization algorithms
inspired by the process of natural selection and genetics. This
package allows users to analyze and optimize high throughput genomic
data using genetic algorithms. The functions provided are implemented
in C++ for improved speed and efficiency, with an easy-to-use
interface for use within R.
License: MIT + file LICENSE
URL: https://danymukesha.github.io/BioGA/
BugReports: https://github.com/danymukesha/BioGA/issues
Imports:
ggplot2,
graphics,
Rcpp,
sessioninfo,
SummarizedExperiment,
animation,
rlang,
biocViews
Suggests:
knitr,
rmarkdown,
testthat (>= 3.0.0)
LinkingTo:
Rcpp
VignetteBuilder:
knitr
biocViews: ExperimentalDesign, Technology
Encoding: UTF-8
LazyData: false
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.1
Config/testthat/edition: 3
1 change: 0 additions & 1 deletion NAMESPACE
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Generated by roxygen2: do not edit by hand

export(animate_fitness_history)
export(crossover_cpp)
export(evaluate_fitness_cpp)
export(initialize_population_cpp)
Expand Down
10 changes: 7 additions & 3 deletions NEWS.md
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# BioGA 0.99.0

* Added a `NEWS.md` file to track changes to the package.
# BioGA 0.99.2

# BioGA 0.99.1

# BioGA 0.99.0

* Added a `NEWS.md` file to track changes to the package.
89 changes: 89 additions & 0 deletions R/Plottings.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
#' Plot Fitness Change Over Generations
#'
#' Plot the change in fitness values over generations.
#'
#' @param fitness_history A list containing fitness values for
#' each generation.
#'
#' @return Plot of fitness history
#'
#' @examples
#' # example of usage
#' fitness_history <- list(c(10, 8, 6, 4, 2), c(9, 7, 5, 3, 1))
#' plot_fitness_history(fitness_history)
#'
#' @export
plot_fitness_history <- function(fitness_history) {
# Extract fitness values
fitness_values <- unlist(fitness_history)

# Create generation index
generations <-
rep(
seq_along(fitness_history),
vapply(fitness_history, length, integer(1))
)

# Create data frame
df <- data.frame(
Generation = generations,
Fitness = fitness_values
)

# Plot
ggplot2::ggplot(df, ggplot2::aes_string(
x = "Generation",
y = "Fitness"
)) +
geom_line() +
labs(x = "Generation", y = "Fitness") +
ggplot2::ggtitle("Fitness Change Over Generations")
}



#' Plot Fitness Values
#'
#' Plot the fitness values of the population over generations.
#'
#' @param fitness_values A numeric vector containing fitness values.
#'
#' @return Plot of fitness
#'
#' @examples
#' # example of usage
#' fitness_values <- c(10, 8, 6, 4, 2)
#' plot_fitness(fitness_values)
#'
#' @export
plot_fitness <- function(fitness_values) {
generations <- seq_along(fitness_values)
plot(generations, fitness_values,
type = "l",
xlab = "Generations", ylab = "Fitness",
main = "Fitness Values Over Generations"
)
}


#' Plot Population Distribution
#'
#' Plot the distribution of individuals in the population.
#'
#' @param population A numeric matrix containing the population data.
#'
#' @return Plot of population
#'
#' @import graphics
#'
#' @examples
#' # example of usage
#' population <- matrix(runif(100), nrow = 10, ncol = 10)
#' plot_population(population)
#'
#' @export
plot_population <- function(population) {
par(mfrow = c(1, 2))
boxplot(population, main = "Boxplot of Population")
hist(population, main = "Histogram of Population")
}
62 changes: 0 additions & 62 deletions R/animated_plot.R

This file was deleted.

22 changes: 0 additions & 22 deletions R/plot_fitness.R

This file was deleted.

41 changes: 0 additions & 41 deletions R/plot_fitness_history.R

This file was deleted.

21 changes: 0 additions & 21 deletions R/plot_population.R

This file was deleted.

24 changes: 0 additions & 24 deletions man/animate_fitness_history.Rd

This file was deleted.

2 changes: 1 addition & 1 deletion man/plot_fitness.Rd
100644 → 100755

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/plot_fitness_history.Rd
100644 → 100755

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/plot_population.Rd
100644 → 100755

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 23de855

Please sign in to comment.