-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MakeDiploidFSTMat Error X 2 #7
Comments
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 ***@***.***> 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 <#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 ***@***.***> 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 ***@***.***> 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 <#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)? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
The text was updated successfully, but these errors were encountered: