For this tutorial series, we will be using data in HapMap format that is used in TASSEL.

Install package

devtools::install_github("dpaudel/dpaudelR") 

Load required package

library(LDcorSV)
library(adegenet)
library(ggplot2)
library(scales)
library(tidyverse)
library(dpaudelR)

Import data

Download data:

For this tutorial, we will be using hapmap data that comes with TASSEL. The data can be downloaded from this link:

https://raw.githubusercontent.com/dpaudel/TASSELtutorial/master/data/mdp_genotype_subset.hmp.txt

Right click and Save the data in your computer.

Import the data by running the following script.

mygeno=hapMap2genlight2(file.choose()) # Choose the hapmap file that you just downloaded.

Get the genlight object for DAPC

mygeno1 <- mygeno[[1]]

Remove NA

toRemove <- is.na(glMean(x, alleleAsUnit = FALSE)) # TRUE where NA when Error in glPca(flu) : NAs detected in the vector of means
which(toRemove) # position of entirely non-typed loci
b <- x[, !toRemove]

Now b is our genlight object.

Follow the rest of the tutorial for further analysis.