Package Bio :: Package Nexus :: Module Nexus
[show private | hide private]
[frames | no frames]

Module Bio.Nexus.Nexus

Nexus class. Parse the contents of a nexus file. Based upon 'NEXUS: An extensible file format for systematic information' Maddison, Swofford, Maddison. 1997. Syst. Biol. 46(4):590-621
Classes
Block Represent a NEXUS block with block name and list of commandlines .
CharBuffer Helps reading NEXUS-words and characters from a buffer.
Commandline Represent a commandline as command and options.
Nexus  
StepMatrix Calculate a stepmatrix for weighted parsimony.

Exceptions
NexusError  

Function Summary
  combine(matrices)
Combine matrices in [(name,nexus-instance),...] and return new nexus instance.
  get_start_end(sequence, skiplist)
Return position of first and last character which is not in skiplist (defaults to ['-','?']).
  quotestrip(word)
Remove quotes and/or double quotes around identifiers.
  safename(name, mrbayes)
Return a taxon identifier according to NEXUS standard.

Variable Summary
str CHARSET = 'chars'
int INTERLEAVE = 70                                                                    
list KNOWN_NEXUS_BLOCKS = ['trees', 'data', 'characters', 'ta...
str PUNCTUATION = '()[]{}/\\,;:=*\'"`+-<>'
list SPECIAL_COMMANDS = ['charstatelabels', 'charlabels', 'ta...
list SPECIALCOMMENTS = ['!', '&', '%', '/', '\\', '@']
str TAXSET = 'taxa'
str WHITESPACE = ' \t\n'

Function Details

combine(matrices)

Combine matrices in [(name,nexus-instance),...] and return new nexus instance.

combined_matrix=combine([(name1,nexus_instance1),(name2,nexus_instance2),...] Character sets, character partitions and taxon sets are prefixed, readjusted and present in the combined matrix. Matrices must have the same datatype.

get_start_end(sequence, skiplist=['-', '?'])

Return position of first and last character which is not in skiplist (defaults to ['-','?']).

quotestrip(word)

Remove quotes and/or double quotes around identifiers.

safename(name, mrbayes=False)

Return a taxon identifier according to NEXUS standard. Wrap quotes around names with punctuation or whitespace, and double single quotes. mrbayes=True: write names without quotes, whitespace or punctuation for mrbayes.

Variable Details

CHARSET

Type:
str
Value:
'chars'                                                                

INTERLEAVE

Type:
int
Value:
70                                                                    

KNOWN_NEXUS_BLOCKS

Type:
list
Value:
['trees', 'data', 'characters', 'taxa', 'sets']                        

PUNCTUATION

Type:
str
Value:
'()[]{}/\\,;:=*\'"`+-<>'                                               

SPECIAL_COMMANDS

Type:
list
Value:
['charstatelabels',
 'charlabels',
 'taxlabels',
 'taxset',
 'charset',
 'charpartition',
 'taxpartition',
 'matrix',
...                                                                    

SPECIALCOMMENTS

Type:
list
Value:
['!', '&', '%', '/', '\\', '@']                                        

TAXSET

Type:
str
Value:
'taxa'                                                                 

WHITESPACE

Type:
str
Value:
''' \t
'''                                                                    

Generated by Epydoc 2.1 on Thu Jun 30 22:06:11 2005 http://epydoc.sf.net