Back to index

python-biopython  1.60
Public Member Functions | Static Public Attributes | Private Attributes
Bio.Phylo.PhyloXMLIO.Writer Class Reference

List of all members.

Public Member Functions

def __init__
def write
def phyloxml
def other
def binary_characters
def domain

Static Public Attributes

tuple phylogeny
tuple clade
tuple accession
tuple annotation
tuple clade_relation
tuple color = _handle_complex('color', (), ('red', 'green', 'blue'))
tuple confidence
tuple date
tuple distribution
tuple domain_architecture
tuple events
tuple id = _handle_complex('id', ('provider',), (), has_text=True)
tuple mol_seq
tuple node_id = _handle_complex('node_id', ('provider',), (), has_text=True)
tuple point
tuple polygon = _handle_complex('polygon', (), (('point', 'points'),))
tuple property
tuple reference = _handle_complex('reference', ('doi',), ('desc',))
tuple sequence
tuple sequence_relation
tuple taxonomy
tuple uri = _handle_complex('uri', ('desc', 'type'), (), has_text=True)
tuple alt = _handle_simple('alt')
tuple branch_length = _handle_simple('branch_length')
tuple lat = _handle_simple('lat')
tuple long = _handle_simple('long')
tuple maximum = _handle_simple('maximum')
tuple minimum = _handle_simple('minimum')
tuple value = _handle_simple('value')
tuple width = _handle_simple('width')
tuple blue = _handle_simple('blue')
tuple duplications = _handle_simple('duplications')
tuple green = _handle_simple('green')
tuple losses = _handle_simple('losses')
tuple red = _handle_simple('red')
tuple speciations = _handle_simple('speciations')
tuple bc = _handle_simple('bc')
tuple code = _handle_simple('code')
tuple common_name = _handle_simple('common_name')
tuple desc = _handle_simple('desc')
tuple description = _handle_simple('description')
tuple location = _handle_simple('location')
tuple name = _handle_simple('name')
tuple rank = _handle_simple('rank')
tuple scientific_name = _handle_simple('scientific_name')
tuple symbol = _handle_simple('symbol')
tuple synonym = _handle_simple('synonym')
tuple type = _handle_simple('type')

Private Attributes

 _tree

Detailed Description

Methods for serializing a PhyloXML object to XML.

Definition at line 648 of file PhyloXMLIO.py.


Constructor & Destructor Documentation

def Bio.Phylo.PhyloXMLIO.Writer.__init__ (   self,
  phyloxml 
)
Build an ElementTree from a PhyloXML object.

Definition at line 651 of file PhyloXMLIO.py.

00651 
00652     def __init__(self, phyloxml):
00653         """Build an ElementTree from a PhyloXML object."""
00654         assert isinstance(phyloxml, PX.Phyloxml), "Not a Phyloxml object"
00655         self._tree = ElementTree.ElementTree(self.phyloxml(phyloxml))


Member Function Documentation

Serialize a binary_characters node and its subnodes.

Definition at line 723 of file PhyloXMLIO.py.

00723 
00724     def binary_characters(self, obj):
00725         """Serialize a binary_characters node and its subnodes."""
00726         elem = ElementTree.Element('binary_characters',
00727                 _clean_attrib(obj,
00728                     ('type', 'gained_count', 'lost_count',
00729                         'present_count', 'absent_count')))
00730         for subn in ('gained', 'lost', 'present', 'absent'):
00731             subelem = ElementTree.Element(subn)
00732             for token in getattr(obj, subn):
00733                 subelem.append(self.bc(token))
00734             elem.append(subelem)
00735         return elem

Here is the call graph for this function:

def Bio.Phylo.PhyloXMLIO.Writer.domain (   self,
  obj 
)
Serialize a domain node.

Definition at line 754 of file PhyloXMLIO.py.

00754 
00755     def domain(self, obj):
00756         """Serialize a domain node."""
00757         elem = ElementTree.Element('domain',
00758                 {'from': str(obj.start + 1), 'to': str(obj.end)})
00759         if obj.confidence is not None:
00760             elem.set('confidence', _serialize(obj.confidence))
00761         if obj.id is not None:
00762             elem.set('id', obj.id)
00763         elem.text = _serialize(obj.value)
00764         return elem

Here is the call graph for this function:

def Bio.Phylo.PhyloXMLIO.Writer.other (   self,
  obj 
)

Definition at line 672 of file PhyloXMLIO.py.

00672 
00673     def other(self, obj):
00674         elem = ElementTree.Element(_ns(obj.tag, obj.namespace), obj.attributes)
00675         elem.text = obj.value
00676         for child in obj.children:
00677             elem.append(self.other(child))
00678         return elem

Here is the call graph for this function:

Here is the caller graph for this function:

def Bio.Phylo.PhyloXMLIO.Writer.phyloxml (   self,
  obj 
)

Definition at line 664 of file PhyloXMLIO.py.

00664 
00665     def phyloxml(self, obj):
00666         elem = ElementTree.Element('phyloxml', obj.attributes) # Namespaces
00667         for tree in obj.phylogenies:
00668             elem.append(self.phylogeny(tree))
00669         for otr in obj.other:
00670             elem.append(self.other(otr))
00671         return elem

Here is the call graph for this function:

def Bio.Phylo.PhyloXMLIO.Writer.write (   self,
  file,
  encoding = 'utf-8',
  indent = True 
)

Definition at line 656 of file PhyloXMLIO.py.

00656 
00657     def write(self, file, encoding='utf-8', indent=True):
00658         if indent:
00659             _indent(self._tree.getroot())
00660         self._tree.write(file, encoding)
00661         return len(self._tree.getroot())

Here is the call graph for this function:


Member Data Documentation

Definition at line 654 of file PhyloXMLIO.py.

Initial value:
_handle_complex('accession', ('source',),
            (), has_text=True)

Definition at line 712 of file PhyloXMLIO.py.

Definition at line 830 of file PhyloXMLIO.py.

Initial value:
_handle_complex('annotation',
            ('ref', 'source', 'evidence', 'type'),
            ( 'desc',
              'confidence',
              ('property',   'properties'),
              'uri',
              ))

Definition at line 715 of file PhyloXMLIO.py.

Definition at line 848 of file PhyloXMLIO.py.

Definition at line 840 of file PhyloXMLIO.py.

Definition at line 831 of file PhyloXMLIO.py.

Initial value:
_handle_complex('clade', ('id_source',),
            ( 'name',
              'branch_length',
              ('confidence',    'confidences'),
              'width',
              'color',
              'node_id',
              ('taxonomy',      'taxonomies'),
              ('sequence',      'sequences'),
              'events',
              'binary_characters',
              ('distribution',  'distributions'),
              'date',
              ('reference',     'references'),
              ('property',      'properties'),
              ('clade',         'clades'),
              ('other',         'other'),
              ))

Definition at line 693 of file PhyloXMLIO.py.

Initial value:
_handle_complex('clade_relation',
            ('id_ref_0', 'id_ref_1', 'distance', 'type'),
            ('confidence',))

Definition at line 736 of file PhyloXMLIO.py.

Definition at line 849 of file PhyloXMLIO.py.

Definition at line 740 of file PhyloXMLIO.py.

Definition at line 850 of file PhyloXMLIO.py.

Initial value:
_handle_complex('confidence', ('type',),
            (), has_text=True)

Definition at line 742 of file PhyloXMLIO.py.

Initial value:
_handle_complex('date', ('unit',),
            ('desc', 'value', 'minimum', 'maximum'))

Definition at line 745 of file PhyloXMLIO.py.

Definition at line 851 of file PhyloXMLIO.py.

Definition at line 852 of file PhyloXMLIO.py.

Initial value:
_handle_complex('distribution', (),
            ( 'desc',
              ('point',     'points'),
              ('polygon',   'polygons'),
              ))

Definition at line 748 of file PhyloXMLIO.py.

Initial value:
_handle_complex('domain_architecture',
            ('length',),
            (('domain', 'domains'),))

Definition at line 765 of file PhyloXMLIO.py.

Definition at line 841 of file PhyloXMLIO.py.

Initial value:
_handle_complex('events', (),
            ( 'type',
              'duplications',
              'speciations',
              'losses',
              'confidence',
              ))

Definition at line 769 of file PhyloXMLIO.py.

Definition at line 842 of file PhyloXMLIO.py.

tuple Bio.Phylo.PhyloXMLIO.Writer.id = _handle_complex('id', ('provider',), (), has_text=True) [static]

Definition at line 777 of file PhyloXMLIO.py.

Definition at line 832 of file PhyloXMLIO.py.

Definition at line 853 of file PhyloXMLIO.py.

Definition at line 833 of file PhyloXMLIO.py.

Definition at line 843 of file PhyloXMLIO.py.

Definition at line 834 of file PhyloXMLIO.py.

Definition at line 835 of file PhyloXMLIO.py.

Initial value:
_handle_complex('mol_seq', ('is_aligned',),
            (), has_text=True)

Definition at line 779 of file PhyloXMLIO.py.

Definition at line 854 of file PhyloXMLIO.py.

tuple Bio.Phylo.PhyloXMLIO.Writer.node_id = _handle_complex('node_id', ('provider',), (), has_text=True) [static]

Definition at line 782 of file PhyloXMLIO.py.

Initial value:
_handle_complex('phylogeny',
            ('rooted', 'rerootable', 'branch_length_unit', 'type'),
            ( 'name',
              'id',
              'description',
              'date',
              ('confidence',        'confidences'),
              'clade',
              ('clade_relation',    'clade_relations'),
              ('sequence_relation', 'sequence_relations'),
              ('property',          'properties'),
              ('other',             'other'),
              ))

Definition at line 679 of file PhyloXMLIO.py.

Initial value:
_handle_complex('point', ('geodetic_datum', 'alt_unit'),
            ('lat', 'long', 'alt'))

Definition at line 784 of file PhyloXMLIO.py.

tuple Bio.Phylo.PhyloXMLIO.Writer.polygon = _handle_complex('polygon', (), (('point', 'points'),)) [static]

Definition at line 787 of file PhyloXMLIO.py.

Initial value:
_handle_complex('property',
            ('ref', 'unit', 'datatype', 'applies_to', 'id_ref'),
            (), has_text=True)

Definition at line 789 of file PhyloXMLIO.py.

Definition at line 855 of file PhyloXMLIO.py.

Definition at line 844 of file PhyloXMLIO.py.

Definition at line 793 of file PhyloXMLIO.py.

Definition at line 856 of file PhyloXMLIO.py.

Initial value:
_handle_complex('sequence',
            ('type', 'id_ref', 'id_source'),
            ( 'symbol',
              'accession',
              'name',
              'location',
              'mol_seq',
              'uri',
              ('annotation', 'annotations'),
              'domain_architecture',
              ('other',      'other'),
              ))

Definition at line 795 of file PhyloXMLIO.py.

Initial value:
_handle_complex('sequence_relation',
            ('id_ref_0', 'id_ref_1', 'distance', 'type'),
            ('confidence',))

Definition at line 808 of file PhyloXMLIO.py.

Definition at line 845 of file PhyloXMLIO.py.

Definition at line 857 of file PhyloXMLIO.py.

Definition at line 858 of file PhyloXMLIO.py.

Initial value:
_handle_complex('taxonomy',
            ('id_source',),
            ( 'id',
              'code',
              'scientific_name',
              'authority',
              ('common_name',   'common_names'),
              ('synonym',       'synonyms'),
              'rank',
              'uri',
              ('other',         'other'),
              ))

Definition at line 812 of file PhyloXMLIO.py.

Definition at line 859 of file PhyloXMLIO.py.

tuple Bio.Phylo.PhyloXMLIO.Writer.uri = _handle_complex('uri', ('desc', 'type'), (), has_text=True) [static]

Definition at line 825 of file PhyloXMLIO.py.

Definition at line 836 of file PhyloXMLIO.py.

Definition at line 837 of file PhyloXMLIO.py.


The documentation for this class was generated from the following file: