# Analysis of haplotype counts # Knegt etal # Title: Detection of genetic incompatibilities in non-model systems using simple # genetic markers: hybrid breakdown in the haplodiploid spider mite # Tetranychus evansi Knegt_etal_Haplotype_counts1 <- read.csv("X:/YourDirectory/.../Knegt_etal_Haplotype_counts1.csv") pairs.long <- Knegt_etal_Haplotype_counts1 rm(Knegt_etal_Haplotype_counts1) ##### DIFFERENCES AMONG GROUPS # Question 1: do the four groups show different haplotype count patterns? # Method: Cochran-Mantel-Haenszel test # viable I versus viable II vSvB <- subset(pairs.long, Group == "viable I" | Group == "viable II") vSvB$Group <- factor(vSvB$Group) Mantel.vSvB <- xtabs(Count ~ Group + Haplotype + Pair, data = vSvB) mantelhaen.test(Mantel.vSvB) # viable I versus inviable I vSiS <- subset(pairs.long, Group == "viable I" | Group == "inviable I") vSiS$Group <- factor(vSiS$Group) Mantel.vSiS <- xtabs(Count ~ Group + Haplotype + Pair, data = vSiS) mantelhaen.test(Mantel.vSiS) # viable II versus inviable II vBiB <- subset(pairs.long, Group == "viable II" | Group == "inviable II") vBiB$Group <- factor(vBiB$Group) Mantel.vBiB <- xtabs(Count ~ Group + Haplotype + Pair, data = vBiB) mantelhaen.test(Mantel.vBiB) # Sequential Bonferroni corrected p-values: p.values <- as.data.frame(cbind(c("viable I versus viable II", "viable I versus inviable I", "viable II versus inviable II"), p.adjust(c(mantelhaen.test(Mantel.vSvB)$p.value, mantelhaen.test(Mantel.vSiS)$p.value, mantelhaen.test(Mantel.vBiB)$p.value), method = "holm"))) colnames(p.values) <- c("comparison", "adjusted p") p.values # Conclusion question 1: all corrected p-values < 0.01 # So all compared groups have different haplotype frequencies