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