Package Bio :: Package Align :: Package Applications :: Module _Prank
[hide private]
[frames] | no frames]

Source Code for Module Bio.Align.Applications._Prank

  1  # Copyright 2009 by Cymon J. Cox.  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 PRANK. 
  6  """ 
  7   
  8  from __future__ import print_function 
  9   
 10   
 11  from Bio.Application import _Option, _Switch, AbstractCommandline 
 12   
 13   
14 -class PrankCommandline(AbstractCommandline):
15 """Command line wrapper for the multiple alignment program PRANK. 16 17 http://www.ebi.ac.uk/goldman-srv/prank/prank/ 18 19 Example: 20 -------- 21 22 To align a FASTA file (unaligned.fasta) with the output in aligned 23 FASTA format with the output filename starting with "aligned" (you 24 can't pick the filename explicitly), no tree output and no XML output, 25 use: 26 27 >>> from Bio.Align.Applications import PrankCommandline 28 >>> prank_cline = PrankCommandline(d="unaligned.fasta", 29 ... o="aligned", # prefix only! 30 ... f=8, # FASTA output 31 ... notree=True, noxml=True) 32 >>> print(prank_cline) 33 prank -d=unaligned.fasta -o=aligned -f=8 -noxml -notree 34 35 You would typically run the command line with prank_cline() or via 36 the Python subprocess module, as described in the Biopython tutorial. 37 38 Citations: 39 ---------- 40 41 Loytynoja, A. and Goldman, N. 2005. An algorithm for progressive 42 multiple alignment of sequences with insertions. Proceedings of 43 the National Academy of Sciences, 102: 10557--10562. 44 45 Loytynoja, A. and Goldman, N. 2008. Phylogeny-aware gap placement 46 prevents errors in sequence alignment and evolutionary analysis. 47 Science, 320: 1632. 48 49 Last checked against version: 081202 50 """
51 - def __init__(self, cmd="prank", **kwargs):
52 OUTPUT_FORMAT_VALUES = list(range(1, 18)) 53 self.parameters = [ 54 # ################# input/output parameters: ################## 55 # -d=sequence_file 56 _Option(["-d", "d"], 57 "Input filename", 58 filename=True, 59 is_required=True), 60 # -t=tree_file [default: no tree, generate approximate NJ tree] 61 _Option(["-t", "t"], "Input guide tree filename", 62 filename=True), 63 # -tree="tree_string" [tree in newick format; in double quotes] 64 _Option(["-tree", "tree"], 65 "Input guide tree as Newick string"), 66 # -m=model_file [default: HKY2/WAG] 67 _Option(["-m", "m"], 68 "User-defined alignment model filename. Default: " 69 "HKY2/WAG"), 70 # -o=output_file [default: 'output'] 71 _Option(["-o", "o"], 72 "Output filenames prefix. Default: 'output'\n " 73 "Will write: output.?.fas (depending on requested " 74 "format), output.?.xml and output.?.dnd", 75 filename=True), 76 # -f=output_format [default: 8] 77 _Option(["-f", "f"], 78 "Output alignment format. Default: 8 FASTA\n" 79 "Option are:\n" 80 "1. IG/Stanford 8. Pearson/Fasta\n" 81 "2. GenBank/GB 11. Phylip3.2\n" 82 "3. NBRF 12. Phylip\n" 83 "4. EMBL 14. PIR/CODATA\n" 84 "6. DNAStrider 15. MSF\n" 85 "7. Fitch 17. PAUP/NEXUS", 86 checker_function=lambda x: x in OUTPUT_FORMAT_VALUES), 87 _Switch(["-noxml", "noxml"], 88 "Do not output XML files " 89 "(PRANK versions earlier than v.120626)"), 90 _Switch(["-notree", "notree"], 91 "Do not output dnd tree files " 92 "(PRANK versions earlier than v.120626)"), 93 _Switch(["-showxml", "showxml"], 94 "Output XML files (PRANK v.120626 and later)"), 95 _Switch(["-showtree", "showtree"], 96 "Output dnd tree files (PRANK v.120626 and later)"), 97 _Switch(["-shortnames", "shortnames"], 98 "Truncate names at first space"), 99 _Switch(["-quiet", "quiet"], 100 "Reduce verbosity"), 101 # ###################### model parameters: ###################### 102 # +F [force insertions to be always skipped] 103 # -F [equivalent] 104 _Switch(["-F", "+F", "F"], 105 "Force insertions to be always skipped: same as +F"), 106 # -dots [show insertion gaps as dots] 107 _Switch(["-dots", "dots"], 108 "Show insertion gaps as dots"), 109 # -gaprate=# [gap opening rate; default: dna 0.025 / prot 0.0025] 110 _Option(["-gaprate", "gaprate"], 111 "Gap opening rate. Default: dna 0.025 prot 0.0025", 112 checker_function=lambda x: isinstance(x, float)), 113 # -gapext=# [gap extension probability; default: dna 0.5 / prot 0.5] 114 _Option(["-gapext", "gapext"], 115 "Gap extension probability. Default: dna 0.5 " 116 "/ prot 0.5", 117 checker_function=lambda x: isinstance(x, float)), 118 # -dnafreqs=#,#,#,# [ACGT; default: empirical] 119 _Option(["-dnafreqs", "dnafreqs"], 120 "DNA frequencies - 'A,C,G,T'. eg '25,25,25,25' as a quote " 121 "surrounded string value. Default: empirical", 122 checker_function=lambda x: isinstance(x, bytes)), 123 # -kappa=# [ts/tv rate ratio; default:2] 124 _Option(["-kappa", "kappa"], 125 "Transition/transversion ratio. Default: 2", 126 checker_function=lambda x: isinstance(x, int)), 127 # -rho=# [pur/pyr rate ratio; default:1] 128 _Option(["-rho", "rho"], 129 "Purine/pyrimidine ratio. Default: 1", 130 checker_function=lambda x: isinstance(x, int)), 131 # -codon [for DNA: use empirical codon model] 132 # Assuming this is an input file as in -m 133 _Option(["-codon", "codon"], 134 "Codon model filename. Default: empirical codon model"), 135 # -termgap [penalise terminal gaps normally] 136 _Switch(["-termgap", "termgap"], 137 "Penalise terminal gaps normally"), 138 # ############### other parameters: ################################ 139 # -nopost [do not compute posterior support; default: compute] 140 _Switch(["-nopost", "nopost"], 141 "Do not compute posterior support. Default: compute"), 142 # -pwdist=# [expected pairwise distance for computing guidetree; 143 # default: dna 0.25 / prot 0.5] 144 _Option(["-pwdist", "pwdist"], 145 "Expected pairwise distance for computing guidetree. " 146 "Default: dna 0.25 / prot 0.5", 147 checker_function=lambda x: isinstance(x, float)), 148 _Switch(["-once", "once"], 149 "Run only once. Default: twice if no guidetree given"), 150 _Switch(["-twice", "twice"], 151 "Always run twice"), 152 _Switch(["-skipins", "skipins"], 153 "Skip insertions in posterior support"), 154 _Switch(["-uselogs", "uselogs"], 155 "Slower but should work for a greater number of sequences"), 156 _Switch(["-writeanc", "writeanc"], 157 "Output ancestral sequences"), 158 _Switch(["-printnodes", "printnodes"], 159 "Output each node; mostly for debugging"), 160 # -matresize=# [matrix resizing multiplier] 161 # Doesn't specify type but Float and Int work 162 _Option(["-matresize", "matresize"], 163 "Matrix resizing multiplier", 164 checker_function=lambda x: isinstance(x, float) or 165 isinstance(x, int)), 166 # -matinitsize=# [matrix initial size multiplier] 167 # Doesn't specify type but Float and Int work 168 _Option(["-matinitsize", "matinitsize"], 169 "Matrix initial size multiplier", 170 checker_function=lambda x: isinstance(x, float) or 171 isinstance(x, int)), 172 _Switch(["-longseq", "longseq"], 173 "Save space in pairwise alignments"), 174 _Switch(["-pwgenomic", "pwgenomic"], 175 "Do pairwise alignment, no guidetree"), 176 # -pwgenomicdist=# [distance for pairwise alignment; default: 0.3] 177 _Option(["-pwgenomicdist", "pwgenomicdist"], 178 "Distance for pairwise alignment. Default: 0.3", 179 checker_function=lambda x: isinstance(x, float)), 180 # -scalebranches=# [scale branch lengths; default: dna 1 / prot 2] 181 _Option(["-scalebranches", "scalebranches"], 182 "Scale branch lengths. Default: dna 1 / prot 2", 183 checker_function=lambda x: isinstance(x, int)), 184 # -fixedbranches=# [use fixed branch lengths] 185 # Assume looking for a float 186 _Option(["-fixedbranches", "fixedbranches"], 187 "Use fixed branch lengths of input value", 188 checker_function=lambda x: isinstance(x, float)), 189 # -maxbranches=# [set maximum branch length] 190 # Assume looking for a float 191 _Option(["-maxbranches", "maxbranches"], 192 "Use maximum branch lengths of input value", 193 checker_function=lambda x: isinstance(x, float)), 194 # -realbranches [disable branch length truncation] 195 _Switch(["-realbranches", "realbranches"], 196 "Disable branch length truncation"), 197 _Switch(["-translate", "translate"], 198 "Translate to protein"), 199 _Switch(["-mttranslate", "mttranslate"], 200 "Translate to protein using mt table"), 201 # ##################### other: #################### 202 _Switch(["-convert", "convert"], 203 "Convert input alignment to new format. Do " 204 "not perform alignment") 205 ] 206 AbstractCommandline.__init__(self, cmd, **kwargs)
207 208 209 if __name__ == "__main__": 210 from Bio._utils import run_doctest 211 run_doctest() 212