Write a mixture data frame to gsi_sim format baseline and repunits file
Source:R/write_gsi_sim_mixture.R
write_gsi_sim_mixture.RdNote, this is only intended to work with integer-valued alleles, at the moment. It was just written for testing and verifying that things are working correctly.
Arguments
- mix
mixture data frame
- gen_start_col
column in which the genetic data start
- mixprefix
path to write the mixture file to. The mixture collection name + .txt will be appended to this. This path can include directories if they exist. An example would be "./my_gsi_data/mixture". This is a required argument.
Examples
# this writes to file prefix "mixfile" in a temporary directory
dd <- tempdir()
prefix <- file.path(dd, "mixfile")
# print that
prefix
#> [1] "/var/folders/ln/5brnn1wx0vj58fhlbbdjm8h40000gp/T//RtmpRAg5Gu/mixfile"
# note that in practice you will probably want to specify
# your own directory...
# run the function
write_gsi_sim_mixture(chinook_mix, 5, prefix)
# see where those files live:
dir(dd, pattern = "mixfile*", full.names = TRUE)
#> [1] "/var/folders/ln/5brnn1wx0vj58fhlbbdjm8h40000gp/T//RtmpRAg5Gu/mixfile-rec1.txt"
#> [2] "/var/folders/ln/5brnn1wx0vj58fhlbbdjm8h40000gp/T//RtmpRAg5Gu/mixfile-rec2.txt"
#> [3] "/var/folders/ln/5brnn1wx0vj58fhlbbdjm8h40000gp/T//RtmpRAg5Gu/mixfile-rec3.txt"