Package Bio :: Package Align :: Package Applications :: Module _TCoffee
[hide private]
[frames] | no frames]

Source Code for Module Bio.Align.Applications._TCoffee

  1  # Copyright 2009 by Cymon J. Cox and Brad Chapman. All rights reserved. 
  2  # This code is part of the Biopython distribution and governed by its 
  3  # license.  Please see the LICENSE file that should have been included 
  4  # as part of this package. 
  5  """Command line wrapper for the multiple alignment program TCOFFEE. 
  6  """ 
  7   
  8  __docformat__ = "epytext en"  # Don't just use plain text in epydoc API pages! 
  9   
 10  from Bio.Application import _Option, _Switch, AbstractCommandline 
 11   
 12   
13 -class TCoffeeCommandline(AbstractCommandline):
14 """Commandline object for the TCoffee alignment program. 15 16 http://www.tcoffee.org/Projects_home_page/t_coffee_home_page.html 17 18 The T-Coffee command line tool has a lot of switches and options. 19 This wrapper implements a VERY limited number of options - if you 20 would like to help improve it please get in touch. 21 22 Example: 23 24 To align a FASTA file (unaligned.fasta) with the output in ClustalW 25 format (file aligned.aln), and otherwise default settings, use: 26 27 >>> from Bio.Align.Applications import TCoffeeCommandline 28 >>> tcoffee_cline = TCoffeeCommandline(infile="unaligned.fasta", 29 ... output="clustalw", 30 ... outfile="aligned.aln") 31 >>> print tcoffee_cline 32 t_coffee -output clustalw -infile unaligned.fasta -outfile aligned.aln 33 34 You would typically run the command line with tcoffee_cline() or via 35 the Python subprocess module, as described in the Biopython tutorial. 36 37 Citation: 38 39 T-Coffee: A novel method for multiple sequence alignments. 40 Notredame, Higgins, Heringa, JMB,302(205-217) 2000 41 42 Last checked against: Version_6.92 43 """ 44 SEQ_TYPES = ["dna","protein","dna_protein"] 45
46 - def __init__(self, cmd="t_coffee", **kwargs):
47 self.parameters = [ 48 _Option(["-output", "output"], 49 """Specify the output type. 50 One (or more separated by a comma) of: 51 'clustalw_aln', 'clustalw', 'gcg', 'msf_aln', 52 'pir_aln', 'fasta_aln', 'phylip', 'pir_seq', 'fasta_seq' 53 54 Note that of these Biopython's AlignIO module will only 55 read clustalw, pir, and fasta. 56 """, # TODO - Can we read the PHYLIP output? 57 equate=False), 58 _Option(["-infile", "infile"], 59 "Specify the input file.", 60 filename=True, 61 is_required=True, 62 equate=False), 63 #Indicates the name of the alignment output by t_coffee. If the 64 #default is used, the alignment is named <your sequences>.aln 65 _Option(["-outfile", "outfile"], 66 "Specify the output file. Default: <your sequences>.aln", 67 filename=True, 68 equate=False), 69 _Switch(["-convert", "convert"], 70 "Specify you want to perform a file conversion"), 71 _Option(["-type", "type"], 72 "Specify the type of sequence being aligned", 73 checker_function=lambda x: x in self.SEQ_TYPES, 74 equate=False), 75 _Option(["-outorder", "outorder"], 76 "Specify the order of sequence to output" 77 "Either 'input', 'aligned' or <filename> of " 78 "Fasta file with sequence order", 79 equate=False), 80 _Option(["-matrix", "matrix"], 81 "Specify the filename of the substitution matrix to use." 82 "Default: blosum62mt", 83 equate=False), 84 _Option(["-gapopen", "gapopen"], 85 "Indicates the penalty applied for opening a gap " 86 "(negative integer)", 87 checker_function=lambda x: isinstance(x, int), 88 equate=False), 89 _Option(["-gapext", "gapext"], 90 "Indicates the penalty applied for extending a " 91 "gap. (negative integer)", 92 checker_function=lambda x: isinstance(x, int), 93 equate=False), 94 _Switch(["-quiet", "quiet"], 95 "Turn off log output"), 96 _Option(["-mode", "mode"], 97 "Specifies a special mode: genome, quickaln, dali, 3dcoffee", 98 equate=False), 99 ] 100 AbstractCommandline.__init__(self, cmd, **kwargs)
101 102
103 -def _test():
104 """Run the module's doctests (PRIVATE).""" 105 print "Running modules doctests..." 106 import doctest 107 doctest.testmod() 108 print "Done"
109 110 if __name__ == "__main__": 111 _test() 112