1
2
3
4
5 """Command line wrapper for the multiple alignment program PROBCONS.
6 """
7
8 __docformat__ = "epytext en"
9
10 from Bio.Application import _Option, _Switch, _Argument, AbstractCommandline
11
12
14 """Command line wrapper for the multiple alignment program PROBCONS.
15
16 http://probcons.stanford.edu/
17
18 Example:
19
20 To align a FASTA file (unaligned.fasta) with the output in ClustalW
21 format, and otherwise default settings, use:
22
23 >>> from Bio.Align.Applications import ProbconsCommandline
24 >>> probcons_cline = ProbconsCommandline(input="unaligned.fasta",
25 ... clustalw=True)
26 >>> print probcons_cline
27 probcons -clustalw unaligned.fasta
28
29 You would typically run the command line with probcons_cline() or via
30 the Python subprocess module, as described in the Biopython tutorial.
31 Note that PROBCONS will write the alignment to stdout, which you may
32 want to save to a file and then parse, e.g.::
33
34 stdout, stderr = probcons_cline()
35 handle = open("aligned.aln", "w")
36 handle.write(stdout)
37 handle.close()
38 from Bio import AlignIO
39 align = AlignIO.read("aligned.fasta", "clustalw")
40
41 Alternatively, to parse the output with AlignIO directly you can
42 use StringIO to turn the string into a handle::
43
44 stdout, stderr = probcons_cline()
45 from StringIO import StringIO
46 from Bio import AlignIO
47 align = AlignIO.read(StringIO(stdout), "clustalw")
48
49 Citations:
50
51 Do, C.B., Mahabhashyam, M.S.P., Brudno, M., and Batzoglou, S. 2005.
52 PROBCONS: Probabilistic Consistency-based Multiple Sequence Alignment.
53 Genome Research 15: 330-340.
54
55 Last checked against version: 1.12
56 """
57 - def __init__(self, cmd="probcons", **kwargs):
58 self.parameters = \
59 [
60
61
62
63
64
65 _Switch(["-clustalw", "clustalw"],
66 "Use CLUSTALW output format instead of MFA"),
67 _Option(["-c", "c", "--consistency", "consistency" ],
68 "Use 0 <= REPS <= 5 (default: 2) passes of consistency transformation",
69 checker_function=lambda x: x in range(0,6),
70 equate=False),
71 _Option(["-ir", "--iterative-refinement", "iterative-refinement", "ir"],
72 "Use 0 <= REPS <= 1000 (default: 100) passes of "
73 "iterative-refinement",
74 checker_function=lambda x: x in range(0,1001),
75 equate=False),
76 _Option(["-pre", "--pre-training", "pre-training", "pre"],
77 "Use 0 <= REPS <= 20 (default: 0) rounds of pretraining",
78 checker_function=lambda x: x in range(0,21),
79 equate=False),
80 _Switch(["-pairs", "pairs"],
81 "Generate all-pairs pairwise alignments"),
82 _Switch(["-viterbi", "viterbi"],
83 "Use Viterbi algorithm to generate all pairs "
84 "(automatically enables -pairs)"),
85 _Switch(["-verbose", "verbose"],
86 "Report progress while aligning (default: off)"),
87 _Option(["-annot", "annot"],
88 "Write annotation for multiple alignment to FILENAME",
89 equate=False),
90 _Option(["-t", "t", "--train", "train"],
91 "Compute EM transition probabilities, store in FILENAME "
92 "(default: no training)",
93 equate=False),
94 _Switch(["-e", "e", "--emissions", "emissions"],
95 "Also reestimate emission probabilities (default: off)"),
96 _Option(["-p", "p", "--paramfile", "paramfile"],
97 "Read parameters from FILENAME",
98 equate=False),
99 _Switch(["-a", "--alignment-order", "alignment-order", "a"],
100 "Print sequences in alignment order rather than input "
101 "order (default: off)"),
102
103 _Argument(["input"],
104 "Input file name. Must be multiple FASTA alignment "+
105 "(MFA) format",
106 filename=True,
107 is_required=True),
108 ]
109 AbstractCommandline.__init__(self, cmd, **kwargs)
110
111
113 """Run the module's doctests (PRIVATE)."""
114 print "Running modules doctests..."
115 import doctest
116 doctest.testmod()
117 print "Done"
118
119 if __name__ == "__main__":
120 _test()
121