ImportFastaAlignment: Import a FASTA alignment from a file

Description Usage Arguments Details Value Note Author(s) Examples

Description

Import a FASTA alignment from a file and if needed converts the space in the FASTA headers into underscore "_"

Usage

1
ImportFastaAlignment(File,fixSpaceinHeaders=TRUE)

Arguments

File

path to the FASTA file

fixSpaceinHeaders

logical. If TRUE, replaces spaces in the headers by underscores. The function runs faster if this is turned to FALSE. Alternatively, one can "clean" the headers before importing the alignment to R!

Details

require(seqinr)

Value

The function returns a list containing a vector of names (rows) and a matrix of sequence nber by site List with two items:

Seqs.names

FASTA headers

Seqs.only

only the FASTA sequences as vectors of bases. This is in a matrix format.

Note

require(seqinr)

Author(s)

Alban Ramette

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
#require(seqinr)

#write.fasta(sequences="mock-env-aligned.fasta",file.out="mock-env-aligned.fasta")
#mock_env_aligned.list <-  ImportFastaAlignment(File="mock-env-aligned.fasta",fixSpaceinHeaders=TRUE)
#data(mock_env_aligned.list) # resulting list after importing from the previous line

#FastaHeaders <-  mock_env_aligned.list[[1]]
#Sequences  <-   mock_env_aligned.list[[2]]
#SEQUENCES <- toupper(Sequences) #convert sequences to capital letters

#Nseqs <-  nrow(Sequences) #nber of sequences
#Nbases <- ncol(Sequences)#nber of bases


 

aramette/otu2ot documentation built on May 10, 2019, 12:46 p.m.