-
Notifications
You must be signed in to change notification settings - Fork 10
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
Ops.factor(left, right) error #90
Comments
Hi Chris, You seem to have identified the problem correctly. You can try to edit the function yourself. First make a copy in your workspace: mydist <- pegas::dist.haplotype.loci You can then either print and copy the code in a a file[1] that you can ### find this line
d[k] <- sum(x[, i] != x[, j])
### to become:
d[k] <- sum(as.character(x[, i]) != as.character(x[, j])) You should be able to use dist.haplotype.loci <- mydist You can still use the pegas version in the same session with Tell me how this works with your data. Cheers, [1] Or more directly: cat(deparse(pegas::dist.haplotype.loci), sep = "\n", file = "mydist.R") |
Hi Emmanuel, Thank you for your response! The changes above do allow for dist.haplotyp.loci (in this case above, mydist()) to proceed. However, all of the distances calculated across all variant pairwise comparisons is = 1. This command calculates the Hamming distance for pairwise comparisons, right? Is it taking account the differences for a single position, or is the distance calculated across the entire haplotype? Having all of my distances = 1 is unclear, though I may be misinterpreting the calculation. Thank you, |
Yes, this function computes the (unscaled) Hamming distance. Maybe each haplotype differs by one SNP? |
Hi Emmanuel,
I am working with phased loci data in pegas - when I was trying to compute pairwise distances among haplotypes, using dist.haplotype.loci(), I came across the error:
"Error in Ops.factor(left, right) : level sets of factors are different"
The data seem to be imported and haplotype() created an object "haplotype.loci" class. Looking at my imported dataset, I noticed that some positions have a factor of 3 (i.e 0|1, 1|0, 1|1) or 4 (i.e 0|0, 0|1, 1|0, 1|1). I am not sure if this is the reason for the error, but is there any suggestion on how to work with phased data that may have variable factored data at certain positions?
Thank you,
Chris
The text was updated successfully, but these errors were encountered: