cran package haplotypes (http://cran.r-project.org/web/packages/haplotypes/index.html) also provides functions for that. Install the package. Save your sequence data in fasta format. Suppose it is in the working directory and called sample.fas. Paste the following codes: