Skip to content
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

dist.codom error #8

Open
LinaValencia85 opened this issue Dec 8, 2017 · 4 comments
Open

dist.codom error #8

LinaValencia85 opened this issue Dec 8, 2017 · 4 comments

Comments

@LinaValencia85
Copy link

I am using the dist.codom function, but I am getting the following error:

Error in dimnames(x) <- dn :
length of 'dimnames' [1] not equal to array extent

I was able to succesfully upload my SNP dataset with the read.structure() and have been able to run succesfully other function within the package but not dist.codom. Any ideas as to what is happening?

@dwinter
Copy link
Owner

dwinter commented Dec 8, 2017

Hi @LinaValencia85 ,

You are getting this error because every individual in your dataset has at least some missing data.

It's not clear to me how missing data should be handled when calculating a distance matrix. MMOD was written way back when 30 microsats was a bit dataset and missing data was uncommon, so I just removed all individuals that had any missing data.

You can get a matrix similar to the one returned by dist.codom easily enough, but doing so llustrates the problem.

M <- dist(tab(d)/ploidy(d), "manhattan")
plot(hclust(M))

When you look at the results you will see they are clustered by missingness much more than shared alleles. If this is a radseq or similar dataset, so the missingness is an unavoidable part of the data, I would look into genotype likelihood approaches or other methods designed to deal with these sorts of data in particular.

Sorry I can't be much more help.

@LinaValencia85
Copy link
Author

LinaValencia85 commented Dec 11, 2017 via email

@zkamvar
Copy link
Contributor

zkamvar commented Dec 11, 2017

Hi @LinaValencia85,

You might want to check that you don't have incomparable samples in your data set (e.g. samples that have missing data at opposing loci). My package (poppr) has such a function: http://grunwaldlab.github.io/poppr/reference/incomp.html

Additionally, poppr also has this distance measure 😁: (http://grunwaldlab.github.io/poppr/reference/diss.dist.html)

(Sorry @dwinter for spamming your issues)

@LinaValencia85
Copy link
Author

LinaValencia85 commented Dec 11, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants