| Trees | Indices | Help |
|---|
|
|
1 """
2 For conversion between different formats for representing alignments (DEPRECATED).
3
4 This module is considered obsolete and has been deprecated. Please use
5 Bio.AlignIO instead for reading and writing alignments in different file
6 formats.
7
8 classes:
9 FormatConverter
10 """
11
12 # biopython
13 from Bio.Fasta.FastaAlign import FastaAlignment
14 from Bio.Clustalw import ClustalAlignment
15
16 import warnings
17 warnings.warn("Bio.Align.FormatConvert is deprecated. Please use Bio.AlignIO "
18 "or the Alignment object's format method instead.",
19 DeprecationWarning)
20
22 """Convert between different alignment representation formats.
23
24 The basic idea behind the converter is that it takes a given format,
25 converts it into the base Alignment class, and then can return an object
26 in any other supported format with the info from the basal alignment.
27
28 Supported formats are:
29 o Clustal format (*.aln)
30 o Fasta format (*.fasta)
31 """
33 """Initialize a converter with a given object.
34
35 Arguments:
36 o to_convert - The class which we are going to be converting.
37 """
38 self.orig_format = to_convert
39
40 self._base_alphabet, self._base_records = self._get_base_info()
41
43 """Retrieve all of the basal (ie Generic.Alignment) info.
44
45 The idea is that this info is present in all of the classes and
46 this is the information that will be retained in a conversion.
47 Format specific information will be lost.
48 """
49 return self.orig_format._alphabet, self.orig_format._records
50
52 """Convert the current info into a FastaAlignment object.
53 """
54 return_format = FastaAlignment(self._base_alphabet)
55 return_format._records = self._base_records
56
57 return return_format
58
60 """Convert the current info into a ClustalAlignment object.
61 """
62 return_format = ClustalAlignment(self._base_alphabet)
63 return_format._records = self._base_records
64
65 return return_format
66
| Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0.1 on Wed Dec 16 11:26:54 2009 | http://epydoc.sourceforge.net |