diff --git a/.Rbuildignore b/.Rbuildignore index 7cb3a87..4efcca9 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -13,3 +13,5 @@ book ^cran-comments\.md$ ^\.github$ Dockerfile +y_hap_pred +tests/shiny* \ No newline at end of file diff --git a/NAMESPACE b/NAMESPACE index e5b2bf4..2e73062 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -24,6 +24,7 @@ export(get_ld_gp) export(pca_mds_Server) export(pca_mds_UI) export(plotPCA) +export(plot_hap_dist) export(plot_hap_div) export(plot_ld) export(popgen_UI) @@ -91,6 +92,7 @@ importFrom(stats,cov) importFrom(stats,frequency) importFrom(stats,hclust) importFrom(stats,ks.test) +importFrom(stats,median) importFrom(stats,p.adjust) importFrom(stats,qqplot) importFrom(stats,qunif) diff --git a/R/helpers.R b/R/helpers.R index f0bfd81..1b17018 100644 --- a/R/helpers.R +++ b/R/helpers.R @@ -426,7 +426,7 @@ get_hw_gp <- function(fname, n_iter) { #' @keywords internal plot_hap_div <- function(df) { hap_1 <- hap_2 <- value <- NULL - midpoint <- median(df$value) + midpoint <- stats::median(df$value) plt <- ggplot2::ggplot(data = df, aes(hap_1, hap_2, fill = value)) + ggplot2::geom_tile(color = "white") + ggplot2::scale_fill_gradient2(low = "#ffffff", mid = "#fdae6b", high = "#e6550d", diff --git a/R/helpers_haplo_stats.R b/R/helpers_haplo_stats.R index 563ce1e..bd2559e 100644 --- a/R/helpers_haplo_stats.R +++ b/R/helpers_haplo_stats.R @@ -41,7 +41,7 @@ getHaploStatsFromGenind <- function(data) { flag = "0" ) ) - hap_data <- tibble::tibble( + hap_data <- data.frame( haplotype_id = hap_labels, h_count = h_count, h_freq = h_freq, @@ -49,7 +49,7 @@ getHaploStatsFromGenind <- function(data) { ) ## population level table - hap_pop_data <- tibble::tibble( + hap_pop_data <- data.frame( h_div = h_div ) diff --git a/R/straf.R b/R/straf.R index c55d1d3..df074e2 100644 --- a/R/straf.R +++ b/R/straf.R @@ -31,7 +31,7 @@ #' @importFrom reshape2 acast #' @importFrom shinycssloaders withSpinner #' @importFrom shinyWidgets awesomeCheckbox pickerInput -#' @importFrom stats as.dist cmdscale cov frequency hclust ks.test qqplot qunif p.adjust +#' @importFrom stats as.dist cmdscale cov frequency hclust ks.test median qqplot qunif p.adjust #' @importFrom tidyr gather #' @importFrom utils read.table write.table count.fields NULL diff --git a/data/nginx/conf/nginx.conf b/data/nginx/conf/nginx.conf deleted file mode 100644 index cd58291..0000000 --- a/data/nginx/conf/nginx.conf +++ /dev/null @@ -1,25 +0,0 @@ -server { - listen 443 ssl; - server_name straf.fr; - ssl_certificate /etc/letsencrypt/live/straf.fr/fullchain.pem; - ssl_certificate_key /etc/letsencrypt/live/straf.fr/privkey.pem; - include /etc/letsencrypt/options-ssl-nginx.conf; - ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; - access_log /var/log/nginx/data-access.log combined; - - location / { - proxy_pass http://shiny:3838/; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $remote_addr; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header Host $host; - - proxy_redirect http://shiny:3838/ $scheme://$http_host/; - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection $connection_upgrade; - proxy_read_timeout 20d; - proxy_buffering off; - } - } -} diff --git a/landing/test.Rmd b/landing/test.Rmd deleted file mode 100644 index 83019cd..0000000 --- a/landing/test.Rmd +++ /dev/null @@ -1,10 +0,0 @@ ---- -title: "stackoverflow_example" -output: rmdformats::material ---- - -# Example plot - -```{r} -plot(1:10) -``` \ No newline at end of file diff --git a/landing/test.html b/landing/test.html deleted file mode 100644 index 848bc7e..0000000 --- a/landing/test.html +++ /dev/null @@ -1,1189 +0,0 @@ - - - - - - - - - - stackoverflow_example - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
- -
-
-
-
- -
-
- - - -
- - -
- -
-
-

Example plot

-
plot(1:10)
-

-
-
- -
- - -
-
- - -
-
- - - - - - - - - diff --git a/man/plot_hap_dist.Rd b/man/plot_hap_dist.Rd new file mode 100644 index 0000000..e2c3249 --- /dev/null +++ b/man/plot_hap_dist.Rd @@ -0,0 +1,18 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/helpers.R +\name{plot_hap_dist} +\alias{plot_hap_dist} +\title{Plot pairwise distance between haplotypes.} +\usage{ +plot_hap_dist(df) +} +\arguments{ +\item{df}{a table containing pairwise distance between haplotypes} +} +\value{ +a heatmap representing pairwise distance between haplotypes +} +\description{ +Plot pairwise distance between haplotypes. +} +\keyword{internal} diff --git a/scripts/generate_expectations.R b/scripts/generate_expectations.R index a29172a..b9626ce 100644 --- a/scripts/generate_expectations.R +++ b/scripts/generate_expectations.R @@ -1,21 +1,21 @@ library(straf) -input_diploid <- list(datapath="./tests/input_files/exampleSTRAFdiplo.txt") +input_diploid <- list(datapath="./tests/testthat/exampleSTRAFdiplo.txt") dat_diploid <- straf::createGenind(input_diploid, ploidy = 2) freq_diploid <- straf::getFreqAllPop(dat_diploid) indices_diploid <- straf::getIndicesAllPop(dat_diploid) -input_haploid <- list(datapath="./tests/input_files/exampleSTRAFhaplo.txt") +input_haploid <- list(datapath="./tests/testthat/exampleSTRAFhaplo.txt") dat_haploid <- straf::createGenind(input_haploid, ploidy = 1) -freq_haploid <- straf::getFreqAllPop(dat_diploid) -indices_haploid <- straf::getIndicesAllPop(dat_diploid) +freq_haploid <- straf::getFreqAllPop(dat_haploid) +indices_haploid <- straf::getIndicesAllPop(dat_haploid) -input_haploid_point <- list(datapath="./tests/input_files/exampleSTRAFhaplo_point.txt") +input_haploid_point <- list(datapath="./tests/testthat/exampleSTRAFhaplo_point.txt") dat_haploid_point <- straf::createGenind(input_haploid_point, ploidy = 1) -freq_haploid_point <- straf::getFreqAllPop(dat_diploid) -indices_haploid_point <- straf::getIndicesAllPop(dat_diploid) +freq_haploid_point <- straf::getFreqAllPop(dat_haploid_point) +indices_haploid_point <- straf::getIndicesAllPop(dat_haploid_point) expectations <- list( dat_diploid=dat_diploid, @@ -29,4 +29,4 @@ expectations <- list( indices_haploid_point=indices_haploid_point ) -saveRDS(expectations, file = "./tests/expectations.rds") +saveRDS(expectations, file = "./tests/testthat/expectations.rds") diff --git a/tests/testthat/expectations.rds b/tests/testthat/expectations.rds index 44671b6..dec87c2 100644 Binary files a/tests/testthat/expectations.rds and b/tests/testthat/expectations.rds differ