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 Example: 22 -------- 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 40 T-Coffee: A novel method for multiple sequence alignments. 41 Notredame, Higgins, Heringa, JMB,302(205-217) 2000 42 43 Last checked against: Version_6.92 44 """ 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 53 One (or more separated by a comma) of: 54 'clustalw_aln', 'clustalw', 'gcg', 'msf_aln', 55 'pir_aln', 'fasta_aln', 'phylip', 'pir_seq', 'fasta_seq' 56 57 Note that of these Biopython's AlignIO module will only 58 read clustalw, pir, and fasta. 59 """, # TODO - Can we read the PHYLIP output? 60 equate=False), 61 _Option(["-infile", "infile"], 62 "Specify the input file.", 63 filename=True, 64 is_required=True, 65 equate=False), 66 # Indicates the name of the alignment output by t_coffee. If the 67 # default is used, the alignment is named <your sequences>.aln 68 _Option(["-outfile", "outfile"], 69 "Specify the output file. Default: <your sequences>.aln", 70 filename=True, 71 equate=False), 72 _Switch(["-convert", "convert"], 73 "Specify you want to perform a file conversion"), 74 _Option(["-type", "type"], 75 "Specify the type of sequence being aligned", 76 checker_function=lambda x: x in self.SEQ_TYPES, 77 equate=False), 78 _Option(["-outorder", "outorder"], 79 "Specify the order of sequence to output" 80 "Either 'input', 'aligned' or <filename> of " 81 "Fasta file with sequence order", 82 equate=False), 83 _Option(["-matrix", "matrix"], 84 "Specify the filename of the substitution matrix to use." 85 "Default: blosum62mt", 86 equate=False), 87 _Option(["-gapopen", "gapopen"], 88 "Indicates the penalty applied for opening a gap " 89 "(negative integer)", 90 checker_function=lambda x: isinstance(x, int), 91 equate=False), 92 _Option(["-gapext", "gapext"], 93 "Indicates the penalty applied for extending a gap " 94 "(negative integer)", 95 checker_function=lambda x: isinstance(x, int), 96 equate=False), 97 _Switch(["-quiet", "quiet"], 98 "Turn off log output"), 99 _Option(["-mode", "mode"], 100 "Specifies a special mode: genome, quickaln, dali, 3dcoffee", 101 equate=False), 102 ] 103 AbstractCommandline.__init__(self, cmd, **kwargs)
104 105 106 if __name__ == "__main__": 107 from Bio._utils import run_doctest 108 run_doctest() 109