Learn R Programming

phylotools (version 0.2.2)

read.phylip: read phylip file

Description

read the phylip file, and store the sequences and their names in data frame.

Usage

read.phylip(infile, clean_name = TRUE)

Arguments

infile

character string for the name of the phylip file.

clean_name

logical, representing cleaning of the names will be performed.

Value

a data frame with two columns: (1) seq.name, the names for all the sequences; (2) seq.text, the raw sequence data.

Details

read.phylip accepts both interleaved and sequential phylip, the number of sequences is identified by parsing the first line of the file. Sequences and their names will be stored in a data frame.

If clean_name is TRUE, punctuation characters and white space be replaced by "_". Definition of punctuation characters can be found at regex.

See Also

read.fasta

Examples

Run this code
# NOT RUN {
  cat("6 22",
  "seq_1    --TTACAAATTGACTTATTATA",
  "seq_2    GATTACAAATTGACTTATTATA",
  "seq_3    GATTACAAATTGACTTATTATA",
  "seq_5    GATTACAAATTGACTTATTATA",
  "seq_8    GATTACAAATTGACTTATTATA",
  "seq_10   ---TACAAATTGAATTATTATA",
  file = "matk.phy", sep = "\n")

res <- read.phylip(infile = "matk.phy")
unlink("matk.phy")
# }

Run the code above in your browser using DataLab