Skip to content

Commit

Permalink
increase timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristianetaniguti committed Dec 18, 2023
1 parent 4ac2175 commit e48dfd5
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
with:
use-public-rspm: true

- uses: r-lib/actions/setup-renv@v2
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: covr

Expand Down
6 changes: 3 additions & 3 deletions R/functions_qtl.R
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ only_plot_profile <- function(pl.in){
geom_line(data=pl.in$lines, aes(y = SIG, color = Trait), linewidth=pl.in$linesize, alpha=0.8) +
#guides(color = guide_legend("Trait")) +
{if(dim(pl.in$points)[1] > 0) geom_point(data=pl.in$points, aes(y = y.dat, color = Trait), shape = 2, size = 2, stroke = 1, alpha = 0.8)} +
{if(length(vlines) > 1) geom_vline(xintercept=vlines, linetype="dashed", size=.5, alpha=0.8, na.rm = TRUE)} + #threshold
{if(length(vlines) > 1) geom_vline(xintercept=vlines, linetype="dashed", linewidth=.5, alpha=0.8, na.rm = TRUE)} + #threshold
labs(y = pl.in$y.lab, x = "Linkage group") +
annotate(x=vlines,y=+Inf,label= paste0("LG", names(vlines)),vjust=1, hjust= -0.1,geom="label") +
ylim(c(min(pl.in$lines$y.dat),max(pl.in$lines$SIG, na.rm = T) + 3)) +
Expand Down Expand Up @@ -466,9 +466,9 @@ data_effects <- function(qtl_info, effects, pheno.col = NULL,
for(i in 1:length(pheno.col.n)){
p[[i]] <- effects.df %>% filter(.data$pheno == unique(qtl_info$pheno)[pheno.col.n][i]) %>%
ggplot() +
geom_path(aes(x=x.axis, y=haplo, col = effect), size = 5) +
geom_path(aes(x=x.axis, y=haplo, col = effect), linewidth = 5) +
scale_color_gradient2(low = "purple4", mid = "white",high = "seagreen") +
{if(length(vlines) > 1) geom_vline(xintercept=vlines, linetype="dashed", size=.5, alpha=0.8, na.rm = TRUE)} +
{if(length(vlines) > 1) geom_vline(xintercept=vlines, linetype="dashed", linewidth=.5, alpha=0.8, na.rm = TRUE)} +
labs(y = "Haplotype", x = "Linkage group", title = unique(qtl_info$pheno)[pheno.col.n][i]) +
annotate(x=vlines,y=+Inf,label= paste0("LG", names(vlines)),vjust= 1, hjust= -0.1,geom="label") +
coord_cartesian(ylim = c(1,8.5)) +
Expand Down
3 changes: 2 additions & 1 deletion tests/testthat/test-MAPpoly.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ test_that("Tests uploaded MAPpoly files",{
# upload MAPpoly
temp <- tempfile()
if(havingIP()){
options(timeout=200)
download.file("https://www.polyploids.org/sites/default/files/2022-04/tetra_MAPpoly_maps.RData", destfile = temp)
temp.name <- load(temp)
input.data <- get(temp.name)
Expand All @@ -29,7 +30,7 @@ test_that("Tests uploaded MAPpoly files",{
ch = 3,
maps = maps,
d.p1 = viewmap_mappoly$d.p1,
d.p2 = viewmap_mappoly$d.p2)[[5]], 134.073, tolerance = 0.0001, )
d.p2 = viewmap_mappoly$d.p2)[[5]], 134.073, tolerance = 0.0001)

# Map summary table
summary_table <- summary_maps(viewmap_mappoly, software = "mappoly")
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-QTLpoly.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ test_that("Tests uploaded QTLpoly files",{
fitted.mod$datapath <- tempfile()

if(havingIP()){
options(timeout=200)
download.file("https://www.polyploids.org/sites/default/files/2022-04/tetra_QTLpoly_effects.RData", destfile = est.effects$datapath)
download.file("https://www.polyploids.org/sites/default/files/2022-04/tetra_QTLpoly_data.RData", destfile = input.data$datapath)
download.file("https://www.polyploids.org/sites/default/files/2022-04/tetra_QTLpoly_remim.RData", destfile = remim.mod$datapath)
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-diaQTL.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ test_that("Tests uploaded diaQTL files",{
BayesCI_list_temp$datapath <- tempfile()

if(havingIP()){
options(timeout=200)
download.file("https://www.polyploids.org/sites/default/files/2022-04/tetra_diaQTL_BayesCI_list_0.RData", destfile = BayesCI_list_temp$datapath)
download.file("https://www.polyploids.org/sites/default/files/2022-04/tetra_diaQTL_scan1_list.RData", destfile = scan1_list$datapath)
download.file("https://www.polyploids.org/sites/default/files/2022-04/tetra_diaQTL_scan1_summaries_list.RData", destfile = scan1_summaries_list$datapath)
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-polymapR.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ test_that("Tests uploaded polymapR files",{
polymapR.map$datapath <- tempfile()

if(havingIP()){
options(timeout=200)
download.file("https://www.polyploids.org/sites/default/files/2022-04/tetra_polymapR_dataset.RData", destfile = input.data$datapath)
download.file("https://www.polyploids.org/sites/default/files/2022-04/tetra_polymapR_map.RData", destfile = polymapR.map$datapath)

Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-polyqtlR.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ test_that("Tests uploaded polyqtlR files",{
polyqtlR_effects$datapath <- tempfile()

if(havingIP()){
options(timeout=200)
download.file("https://www.polyploids.org/sites/default/files/2022-04/tetra_polyqtlR_qtl_info.RData", destfile = polyqtlR_qtl_info$datapath)
download.file("https://www.polyploids.org/sites/default/files/2022-04/tetra_polyqtlR_QTLscan.RData", destfile = polyqtlR_QTLscan_list$datapath)
download.file("https://www.polyploids.org/sites/default/files/2022-04/tetra_polyqtlR_effects.RData", destfile = polyqtlR_effects$datapath)
Expand Down
34 changes: 17 additions & 17 deletions tests/testthat/test-tetra_example.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ test_that("tetra example",{
source(system.file("ext/functions4tests.R", package = "viewpoly"))

# upload examples
viewpoly_obj <- viewpoly:::prepare_examples("tetra_map")
viewpoly_obj <- prepare_examples("tetra_map")

expect_equal(viewpoly:::check_viewpoly(viewpoly_obj),0)
expect_equal(check_viewpoly(viewpoly_obj),0)

check_viewmap_values(viewpoly_obj$map,
c(14, 132, 139, 157, 34),
Expand All @@ -21,7 +21,7 @@ test_that("tetra example",{
1)

# VIEWmap tests
qtl_profile_plot <- viewpoly:::plot_profile(profile = viewpoly_obj$qtl$profile,
qtl_profile_plot <- plot_profile(profile = viewpoly_obj$qtl$profile,
qtl_info = viewpoly_obj$qtl$qtl_info,
selected_mks = viewpoly_obj$qtl$selected_mks,
pheno.col = 2:3,
Expand Down Expand Up @@ -60,10 +60,10 @@ test_that("tetra example",{
ph.p2 = viewpoly_obj$map$ph.p2,
snp.names = TRUE, software = "mappoly"))

vdiffr::expect_doppelganger("plot map list", viewpoly:::plot_map_list(viewpoly_obj$map))
vdiffr::expect_doppelganger("plot map list", plot_map_list(viewpoly_obj$map))

# Get max size each chromosome
expect_equal(viewpoly:::map_summary(left.lim = 1,
expect_equal(map_summary(left.lim = 1,
right.lim = 50,
ch = 3,
maps = maps,
Expand All @@ -78,7 +78,7 @@ test_that("tetra example",{
expect_equal(sum(as.numeric(summary_table$`Max gap`)), 80.51)

#VIEWqtl tests
vdiffr::expect_doppelganger("qtl plot", viewpoly:::plot_profile(viewpoly_obj$qtl$profile,
vdiffr::expect_doppelganger("qtl plot", plot_profile(viewpoly_obj$qtl$profile,
viewpoly_obj$qtl$qtl_info,
viewpoly_obj$qtl$selected_mks,
pheno.col = 2,
Expand All @@ -88,7 +88,7 @@ test_that("tetra example",{
software = NULL))

# by range
qtl_profile_data <- viewpoly:::plot_profile(viewpoly_obj$qtl$profile,
qtl_profile_data <- plot_profile(viewpoly_obj$qtl$profile,
viewpoly_obj$qtl$qtl_info,
viewpoly_obj$qtl$selected_mks,
pheno.col = 2,
Expand All @@ -107,7 +107,7 @@ test_that("tetra example",{
expect_equal(as.numeric(qtl_profile_data$points$SUP), 119, tolerance = 0.001)

# export data
qtl_profile_data <- viewpoly:::plot_profile(viewpoly_obj$qtl$profile,
qtl_profile_data <- plot_profile(viewpoly_obj$qtl$profile,
viewpoly_obj$qtl$qtl_info,
viewpoly_obj$qtl$selected_mks,
pheno.col = 2,
Expand All @@ -126,11 +126,11 @@ test_that("tetra example",{
expect_equal(as.numeric(qtl_profile_data$points$SUP), 119, tolerance = 0.001)

# plot exported data
p <- viewpoly:::only_plot_profile(qtl_profile_data)
p <- only_plot_profile(qtl_profile_data)
expect_equal(sum(p$data$SIG), 292.883, tolerance = 0.001)

# effects graphics
p <- viewpoly:::data_effects(qtl_info = viewpoly_obj$qtl$qtl_info,
p <- data_effects(qtl_info = viewpoly_obj$qtl$qtl_info,
effects = viewpoly_obj$qtl$effects,
pheno.col = "SG06",
lgs = 2,
Expand All @@ -139,7 +139,7 @@ test_that("tetra example",{
software = "QTLpoly",
design = "circle")

vdiffr::expect_doppelganger("effects circle", viewpoly:::plot_effects(data_effects.obj = p,
vdiffr::expect_doppelganger("effects circle", plot_effects(data_effects.obj = p,
software = "QTLpoly",
design = "circle"))

Expand All @@ -148,7 +148,7 @@ test_that("tetra example",{
c("Estimates", "Alleles", "Parent", "Effects", "pheno", "qtl_id", "LG", "Pos", "unique.id"),
tolerance = 0.001)

p <- viewpoly:::data_effects(qtl_info = viewpoly_obj$qtl$qtl_info,
p <- data_effects(qtl_info = viewpoly_obj$qtl$qtl_info,
effects = viewpoly_obj$qtl$effects,
pheno.col = "SG06",
lgs = 2,
Expand All @@ -162,9 +162,9 @@ test_that("tetra example",{
c("x", "y", "z"),
tolerance = 0.001)

vdiffr::expect_doppelganger("effects digenic", viewpoly:::plot_effects(p, "QTLpoly", "digenic"))
vdiffr::expect_doppelganger("effects digenic", plot_effects(p, "QTLpoly", "digenic"))

p <- viewpoly:::data_effects(qtl_info = viewpoly_obj$qtl$qtl_info,
p <- data_effects(qtl_info = viewpoly_obj$qtl$qtl_info,
effects = viewpoly_obj$qtl$effects,
pheno.col = "SG06",
lgs = 2,
Expand All @@ -178,11 +178,11 @@ test_that("tetra example",{
c("Estimates", "Alleles", "Parent", "Effects"),
tolerance = 0.001)

vdiffr::expect_doppelganger("effects bar", viewpoly:::plot_effects(p, "QTLpoly", "bar"))
vdiffr::expect_doppelganger("effects bar", plot_effects(p, "QTLpoly", "bar"))

# breeding values table
pos <- split(viewpoly_obj$qtl$qtl_info[1:3,]$Pos, viewpoly_obj$qtl$qtl_info[1:3,]$pheno)
breed.values <- viewpoly:::breeding_values(viewpoly_obj$qtl$qtl_info,
breed.values <- breeding_values(viewpoly_obj$qtl$qtl_info,
viewpoly_obj$qtl$probs,
viewpoly_obj$qtl$selected_mks,
viewpoly_obj$qtl$blups,
Expand Down Expand Up @@ -211,7 +211,7 @@ test_that("tetra example",{
expect_equal(sum(p1[[3]]$data$probability), 508.0009, tolerance = 0.0001)

# VIEWgenome tests
p <- viewpoly:::plot_cm_mb(viewpoly_obj$map, 1, 1,50)
p <- plot_cm_mb(viewpoly_obj$map, 1, 1,50)

expect_equal(sum(p$data$l.dist), 50502.07, tolerance = 0.001)

Expand Down

0 comments on commit e48dfd5

Please sign in to comment.