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 SEQ_TYPES = ["dna", "protein", "dna_protein"] 46
47 - def __init__(self, cmd="t_coffee", **kwargs):
48 self.parameters = [ 49 _Option(["-output", "output"], 50 """Specify the output type. 51 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 gap " 93 "(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 if __name__ == "__main__": 106 from Bio._utils import run_doctest 107 run_doctest() 108