Genetic matrix to STRUCTURE file
0
0
Entering edit mode
3.2 years ago
Austin • 0

I want to convert a genetic matrix (rows are samples, columns are alleles) into a STRUCTURE file (output .str) within R. Is there a preferred way to achieve this? I've found this command in the graph4lg R package, but I wanted to see if there are other approaches.

An example of what I mean by a "genetic matrix":

# Build a matrix of alleles
temp <- lapply(1:30, function(i) sample(1:9, 4, replace = TRUE))
temp <- sapply(temp, paste, collapse="")
temp <- matrix(temp, nrow = 10, dimnames = list(paste("ind",1:10), paste("loc",1:3)))
temp

# Convert matrix to genind format (for adegenet package)
test <- df2genind(temp, ploidy = 4, sep = "")
test

# How to convert to STRUCTURE?

If anyone has input, please chime in! Thanks

STRUCTURE file-formats adegenet • 480 views
ADD COMMENT

Login before adding your answer.

Traffic: 2434 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6