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