Learn R Programming

sidier (version 1.0)

FindHaplo: Find equal haplotypesFind equal haplotypes

Description

This function assigns the same name to equal haplotypes in a sequence alignment.

Usage

FindHaplo(readfile = T, input = NA, align = NA, saveFile = T, outname = "FindHaplo.txt")

Arguments

readfile
a logical; if TRUE (default), the input alignment is provided as a fasta format in a text file. If FALSE, the alignment is provided as an R object.
input
the name of the fasta file to be analysed.
align
the name of the alignment to be analysed (if "readfile" is set to FALSE,). See "read.dna" in ape package for details about reading alignments.
saveFile
a logical; if TRUE (default), function output is saved as a text file.
outname
if "SaveFile" is set to TRUE (default), contains the name of the output file ("FindHaplo.txt" by default).

Value

  • A matrix showing the assigned haplotype name to each sequence in the alignment.

See Also

HapPerPop

Examples

Run this code
cat(">Population1_sequence1",
"TTATAGCTGTCGGGCTAGTAGCTGTATCAGTCGTACGTAGTAGTCGTGTCGATCGATGGCGCGGCGCATC--------------------TAGCGCTAGCTGATGCTAGTAGCGTAGAGTATG",
">Population2_sequence1",
"TTATAGCTGTCGGGCTAGTAGCTGTATCAGTC--------------------TCGATGGCGCGGCGCATCAATATTATATCGGCGATGCGTAGCGCTAGCTGATGCTAGTAGCGTAGAGTATG",
">Population3_sequence1",
"TTATAGCTGTCGGGCTAGTAGCTGTATCAGTC-------GTA----------TCGATGGCGCGGCGCATC--------------------TAGCGCTAGCTGATGCTAGTAGCGTAGAGTATG",
">Population4_sequence1",
"TTATAGCTGTCGGGCTAGTAGCTGTATCAGTC----------------------------------------------------------TAGCGCTAGCTGATGCTAGTAGCGTAGAGTATG",
">Population5_sequence1",
"TTATAGCTGTCGGGCTAGTAGCTGTATCAGTCGTACGTA--------------------------------------TATCGGCGATGCGTAGCGCTAGCTGATGCTAGTAGCGTAGAGTATG",
     file = "ex1.fas", sep = "")
	 example1 <- read.dna("ex1.fas", format = "fasta")
     # Reading the alignment from an object:
	 FindHaplo(readfile=FALSE,align=example1)
	 # Reading the alignment directly from file:
	 FindHaplo(input="ex1.fas")

Run the code above in your browser using DataLab