Skip to content

Instantly share code, notes, and snippets.

@geneva
Last active October 30, 2019 03:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save geneva/5272785 to your computer and use it in GitHub Desktop.
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 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