read.fasta: Read FASTA formated Sequences

Description Usage Arguments Value Note Author(s) References See Also Examples

Description

Read aligned or un-aligned sequences from a FASTA format file.

Usage

1
read.fasta(file, rm.dup = TRUE, to.upper = FALSE, to.dash=TRUE)

Arguments

file

input sequence file.

rm.dup

logical, if TRUE duplicate sequences (with the same names/ids) will be removed.

to.upper

logical, if TRUE residues are forced to uppercase.

to.dash

logical, if TRUE ‘.’ gap characters are converted to ‘-’ gap characters.

Value

A list with two components:

ali

an alignment character matrix with a row per sequence and a column per equivalent aminoacid/nucleotide.

ids

sequence names as identifers.

call

the matched call.

Note

For a description of FASTA format see: http://www.ncbi.nlm.nih.gov/BLAST/blastcgihelp.shtml. When reading alignment files, the dash ‘-’ is interpreted as the gap character.

Author(s)

Barry Grant

References

Grant, B.J. et al. (2006) Bioinformatics 22, 2695–2696.

See Also

read.fasta.pdb

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# Read alignment
aln <- read.fasta(system.file("examples/hivp_xray.fa",package="bio3d"))

# Print alignment overview
aln

# Sequence names/ids
head( aln$id )

# Alignment positions 335 to 339
head( aln$ali[,33:39] )

# Sequence d2a4f_b
aa123( aln$ali["d2a4f_b",] )

# Write out positions 33 to 45 only
#aln$ali=aln$ali[,30:45]
#write.fasta(aln, file="eg2.fa")

bio3d documentation built on April 3, 2018, 9:05 a.m.