Trees | Indices | Help |
---|
|
1 """ 2 Utility for conversion between different formats for representing alignments. 3 4 classes: 5 FormatConverter 6 """ 7 8 # biopython 9 from Bio.Fasta.FastaAlign import FastaAlignment 10 from Bio.Clustalw import ClustalAlignment 11 1214 """Convert between different alignment representation formats. 15 16 The basic idea behind the converter is that it takes a given format, 17 converts it into the base Alignment class, and then can return an object 18 in any other supported format with the info from the basal alignment. 19 20 Supported formats are: 21 o Clustal format (*.aln) 22 o Fasta format (*.fasta) 23 """5825 """Initialize a converter with a given object. 26 27 Arguments: 28 o to_convert - The class which we are going to be converting. 29 """ 30 self.orig_format = to_convert 31 32 self._base_alphabet, self._base_records = self._get_base_info()3335 """Retrieve all of the basal (ie Generic.Alignment) info. 36 37 The idea is that this info is present in all of the classes and 38 this is the information that will be retained in a conversion. 39 Format specific information will be lost. 40 """ 41 return self.orig_format._alphabet, self.orig_format._records4244 """Convert the current info into a FastaAlignment object. 45 """ 46 return_format = FastaAlignment(self._base_alphabet) 47 return_format._records = self._base_records 48 49 return return_format5052 """Convert the current info into a ClustalAlignment object. 53 """ 54 return_format = ClustalAlignment(self._base_alphabet) 55 return_format._records = self._base_records 56 57 return return_format
Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Mon Sep 15 09:24:29 2008 | http://epydoc.sourceforge.net |