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