Last active
October 30, 2019 03:07
-
-
Save geneva/5272785 to your computer and use it in GitHub Desktop.
A simple R function that converts the binary table output from RawGeno to a format that can be read by AFLPScore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This function converts the binary table output from | |
# RawGeno to a format that can be read by AFLPScore | |
################################## | |
# RawGeno_2_AFLPscore function # | |
################################## | |
RawGeno_2_AFLPscore <- function(outfilename) | |
{ | |
dat <- data.binary$data.height.raw | |
tdat <- t(dat) | |
names <- vector(length = ncol(tdat)) | |
names[1] <-"" | |
for (i in 2:ncol(tdat)) | |
{ | |
names[i] <- paste("Loc_",i,sep="") | |
} | |
colnames(tdat) <- names | |
tdat[which(tdat==0)] = NA | |
write.table(tdat, outfilename, na="", quote=FALSE, sep="\t") | |
} | |
################################## | |
# end function # | |
################################## | |
### To use type RawGeno_2_AFLPscore("outfile.txt") to create a coverted file with name outfile.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment