Last updated: 2022-08-03
Checks: 6 1
Knit directory: cassavabaseembrapa/
This reproducible R Markdown analysis was created with workflowr (version 1.7.0). 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(20220609) 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 2c708e7. 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/
Untracked files:
Untracked: Manual descritores.pdf
Untracked: data/Acessos_Sinonimos_Trials_Cassavabase_2011-2021.xlsx
Untracked: data/Trials-in-cassava-base.xlsx
Untracked: data/data_phenotypic.xlsx
Untracked: data/locais e siglas dos experimentos 2021.xlsx
Untracked: data/plot_name.xlsx
Untracked: data/resumo_acess.xlsx
Untracked: data/resumo_acess2.xlsx
Untracked: data/resumo_acess3.xlsx
Untracked: data/resumo_acess_v2.xlsx
Untracked: data/resumo_mun.xlsx
Untracked: data/resumo_trials (2).xlsx
Untracked: data/resumo_trials.xlsx
Untracked: data/resumo_trials2.xlsx
Untracked: data/resumo_trials3.xlsx
Untracked: data/resumo_trials4.xlsx
Untracked: data/sinonimous.xlsx
Untracked: definição plot name.txt
Untracked: dúvidas_cassavabase.txt
Untracked: output/BR.AYT.14.NH1.xlsx
Untracked: output/BR.AYT.15.NH1.xlsx
Untracked: output/BR.AYT.15.SAm.xlsx
Untracked: output/BR.AYT.19.Candeal.xlsx
Untracked: output/BR.AYT.19.NH2B.xlsx
Untracked: output/BR.AYT.19.RA1.xlsx
Untracked: output/BR.AYT.20.Candeal.xlsx
Untracked: output/BR.AYT.20.NH1.xlsx
Untracked: output/BR.AYT.20.RA1.xlsx
Untracked: output/BR.AYTGSC1.20.Ala.xlsx
Untracked: output/BR.AYTGSC1.20.NH.xlsx
Untracked: output/BR.AYTGSC1.20.PP1.xlsx
Untracked: output/BR.AYTGSC1.20.RA1.xlsx
Untracked: output/BR.CET.12.NH1.xlsx
Untracked: output/BR.CET.13.CNPMF.xlsx
Untracked: output/BR.CET.14.NR.xlsx
Untracked: output/BR.CET.14.Val.xlsx
Untracked: output/BR.CET.15.NH1.xlsx
Untracked: output/BR.CET.18.Gaviao.xlsx
Untracked: output/BR.CET.20.Candeal.xlsx
Untracked: output/BR.CETGSC1.18.Camab.xlsx
Untracked: output/BR.CETGSC2.20.Candeal.xlsx
Untracked: output/BR.CETGSC2Wx.20.Candeal.xlsx
Untracked: output/BR.CETWx.20.Candeal.xlsx
Untracked: output/BR.PYT.13.NH1.xlsx
Untracked: output/BR.PYT.16.Capela.xlsx
Untracked: output/BR.PYT.18.NH1.xlsx
Untracked: output/BR.PYT.19.NH2A.xlsx
Untracked: output/BR.PYT.19.PP1.xlsx
Untracked: output/BR.PYT.20.Candeal.xlsx
Untracked: output/BR.PYT.20.RA1.xlsx
Untracked: output/BR.PYTGSC1.19.NH2.xlsx
Untracked: output/BR.PYTGSC1.19.PP1.xlsx
Untracked: output/BR.PYTGSC1.19.RA1.xlsx
Untracked: output/BR.PYTWx.20.Candeal.xlsx
Untracked: output/BR.PYTWx.20.RA1.xlsx
Untracked: output/BR.UYT.15.NH1.xlsx
Untracked: output/BR.UYT.15.NH2.xlsx
Untracked: output/BR.UYT.15.SAm.xlsx
Untracked: output/BR.UYT.16.FSV.xlsx
Untracked: output/BR.UYT.16.NH1.xlsx
Untracked: output/BR.UYT.16.SAm.xlsx
Untracked: output/BR.UYT.16.SJ.xlsx
Untracked: output/BR.UYT.17.Candeal.xlsx
Untracked: output/BR.UYT.17.RA1.xlsx
Untracked: output/BR.UYT.17.RA2.xlsx
Untracked: output/BR.UYT.17.Railton1.xlsx
Untracked: output/BR.UYT.18.Gaviao.xlsx
Untracked: output/BR.UYT.18.NH1.xlsx
Untracked: output/BR.UYT.18.NR.xlsx
Untracked: output/BR.UYT.18.PP1.xlsx
Untracked: output/BR.UYT.18.RA1.xlsx
Untracked: output/BR.UYT.18.RA2.xlsx
Untracked: output/BR.UYT.18.Val.xlsx
Untracked: output/BR.UYT.19.IFMan.xlsx
Untracked: output/BR.UYT.19.NH2A.xlsx
Untracked: output/BR.UYT.19.NH2B.xlsx
Untracked: output/BR.UYT.19.POJ.xlsx
Untracked: output/BR.UYT.19.PP1.xlsx
Untracked: output/BR.UYT.19.RA1.xlsx
Untracked: output/BR.UYT.19.UFV.xlsx
Untracked: output/BR.UYT.20.Candeal.xlsx
Untracked: output/BR.UYT.20.DOU.xlsx
Untracked: output/BR.UYT.20.RA1.xlsx
Untracked: output/BR.UYT16CM.20.NH.xlsx
Untracked: output/BR.UYT16CM.20.Roger.xlsx
Untracked: output/BR.UYT2.19.ER.xlsx
Untracked: output/BR.UYT2.20.Ala.xlsx
Untracked: output/BR.UYT2.20.Alc.xlsx
Untracked: output/BR.UYT2.20.ER.xlsx
Untracked: output/BR.UYT8MP.20.NH.xlsx
Untracked: output/BR.UYT8MP.20.Roger.xlsx
Untracked: output/acess_pheno.xlsx
Unstaged changes:
Modified: analysis/index.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/index.Rmd) and HTML
(docs/index.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 |
|---|---|---|---|---|
| html | 2c708e7 | WevertonGomesCosta | 2022-06-09 | Build site. |
| Rmd | 95893ae | WevertonGomesCosta | 2022-06-09 | Start workflowr project. |
library(tidyverse)
-- Attaching packages --------------------------------------- tidyverse 1.3.1 --
v ggplot2 3.3.6 v purrr 0.3.4
v tibble 3.1.7 v dplyr 1.0.9
v tidyr 1.2.0 v stringr 1.4.0
v readr 2.1.2 v forcats 0.5.1
-- Conflicts ------------------------------------------ tidyverse_conflicts() --
x dplyr::filter() masks stats::filter()
x dplyr::lag() masks stats::lag()
library(readxl)
trials_in_cassava_base <-
read_excel("data/Trials-in-cassava-base.xlsx") ## Trials already in cassavabase
acessions_in_cassava_base <- read_excel("data/sinonimous.xlsx") ## accesses and synonyms already in cassavabase
abreviation_trials <-
read_excel("data/locais e siglas dos experimentos 2021.xlsx") ## trial abbreviations
my_col_types = c(
"numeric",
rep("text", 7),
rep("numeric", 69),
rep("text", 4),
rep("numeric", 8),
"text"
) ## Classes of the columns of the complete dataset
trial_to_insert <-
read_excel("data/plot_name.xlsx", na = "NA", col_types = my_col_types) ## Complete dataset
trials_in_cassava_base <- trials_in_cassava_base %>%
mutate_if(is.character, as.factor) %>%
mutate_if(is.numeric, as.factor) %>%
select(where( ~ n_distinct(.) > 1))
trial_to_insert <- trial_to_insert %>%
mutate_if(is.character, as.factor) %>%
mutate_if(is.numeric, as.factor) %>%
select(where( ~ n_distinct(.) > 1))
abreviation_trials <- abreviation_trials %>%
mutate(Local = toupper(Local)) %>%
mutate_if(is.character, as.factor) %>%
mutate_if(is.numeric, as.factor) %>%
select(where( ~ n_distinct(.) > 1))
MUNICÍPIO, LOCAL, CAMPO and
BREEDING STAGEresumo_mun <- trial_to_insert %>%
group_by(Município, Local, Campo, `Breeding stage`) %>%
tally()
writexl::write_xlsx(resumo_mun, "data/resumo_mun.xlsx")
trial_to_insert and
abreviation_trials datasets according to
LOCAL.trial_to_insert2 <- trial_to_insert %>%
left_join(abreviation_trials, by = "Local")
waxy,
16cm and 8MP experiments. This to create the
trial_name and trial_name_suggest, with this
information. Then we put together in the dataset
trial_names_differ these experiments.trial1 <- trial_to_insert2 %>%
group_by(Ano, `Breeding stage`, Abbreviation, Campo, Waxy) %>%
tally() %>%
filter(Waxy == "SIM") %>%
mutate(
trial_name = paste(
"BR",
`Breeding stage`,
as.numeric(as.character(Ano)) - 2001,
Abbreviation,
sep = "."
),
trial_name_suggest = paste(
"BR",
paste(`Breeding stage`, "Wx", sep = ""),
as.numeric(as.character(Ano)) - 2001,
Abbreviation,
sep = "."
)
) %>%
ungroup()
trial2 <- trial_to_insert2 %>%
group_by(Ano, `Breeding stage`, Abbreviation, Campo) %>%
tally() %>%
filter(str_detect(as.character(Campo), "16CM")) %>%
mutate(
trial_name = paste(
"BR",
`Breeding stage`,
as.numeric(as.character(Ano)) - 2001,
Abbreviation,
sep = "."
),
trial_name_suggest = paste(
"BR",
paste(`Breeding stage`, "16CM", sep = ""),
as.numeric(as.character(Ano)) - 2001,
Abbreviation,
sep = "."
)
) %>%
ungroup()
trial3 <- trial_to_insert2 %>%
group_by(Ano, `Breeding stage`, Abbreviation, Campo) %>%
tally() %>%
filter(str_detect(as.character(Campo), "8MP")) %>%
mutate(
trial_name = paste(
"BR",
`Breeding stage`,
as.numeric(as.character(Ano)) - 2001,
Abbreviation,
sep = "."
),
trial_name_suggest = paste(
"BR",
paste(`Breeding stage`, "8MP", sep = ""),
as.numeric(as.character(Ano)) - 2001,
Abbreviation,
sep = "."
)
) %>%
ungroup()
trial_names_differ <- trial1 %>%
full_join(trial2) %>%
full_join(trial3)
Joining, by = c("Ano", "Breeding stage", "Abbreviation", "Campo", "n",
"trial_name", "trial_name_suggest")
Joining, by = c("Ano", "Breeding stage", "Abbreviation", "Campo", "n",
"trial_name", "trial_name_suggest")
trial_to_insert2 dataset with the
trial_names_differ. Then we corrected the names of the
genotypes by adding BR, we created the other
trial_name and the trial_name_suggest. We
check which trials and accesses are already in cassavabase, creating the
trial_inserted_in_cassava and acces_in_cassava
columns and also check that the trial names are as we suggest. Finally
we create the plot_name_suggest column.trial_to_insert3 <- trial_to_insert2 %>%
full_join(trial_names_differ[-6]) %>%
mutate(
Genotipo = str_replace_all(Genotipo, c("2011" = "BR-11", "2012" = "BR-12")),
trial_name = if_else(
is.na(trial_name),
paste(
"BR",
`Breeding stage`,
as.numeric(as.character(Ano)) - 2001,
Abbreviation,
sep = "."
),
trial_name
),
trial_name_suggest = if_else(is.na(trial_name_suggest), trial_name, trial_name_suggest),
trial_inserted_in_cassava = if_else(
trial_name %in% levels(trials_in_cassava_base$`Trial name`) |
Campo %in% levels(trials_in_cassava_base$`Trial name`) |
trial_name_suggest %in% levels(trials_in_cassava_base$`Trial name`),
"yes",
"no"
) ,
correct_trial_inserted_in_cassava = if_else(
trial_name_suggest %in% levels(trials_in_cassava_base$`Trial name`),
"yes",
"no"
),
acces_in_cassava = if_else(
Genotipo %in% acessions_in_cassava_base$`germplasmName (Stock_Name)`,
"yes",
"no"
),
plot_name_suggest =
paste(trial_name_suggest, Genotipo, Plot, sep = "-")
)
Joining, by = c("Ano", "Breeding stage", "Campo", "Waxy", "Abbreviation")
trials <- trial_to_insert3 %>%
group_by(
Ano,
`Breeding stage`,
Abbreviation,
Campo,
trial_name,
trial_name_suggest,
trial_inserted_in_cassava,
correct_trial_inserted_in_cassava
) %>%
tally()
writexl::write_xlsx(trials, "data/resumo_trials4.xlsx")
acess <- trial_to_insert3 %>%
group_by(Genotipo, acces_in_cassava) %>%
tally()
writexl::write_xlsx(acess, "data/resumo_acess3.xlsx")
cultivars are used to create the
is_control column in the final dataset of the trials.cultivars<-c("Aipim Abacate",
"Baianinha-MS",
"BRS Caipira",
"BRS CS01",
"BRS Dourada",
"BRS Formosa",
"BRS Gema de Ovo",
"BRS Jari",
"BRS Kiriris",
"BRS Mulatinha",
"BRS Novo Horizonte",
"BRS Poti Branca",
"BRS Tapioqueira",
"BRS Verdinha",
"Cacau",
"Cascuda",
"Cigana Preta",
"Correntao",
"Corrente",
"Eucalipto",
"Fecula Branca",
"IAC-12",
"IAC-14",
"IAC-576",
"IAC-90",
"Mani Branca",
"Nega Maluca",
"Olho Junto",
"Pioneira",
"Salangor",
"Tailandia",
"Valencia",
"Vassoura Preta"
)
for(i in levels(factor(trial_to_insert3$trial_name_suggest))) {
creating_trials <- trial_to_insert3 %>%
group_by(plot_name_suggest,
Genotipo,
Plot,
Bloco,
row_number,
col_number) %>%
filter(trial_inserted_in_cassava == "no" &
trial_name_suggest == i) %>%
mutate(
is_a_control = if_else(Genotipo %in% cultivars, 1, 0))%>%
select(plot_name_suggest,
Genotipo,
Plot,
Bloco,
is_a_control,
row_number,
col_number)
creating_trials["is_a_control"][creating_trials["is_a_control"] == 0] <- NA
colnames(creating_trials) <-
c(
"plot_name",
"accession_name",
"plot_number",
"block_number",
"is_a_control",
"row_number",
"col_number"
)
writexl::write_xlsx(creating_trials, paste("output/", i, ".xlsx", sep =""))
}
creating_acess <- trial_to_insert3 %>%
filter(trial_inserted_in_cassava == "no") %>%
select(plot_name_suggest, 13:72) %>%
rename(observationunit_name = plot_name_suggest)
writexl::write_xlsx(creating_acess, "output/acess_pheno.xlsx")
sessionInfo()
R version 4.1.3 (2022-03-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)
Matrix products: default
locale:
[1] LC_COLLATE=Portuguese_Brazil.1252 LC_CTYPE=Portuguese_Brazil.1252
[3] LC_MONETARY=Portuguese_Brazil.1252 LC_NUMERIC=C
[5] LC_TIME=Portuguese_Brazil.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] readxl_1.4.0 forcats_0.5.1 stringr_1.4.0 dplyr_1.0.9
[5] purrr_0.3.4 readr_2.1.2 tidyr_1.2.0 tibble_3.1.7
[9] ggplot2_3.3.6 tidyverse_1.3.1
loaded via a namespace (and not attached):
[1] Rcpp_1.0.8.3 lubridate_1.8.0 assertthat_0.2.1 rprojroot_2.0.3
[5] digest_0.6.29 utf8_1.2.2 R6_2.5.1 cellranger_1.1.0
[9] backports_1.4.1 reprex_2.0.1 evaluate_0.15 httr_1.4.3
[13] pillar_1.7.0 rlang_1.0.4 rstudioapi_0.13 whisker_0.4
[17] jquerylib_0.1.4 rmarkdown_2.14 munsell_0.5.0 broom_1.0.0
[21] compiler_4.1.3 httpuv_1.6.5 modelr_0.1.8 xfun_0.30
[25] pkgconfig_2.0.3 htmltools_0.5.2 tidyselect_1.1.2 workflowr_1.7.0
[29] fansi_1.0.3 crayon_1.5.1 tzdb_0.3.0 dbplyr_2.2.1
[33] withr_2.5.0 later_1.3.0 grid_4.1.3 jsonlite_1.8.0
[37] gtable_0.3.0 lifecycle_1.0.1 DBI_1.1.3 git2r_0.30.1
[41] magrittr_2.0.3 scales_1.2.0 writexl_1.4.0 cli_3.3.0
[45] stringi_1.7.6 fs_1.5.2 promises_1.2.0.1 xml2_1.3.3
[49] bslib_0.3.1 ellipsis_0.3.2 generics_0.1.3 vctrs_0.4.1
[53] tools_4.1.3 glue_1.6.2 hms_1.1.1 fastmap_1.1.0
[57] yaml_2.3.5 colorspace_2.0-3 rvest_1.0.2 knitr_1.39
[61] haven_2.5.0 sass_0.4.1