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