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