Description Usage Arguments Value Examples
View source: R/write_to_structure.R
Take simulated genotypes and write to a STRUCTURE input file format.
1 2 3 4 5 6 7 8 9 |
sim_data |
Output from simulate_admixture |
structure_snp_order |
(Optional) The desired order of SNPs for columns of output file. |
example_structure_file |
(Optional) A sample STRUCTURE input file to extract the desired order of SNPs from. If both |
sample_names |
(Optional) vector of names for the simulated samples. |
output |
Name for the output file. |
type |
Options for txt or csv file outputs. |
keep_extra_snps |
If there are SNPs present in the simulated data, but not in the SNP order provided by |
NULL
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #Download files to temporary directory:
temp_dir <- tempdir()
download.file(url = "https://raw.githubusercontent.com/danwkenn/SimAdmixtR/master/inst/example-files/input-allele-frequencies-three-snps.csv",destfile = paste0(temp_dir,"/input-af-example.csv"))
download.file(url = "https://raw.githubusercontent.com/danwkenn/SimAdmixtR/master/inst/example-files/simple-three-allele-example.csv",destfile = paste0(temp_dir,"/example-structure-file.csv"))
sim_data <- simulate_admixture(
n_samples = 10,
ancestor_pop_label = c(1,2,2,2),
file = paste0(temp_dir,"/input-af-example.csv")
)
write_to_structure(
sim_data = sim_data,
example_structure_file = paste0(temp_dir,"/example-structure-file.csv"),
output = "example-output",
type = c("txt","csv"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.