Open dani-davenport opened 7 years ago
Hello,
OutFLANK uses a 9 for missing data, as described in the pdf. When I fixed your data, it worked just fine. That is because NAs are removed by the algorithm, resulting in a different length between your vectors.
library(OutFLANK) o <- read.table("OUTFLANK_data.txt") dim(o) p <- read.csv("popNames_OF.txt") head(p) l <- read.csv("locusNames_OF.txt") head(l)
sum(is.na(o)) # should not contain NAs o2 <- o o2[is.na(o2)] <- 9 sum(is.na(o2)) dim(o2) levels(factor(as.numeric(unlist(o2))))
out <- MakeDiploidFSTMat(SNPmat=o2, locusNames=l$x, popNames=p$x)
out <- MakeDiploidFSTMat(SNPmat=o, locusNames=l$x, popNames=p$x)
On Aug 3, 2017, at 1:29 AM, tunaloveheart notifications@github.com wrote:
Dear Micheal and Katie
Hoping you could take a look at this issue below and help me out. Got it working, then R crashed, now even after reinstalling the packages and updating still cant get it to work.
FSTmat<- MakeDiploidFSTMat(SNPmat=SNPmat, locusNames=locusNames, popNames=as.character(pops))
Error in tapply(snpDataTemp, list(popNameTemp, snpDataTemp), length) : arguments must have same length
So we try to transpose matrix... because of conflicting data input information between (a) OUTFLANK readme pdf and ?MakeDiploidFSTMat
SNPmat<- t(SNPmat)
FSTmat<- MakeDiploidFSTMat(SNPmat=SNPmat, locusNames=locusNames, popNames=as.character(pops)) [1] "Error: your population names do not match your SNP matrix" Error in MakeDiploidFSTMat(SNPmat = SNPmat, locusNames = locusNames, popNames = as.character(pops)) : no loop for break/next, jumping to top level
Please find attached my genotype data file and locusNames and pops OutFLANK_data.txt https://github.com/whitlock/OutFLANK/files/1196071/OutFLANK_data.txt locusNames_OF.txt https://github.com/whitlock/OutFLANK/files/1196073/locusNames_OF.txt popNames_OF.txt https://github.com/whitlock/OutFLANK/files/1196074/popNames_OF.txt — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/whitlock/OutFLANK/issues/7, or mute the thread https://github.com/notifications/unsubscribe-auth/AGjUbYo7aJls_0dAODZBJhyLCDqagoQJks5sUVq6gaJpZM4Or-QX.
Hey Katie
Thanks so much I knew it would be something stupid. When R crashed I mustn't have saved the right data frame which worked the first time because I change the NA to 9. Thanks again and sorry for my stupid question!!
Dani
Sent from my iPhone
On 3 Aug 2017, at 7:35 pm, Katie Lotterhos notifications@github.com wrote:
Hello,
OutFLANK uses a 9 for missing data, as described in the pdf. When I fixed your data, it worked just fine. That is because NAs are removed by the algorithm, resulting in a different length between your vectors.
library(OutFLANK) o <- read.table("OUTFLANK_data.txt") dim(o) p <- read.csv("popNames_OF.txt") head(p) l <- read.csv("locusNames_OF.txt") head(l)
Use 9 for missing data
sum(is.na(o)) # should not contain NAs o2 <- o o2[is.na(o2)] <- 9 sum(is.na(o2)) dim(o2) levels(factor(as.numeric(unlist(o2))))
out <- MakeDiploidFSTMat(SNPmat=o2, locusNames=l$x, popNames=p$x)
out <- MakeDiploidFSTMat(SNPmat=o, locusNames=l$x, popNames=p$x)
replicate error when use NA for missing data
On Aug 3, 2017, at 1:29 AM, tunaloveheart notifications@github.com wrote:
Dear Micheal and Katie
Hoping you could take a look at this issue below and help me out. Got it working, then R crashed, now even after reinstalling the packages and updating still cant get it to work.
FSTmat<- MakeDiploidFSTMat(SNPmat=SNPmat, locusNames=locusNames, popNames=as.character(pops))
Error in tapply(snpDataTemp, list(popNameTemp, snpDataTemp), length) : arguments must have same length
So we try to transpose matrix... because of conflicting data input information between (a) OUTFLANK readme pdf and ?MakeDiploidFSTMat
SNPmat<- t(SNPmat)
FSTmat<- MakeDiploidFSTMat(SNPmat=SNPmat, locusNames=locusNames, popNames=as.character(pops)) [1] "Error: your population names do not match your SNP matrix" Error in MakeDiploidFSTMat(SNPmat = SNPmat, locusNames = locusNames, popNames = as.character(pops)) : no loop for break/next, jumping to top level
Please find attached my genotype data file and locusNames and pops OutFLANK_data.txt https://github.com/whitlock/OutFLANK/files/1196071/OutFLANK_data.txt locusNames_OF.txt https://github.com/whitlock/OutFLANK/files/1196073/locusNames_OF.txt popNames_OF.txt https://github.com/whitlock/OutFLANK/files/1196074/popNames_OF.txt — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/whitlock/OutFLANK/issues/7, or mute the thread https://github.com/notifications/unsubscribe-auth/AGjUbYo7aJls_0dAODZBJhyLCDqagoQJks5sUVq6gaJpZM4Or-QX.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
Thanks I had the same problem. using plink --recodeA gives a genotype matrix with NA, thus this problem. Could you place this conversion of formats [is.na(genotype)] <- 9 in the vignette so that people without a bunch of experience in R can fix their input files to match this non-standard format (i.e. 9 instead of NA)?
Dear Micheal and Katie
Hoping you could take a look at this issue below and help me out. Got it working, then R crashed, now even after reinstalling the packages and updating still cant get it to work.
Error in tapply(snpDataTemp, list(popNameTemp, snpDataTemp), length) : arguments must have same length
So we try to transpose matrix... because of conflicting data input information between (a) OUTFLANK readme pdf and ?MakeDiploidFSTMat
SNPmat<- t(SNPmat)
Please find attached my genotype data file and locusNames and pops OutFLANK_data.txt locusNames_OF.txt popNames_OF.txt