Write a faststructure file from a tidy data frame. For biallelic dataset only. Used internally in radiator and assigner and might be of interest for users.

write_faststructure(
  data,
  plink.bed = FALSE,
  pop.levels = NULL,
  filename = NULL,
  ...
)

Arguments

data

(4 options) A file or object generated by radiator:

  • tidy data

  • Genomic Data Structure (GDS)

How to get GDS and tidy data ? Look into tidy_genomic_data, read_vcf or tidy_vcf.

To export in plink BED format. This will write 3 files: .bed, .bim, .fam. For this option to work, the argument data must be a GDS file or object. Default: plink.bed = FALSE.

pop.levels

(optional, string) This refers to the levels in a factor. In this case, the id of the pop. Use this argument to have the pop ordered your way instead of the default alphabetical or numerical order. e.g. pop.levels = c("QUE", "ONT", "ALB") instead of the default pop.levels = c("ALB", "ONT", "QUE"). White spaces in population names are replaced by underscore. Default: pop.levels = NULL.

filename

(optional) The file name prefix for the faststructure file written to the working directory. With default: filename = NULL, the date and time is appended to radiator_faststructure_.

...

other parameters passed to the function.

Value

A faststructure file is saved to the working directory.

References

Raj A, Stephens M, Pritchard JK (2014) fastSTRUCTURE: Variational Inference of Population Structure in Large SNP Datasets. Genetics, 197, 573-589.

Author

Thierry Gosselin thierrygosselin@icloud.com