bensutherland / simple_pop_stats

A short analysis of population statistics given specific inputs
5 stars 1 forks source link

Benchmark folder structure is not yet constructed to handle both microsatellite and SNP data #9

Open bensutherland opened 3 years ago

bensutherland commented 3 years ago

We currently write to the PBT folder with microsat benchmarking, which could become an issue in particular for species that have both microsatellite and SNP baselines in play. This is not quite as simple as using a global variable, since Rmarkdown does not work well with global variables. As per:

"For better or worse, this omission is intentional. Relying on objects created outside the document makes your document less reproducible--that is, if your document needs data in the global environment, you can't just give someone (or yourself in two years) the document and data files and let them recreate it themselves. For this reason, and in order to perform the render in the background, RStudio actually creates a separate R session to render the document. That background R session cannot see any of the environments in the interactive R session you see in RStudio."

erondeau commented 3 years ago

Currently, I require the benchmark document to have two variables - species ID and folder name for the benchmark. I see the best option here, if we choose to store Microsat database elsewhere:

Write a third variable (SNP / Microsat) and then assign the base path based on which option is chosen:

marker_type <- "microsat"

[...]

if(marker_type=="SNP"){
     knitr::opts_knit$set(root.dir = paste0("W:/9_PBT/01_",species,"/reference_databases/",folder,"/"))
} else if (marker_type == "microsat"){
     knitr::opts_knit$set(root.dir = paste0("W:/1_GSI/",species,"/reference_databases/",folder,"/"))
}

Feedback needed - is the microsat path given here the preferred path?

erondeau commented 3 years ago

Today I added that third variable. So if we do want to move the microsats, I just need to confirm to where and I will enact the above (although variable is datatype and not marker_type