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