load_alignment: function to load a file containing a sequences alignment...

Description Usage Arguments Value Author(s) See Also Examples

View source: R/functions.R

Description

this function is wrapper around the functions 'read.alignment', 'fasta2DNAbin' and 'as.DNAbin'. The goal of this function is to load different types of sequences alignments, i.e. protein, DNA, RNA, in different formats, i.e. fasta, phylip, mase, clustal or msf and to convert it in the best suitable object class for generating a distance matrix either with the 'seqnir' or the 'ape' package

Usage

1
load_alignment(file, format, type = "protein")

Arguments

file

a character string specifying the path to the file containing a sequences alignment to be loaded to the global environment

format

a character string specifying the format of the file, i.e. fasta, phylip, mase, clustal or msf (no default)

type

a character string specifying type of sequences, i.e. protein, DNA, RNA (default: protein)

Value

if the input type is DNA or RNA this function returns an object of class DNAbin, if the input type is protein or unspecified (default) this function returns an object of class alignment (seqinr package)

Author(s)

gerardo esteban antonicelli

See Also

'retrieve_seqs' 'print_alignment' 'clean_alignment' 'make_tree' 'max_parsimony'

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
fastaRNA_load <- load_alignment(system.file('extdata',
                                            'spike_align.fasta',
                                            package='firstPackage'),
                                 'fasta', 'RNA')
phylipRNA_load  <- load_alignment(system.file('extdata',
                                              'spike_align.phy',
                                              package='firstPackage'),
                                 'phylip', 'RNA')
phylipProt_load <- load_alignment(system.file('extdata',
                                              'spike_prot_align.phy',
                                              package='firstPackage'),
                                 'phylip', 'protein')
clustalRNA_load <- load_alignment(system.file('extdata',
                                              'spike_align.aln',
                                              package='firstPackage'),
                                 'clustal')
msfRNA_load <- load_alignment(system.file('extdata',
                                          'orf1ab_align.msf',
                                          package='firstPackage'),
                                 'msf', 'RNA')
maseProtein_load <- load_alignment(system.file('extdata',
                                               'prot.mase',
                                               package='firstPackage'),
                                 'mase')
data(fastaRNA); stopifnot(identical(fastaRNA, fastaRNA_load))
data(phylipRNA); stopifnot(identical(phylipRNA, phylipRNA_load))
data(clustalRNA); stopifnot(identical(clustalRNA, clustalRNA_load))
data(msfRNA); stopifnot(identical(msfRNA, msfRNA_load))
data(maseProtein); stopifnot(identical(maseProtein, maseProtein_load))

geantonicelli/firstPackage documentation built on Aug. 24, 2020, 3:14 a.m.