Last updated: 2025-07-29

Checks: 6 1

Knit directory: Importance-of-markers-for-QTL-detection-by-machine-learning-methods/

This reproducible R Markdown analysis was created with workflowr (version 1.7.1). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.


The R Markdown file has unstaged changes. To know which version of the R Markdown file created these results, you’ll want to first commit it to the Git repo. If you’re still working on the analysis, you can ignore this warning. When you’re finished, you can run wflow_publish to commit the R Markdown file and build the HTML.

Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.

The command set.seed(20221222) was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.

Great job! Recording the operating system, R version, and package versions is critical for reproducibility.

Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.

Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.

Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.

The results in this page were generated with repository version 854e89e. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.

Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish or wflow_git_commit). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:


Ignored files:
    Ignored:    .Rproj.user/
    Ignored:    analysis/figure/
    Ignored:    output/imp.tot.RData
    Ignored:    output/mod.rda

Untracked files:
    Untracked:  output/lddecay.tiff

Unstaged changes:
    Modified:   analysis/ld_decay.Rmd
    Modified:   analysis/map.Rmd

Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.


These are the previous versions of the repository in which changes were made to the R Markdown (analysis/map.Rmd) and HTML (docs/map.html) files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view the files as they were in that past version.

File Version Author Date Message
Rmd f6193e2 WevertonGomesCosta 2025-07-28 add map. rmd and .html
html f6193e2 WevertonGomesCosta 2025-07-28 add map. rmd and .html
Rmd aa95c1d WevertonGomesCosta 2025-03-26 add map.rmd
html 9b9dd84 WevertonGomesCosta 2025-03-26 add map.html
html 1e8f0d3 WevertonGomesCosta 2025-03-25 add map.html
Rmd 450b544 WevertonGomesCosta 2025-03-25 add files GWAS.Rmd, map.Rmd and snpsofinterest. Rdata

Creating Genetic Map Chart

Este documento tem como objetivo criar um gráfico genético para as características do experimento. O gráfico será dividido em cinco partes, cada uma representando uma característica diferente.

library(tidyverse)
library(data.table)
library(metan)
library(ggthemes)
library(ggrepel)
library(ggpubr)
library(cowplot)
library(tidytext)

Genetic map

Primeiro vamos definir nossos SNPs de interesse para as variáveis. Essas informações foram pré-definidas e podem ser encontrados no arquivo control_genetic. Vamos carregar o arquivo snpsOfInterest.RData que contém as infomações dos snps considerados QTLs por variavel.

load("data/snpsOfInterest.RData")

Agora vamos definir os nomes das colunas para nosso snpsOfInterest e criar um objeto locus com as informações de ininício e témino de cada grupo de ligação.

locus <-
  data.frame(
    c(
      1,
      401,
      402,
      802,
      803,
      1203,
      1204,
      1604,
      1605,
      2005,
      2006,
      2406,
      2407,
      2807,
      2808,
      3208,
      3209,
      3609,
      3610,
      4010
    )
  )

colnames(locus) <- c("marker")

Para facilitar a visualização criei um gráfico genético das características map_plot. Para isso criei o map com o número de marcadores e tamanho de cada grupo de liagação.

map <-
  data.frame(rbind(
    cbind(seq(1, 401, 1), rep("LG 1", 401), seq(0, 200, 0.5)),
    cbind(seq(402, 802, 1), rep("LG 2", 401), seq(0, 200, 0.5)),
    cbind(seq(803, 1203, 1), rep("LG 3", 401), seq(0, 200, 0.5)),
    cbind(seq(1204, 1604, 1), rep("LG 4", 401), seq(0, 200, 0.5)),
    cbind(seq(1605, 2005, 1), rep("LG 5", 401), seq(0, 200, 0.5)),
    cbind(seq(2006, 2406, 1), rep("LG 6", 401), seq(0, 200, 0.5)),
    cbind(seq(2407, 2807, 1), rep("LG 7", 401), seq(0, 200, 0.5)),
    cbind(seq(2808, 3208, 1), rep("LG 8", 401), seq(0, 200, 0.5)),
    cbind(seq(3209, 3609, 1), rep("LG 9", 401), seq(0, 200, 0.5)),
    cbind(seq(3610, 4010, 1), rep("LG 10", 401), seq(0, 200, 0.5))
  ))

colnames(map) <- c("marker", "LG", "Size")

map <- map %>%
  mutate(
    marker = as.numeric(marker),
    Size = as.numeric(Size),
    LG = factor(
      LG,
      levels = c(
        "LG 1",
        "LG 2",
        "LG 3",
        "LG 4",
        "LG 5",
        "LG 6",
        "LG 7",
        "LG 8",
        "LG 9",
        "LG 10"
      )
    )
  )

Para dividir a figura e mostrar todos os maps genômicos das características, dividi o snpsOfInterest e o map para cada característica e inclui os SNPs de interesse no map para cada característica.

snpsOfInterest1 <- snpsOfInterest %>%
  filter(variable == 1)

snpsOfInterest2 <- snpsOfInterest %>%
  filter(variable == 2)

snpsOfInterest3 <- snpsOfInterest %>%
  filter(variable == 3)

snpsOfInterest4 <- snpsOfInterest %>%
  filter(variable == 4)

snpsOfInterest5 <- snpsOfInterest %>%
  filter(variable == 5)

map1 <- map %>%
  mutate(
    is_highlight = ifelse(marker %in% snpsOfInterest1$marker, "yes", "no"),
    is_locus = ifelse(marker %in% locus$marker, "yes", "no")
  )

map2 <- map %>%
  mutate(
    is_highlight = ifelse(marker %in% snpsOfInterest2$marker, "yes", "no"),
    is_locus = ifelse(marker %in% locus$marker, "yes", "no")
  )

map3 <- map %>%
  mutate(
    is_highlight = ifelse(marker %in% snpsOfInterest3$marker, "yes", "no"),
    is_locus = ifelse(marker %in% locus$marker, "yes", "no")
  )

map4 <- map %>%
  mutate(
    is_highlight = ifelse(marker %in% snpsOfInterest4$marker, "yes", "no"),
    is_locus = ifelse(marker %in% locus$marker, "yes", "no")
  )

map5 <- map %>%
  mutate(
    is_highlight = ifelse(marker %in% snpsOfInterest5$marker, "yes", "no"),
    is_locus = ifelse(marker %in% locus$marker, "yes", "no")
  )

Agora cirei o gráfico de cada característica e depois agrupei eles em apenas uma imagem maps.

map_plot1 <- ggplot(map1, aes(x = LG, y = Size)) +
  geom_segment(aes(
    yend = 200,
    y = 0,
    x = LG,
    xend = LG
  ),
  color = "skyblue",
  size = 1) +
  geom_point(
    data = subset(map1, is_locus == "yes"),
    color = "skyblue",
    size = 0.5
  ) +
  geom_point(
    data = subset(map1, is_highlight == "yes"),
    color = "Orange",
    size = 0.5
  ) +
  geom_text_repel(
    data = subset(map1, is_highlight == "yes"),
    aes(label = marker),
    size = 1.5,
    max.overlaps = Inf,
    min.segment.length = 0,
    force   = 0,
    nudge_x      = -0.55,
    nudge_y      = -1.5,
    direction    = "x",
    hjust        = 0.5,
    segment.curvature = -1e-20,
    segment.angle     = 45,
    segment.size = 0.1
  ) +
  geom_text_repel(
    data = subset(map1, is_locus == "yes"),
    aes(label = marker),
    size = 1.5,
    max.overlaps = Inf,
    min.segment.length = 0,
    force   = 0,
    nudge_x      = -0.55,
    nudge_y      = -1.5,
    direction    = "x",
    hjust        = 0.5,
    segment.curvature = -1e-20,
    segment.angle     = 45,
    segment.size = 0.1
  ) +
  scale_x_discrete(expand = expansion(mult = c(0.15, 0.05))) +
  scale_y_continuous(expand = expansion(mult = c(0.03, 0.05))) +
  theme_void() +
  theme(
    axis.text.y = element_blank(),
    axis.text.x = element_text(size = 4),
    axis.ticks = element_blank()
  ) +
  labs(y = "", x = "")

map_plot2 <- ggplot(map2, aes(x = LG, y = Size)) +
  geom_segment(aes(
    yend = 200,
    y = 0,
    x = LG,
    xend = LG
  ),
  color = "skyblue",
  size = 1) +
  geom_point(
    data = subset(map2, is_locus == "yes"),
    color = "skyblue",
    size = 0.5
  ) +
  geom_point(
    data = subset(map2, is_highlight == "yes"),
    color = "Orange",
    size = 0.5
  ) +
  geom_text_repel(
    data = subset(map2, is_highlight == "yes"),
    aes(label = marker),
    size = 1.5,
    max.overlaps = Inf,
    min.segment.length = 0,
    force   = 0,
    nudge_x      = -0.55,
    nudge_y      = -1.5,
    direction    = "x",
    hjust        = 0.5,
    segment.curvature = -1e-20,
    segment.angle     = 45,
    segment.size = 0.1
  ) +
  geom_text_repel(
    data = subset(map2, is_locus == "yes"),
    aes(label = marker),
    size = 1.5,
    max.overlaps = Inf,
    min.segment.length = 0,
    force   = 0,
    nudge_x      = -0.55,
    nudge_y      = -1.5,
    direction    = "x",
    hjust        = 0.5,
    segment.curvature = -1e-20,
    segment.angle     = 45,
    segment.size = 0.1
  ) +
  scale_x_discrete(expand = expansion(mult = c(0.15, 0.05))) +
  scale_y_continuous(expand = expansion(mult = c(0.03, 0.05))) +
  theme_void() +
  theme(
    axis.text.y = element_blank(),
    axis.text.x = element_text(size = 4),
    axis.ticks = element_blank()
  ) +
  labs(y = "", x = "")

map_plot3 <- ggplot(map3, aes(x = LG, y = Size)) +
  geom_segment(aes(
    yend = 200,
    y = 0,
    x = LG,
    xend = LG
  ),
  color = "skyblue",
  size = 1) +
  geom_point(
    data = subset(map3, is_locus == "yes"),
    color = "skyblue",
    size = 0.5
  ) +
  geom_point(
    data = subset(map3, is_highlight == "yes"),
    color = "Orange",
    size = 0.5
  ) +
  geom_text_repel(
    data = subset(map3, is_highlight == "yes"),
    aes(label = marker),
    size = 1.5,
    max.overlaps = Inf,
    min.segment.length = 0,
    force   = 0,
    nudge_x      = -0.55,
    nudge_y      = -1.5,
    direction    = "x",
    hjust        = 0.5,
    segment.curvature = -1e-20,
    segment.angle     = 45,
    segment.size = 0.1
  ) +
  geom_text_repel(
    data = subset(map3, is_locus == "yes"),
    aes(label = marker),
    size = 1.5,
    max.overlaps = Inf,
    min.segment.length = 0,
    force   = 0,
    nudge_x      = -0.55,
    nudge_y      = -1.5,
    direction    = "x",
    hjust        = 0.5,
    segment.curvature = -1e-20,
    segment.angle     = 45,
    segment.size = 0.1
  ) +
  scale_x_discrete(expand = expansion(mult = c(0.15, 0.05))) +
  scale_y_continuous(expand = expansion(mult = c(0.03, 0.05))) +
  theme_void() +
  theme(
    axis.text.y = element_blank(),
    axis.text.x = element_text(size = 4),
    axis.ticks = element_blank()
  ) +
  labs(y = "", x = "")

map_plot4 <- ggplot(map4, aes(x = LG, y = Size)) +
  geom_segment(aes(
    yend = 200,
    y = 0,
    x = LG,
    xend = LG
  ),
  color = "skyblue",
  size = 1) +
  geom_point(
    data = subset(map4, is_locus == "yes"),
    color = "skyblue",
    size = 0.5
  ) +
  geom_point(
    data = subset(map4, is_highlight == "yes"),
    color = "Orange",
    size = 0.5
  ) +
  geom_text_repel(
    data = subset(map4, is_highlight == "yes"),
    aes(label = marker),
    size = 1.5,
    max.overlaps = Inf,
    min.segment.length = 0,
    force   = 0,
    nudge_x      = -0.55,
    nudge_y      = -1.5,
    direction    = "x",
    hjust        = 0.5,
    segment.curvature = -1e-20,
    segment.angle     = 45,
    segment.size = 0.1
  ) +
  geom_text_repel(
    data = subset(map4, is_locus == "yes"),
    aes(label = marker),
    size = 1.5,
    max.overlaps = Inf,
    min.segment.length = 0,
    force   = 0,
    nudge_x      = -0.55,
    nudge_y      = -1.5,
    direction    = "x",
    hjust        = 0.5,
    segment.curvature = -1e-20,
    segment.angle     = 45,
    segment.size = 0.1
  ) +
  scale_x_discrete(expand = expansion(mult = c(0.15, 0.05))) +
  scale_y_continuous(expand = expansion(mult = c(0.03, 0.05))) +
  theme_void() +
  theme(
    axis.text.y = element_blank(),
    axis.text.x = element_text(size = 4),
    axis.ticks = element_blank()
  ) +
  labs(y = "", x = "")

map_plot5 <- ggplot(map5, aes(x = LG, y = Size)) +
  geom_segment(aes(
    yend = 200,
    y = 0,
    x = LG,
    xend = LG
  ),
  color = "skyblue",
  size = 1) +
  geom_point(
    data = subset(map5, is_locus == "yes"),
    color = "skyblue",
    size = 0.5
  ) +
  geom_point(
    data = subset(map5, is_highlight == "yes"),
    color = "Orange",
    size = 0.5
  ) +
  geom_text_repel(
    data = subset(map5, is_highlight == "yes"),
    aes(label = marker),
    size = 1.5,
    max.overlaps = Inf,
    min.segment.length = 0,
    force   = 0,
    nudge_x      = -0.55,
    nudge_y      = -1.5,
    direction    = "x",
    hjust        = 0.5,
    segment.curvature = -1e-20,
    segment.angle     = 45,
    segment.size = 0.1
  ) +
  geom_text_repel(
    data = subset(map5, is_locus == "yes"),
    aes(label = marker),
    size = 1.5,
    max.overlaps = Inf,
    min.segment.length = 0,
    force   = 0,
    nudge_x      = -0.55,
    nudge_y      = -1.5,
    direction    = "x",
    hjust        = 0.5,
    segment.curvature = -1e-20,
    segment.angle     = 45,
    segment.size = 0.1
  ) +
  scale_x_discrete(expand = expansion(mult = c(0.15, 0.05))) +
  scale_y_continuous(expand = expansion(mult = c(0.03, 0.05))) +
  theme_void() +
  theme(
    axis.text.y = element_blank(),
    axis.text.x = element_text(size = 4),
    axis.ticks = element_blank()
  ) +
  labs(y = "", x = "")

maps <- ggdraw() +
  draw_plot(
    map_plot1,
    x = 0.05,
    y = .5,
    width = .3,
    height = .5
  ) +
  draw_plot(
    map_plot2,
    x = .4,
    y = .5,
    width = .3,
    height = .5
  ) +
  draw_plot(
    map_plot3,
    x = .75,
    y = .5,
    width = .3,
    height = .5
  ) +
  draw_plot(
    map_plot4,
    x = 0.25,
    y = 0,
    width = 0.3,
    height = 0.5
  ) +
  draw_plot(
    map_plot5,
    x = 0.65,
    y = 0,
    width = 0.3,
    height = 0.5
  ) +
  draw_plot_label(
    label = c("A", "B", "C", "D", "E"),
    size = 15,
    x = c(0, 0.35, 0.7, 0.2, 0.6),
    y = c(1, 1, 1, 0.5, 0.5)
  )

print(maps)


sessionInfo()
R version 4.4.1 (2024-06-14 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 11 x64 (build 26100)

Matrix products: default


locale:
[1] LC_COLLATE=Portuguese_Brazil.utf8  LC_CTYPE=Portuguese_Brazil.utf8   
[3] LC_MONETARY=Portuguese_Brazil.utf8 LC_NUMERIC=C                      
[5] LC_TIME=Portuguese_Brazil.utf8    

time zone: America/Sao_Paulo
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] tidytext_0.4.2    cowplot_1.2.0     ggpubr_0.6.1      ggrepel_0.9.6    
 [5] ggthemes_5.1.0    metan_1.19.0      data.table_1.17.8 lubridate_1.9.4  
 [9] forcats_1.0.0     stringr_1.5.1     dplyr_1.1.4       purrr_1.1.0      
[13] readr_2.1.5       tidyr_1.3.1       tibble_3.3.0      ggplot2_3.5.2    
[17] tidyverse_2.0.0  

loaded via a namespace (and not attached):
 [1] tidyselect_1.2.1    farver_2.1.2        fastmap_1.2.0      
 [4] GGally_2.2.1        janeaustenr_1.0.0   tweenr_2.0.3       
 [7] mathjaxr_1.8-0      promises_1.3.3      digest_0.6.37      
[10] timechange_0.3.0    lifecycle_1.0.4     tokenizers_0.3.0   
[13] magrittr_2.0.3      compiler_4.4.1      rlang_1.1.6        
[16] sass_0.4.10         tools_4.4.1         yaml_2.3.10        
[19] knitr_1.50          ggsignif_0.6.4      labeling_0.4.3     
[22] plyr_1.8.9          RColorBrewer_1.1-3  abind_1.4-8        
[25] workflowr_1.7.1     withr_3.0.2         numDeriv_2016.8-1.1
[28] grid_4.4.1          polyclip_1.10-7     git2r_0.36.2       
[31] scales_1.4.0        MASS_7.3-60.2       cli_3.6.5          
[34] rmarkdown_2.29      reformulas_0.4.1    generics_0.1.4     
[37] rstudioapi_0.17.1   tzdb_0.5.0          minqa_1.2.8        
[40] cachem_1.1.0        ggforce_0.5.0       splines_4.4.1      
[43] vctrs_0.6.5         boot_1.3-30         Matrix_1.7-0       
[46] jsonlite_2.0.0      carData_3.0-5       car_3.1-3          
[49] hms_1.1.3           patchwork_1.3.1     rstatix_0.7.2      
[52] Formula_1.2-5       jquerylib_0.1.4     glue_1.8.0         
[55] nloptr_2.2.1        ggstats_0.10.0      stringi_1.8.7      
[58] gtable_0.3.6        later_1.4.2         lme4_1.1-37        
[61] lmerTest_3.1-3      pillar_1.11.0       htmltools_0.5.8.1  
[64] R6_2.6.1            Rdpack_2.6.4        rprojroot_2.0.4    
[67] evaluate_1.0.4      lattice_0.22-7      SnowballC_0.7.1    
[70] rbibutils_2.3       backports_1.5.0     broom_1.0.8        
[73] httpuv_1.6.16       bslib_0.9.0         Rcpp_1.1.0         
[76] nlme_3.1-168        whisker_0.4.1       xfun_0.52          
[79] fs_1.6.6            pkgconfig_2.0.3