file.read {phyclust} | R Documentation

## Read Data from Files by Formats and Return a seq.data Object

### Description

Two major file formats are supported in phyclust, `Format phylip` and `Format fasta`. These functions only read files in basic syntax, and return an object in `Class seq.data`.

### Usage

    read.fasta(filename, byrow = TRUE, code.type = .code.type[1], aligned = TRUE,
               sep = "")
    read.fasta.format(filename, byrow = TRUE, aligned = TRUE, sep = "")

    read.phylip(filename, byrow = TRUE, code.type = .code.type[1], sep = "")
    read.phylip.format(filename, byrow = TRUE, sep = "")

### Arguments

`filename` | a file name where data is read from.
`byrow` | advanced option, default = TRUE.
`code.type` | either "NUCLEOTIDE" (default) or "SNP".
`aligned` | indicate aligned data.
`sep` | use to split sites, "" (default) and "," for "CODON".

### Details

For unaligned sequences, `read.fasta` returns a list storing data. `read.phylip` is only for aligned data and returns a matrix.

`read.fasta.format` and `read.phylip.format` will read in original coding without any transformation as `code.type = NULL` in `write.fasta` and `write.phylip`. Suppose these functions return an object `ret`, one can write other functions `ret2aa()` to post transform the coding and replace `ret$org` by the results of `ret2aa(ret$org.code)`.

`byrow` indicates the data will be store by row or not. Usually, the default is TRUE. The FALSE is only for advance users with careful manipulations and for speeding up the bootstraps.

`sep` can specify a character which is used to split sites in file. By default, "" denote no character between sites. Only "CODON" id requires a character to avoid ambiguity

### Value

Return an object in `Class seq.data`.

### Author(s)

Wei-Chen Chen wccsnow@gmail.com

### References

Phylogenetic Clustering Website: https://snoweye.github.io/phyclust/

### See Also

`write.fasta`, `write.phylip`.

### Examples

    ## Not run:
    library(phyclust, quiet = TRUE)

    # PHYLIP
    data.path <- paste(.libPaths()[1], "/phyclust/data/crohn.phy", sep = "")
    (my.snp <- read.phylip(data.path, code.type = "SNP"))

    # FASTA
    data.path <- paste(.libPaths()[1], "/phyclust/data/pony625.fas", sep = "")
    (my.pony <- read.fasta(data.path))

    ## End(Not run)

[Package phyclust version 0.1-25 Index]