minorg.mafftcommandline_add module
Command line wrapper for the multiple alignment programme MAFFT, modified to include --add
option.
- class minorg.mafftcommandline_add.MafftCommandline(cmd='mafft', **kwargs)[source]
Bases:
Bio.Application.AbstractCommandline
Command line wrapper for the multiple alignment program MAFFT. http://align.bmr.kyushu-u.ac.jp/mafft/software/ .. rubric:: Notes
Last checked against version: MAFFT v6.717b (2009/12/03)
References
Katoh, Toh (BMC Bioinformatics 9:212, 2008) Improved accuracy of multiple ncRNA alignment by incorporating structural information into a MAFFT-based framework (describes RNA structural alignment methods) Katoh, Toh (Briefings in Bioinformatics 9:286-298, 2008) Recent developments in the MAFFT multiple sequence alignment program (outlines version 6) Katoh, Toh (Bioinformatics 23:372-374, 2007) Errata PartTree: an algorithm to build an approximate tree from a large number of unaligned sequences (describes the PartTree algorithm) Katoh, Kuma, Toh, Miyata (Nucleic Acids Res. 33:511-518, 2005) MAFFT version 5: improvement in accuracy of multiple sequence alignment (describes [ancestral versions of] the G-INS-i, L-INS-i and E-INS-i strategies) Katoh, Misawa, Kuma, Miyata (Nucleic Acids Res. 30:3059-3066, 2002)
Examples
>>> from Bio.Align.Applications import MafftCommandline >>> mafft_exe = "/opt/local/mafft" >>> in_file = "../Doc/examples/opuntia.fasta" >>> mafft_cline = MafftCommandline(mafft_exe, input=in_file) >>> print(mafft_cline) /opt/local/mafft ../Doc/examples/opuntia.fasta If the mafft binary is on the path (typically the case on a Unix style operating system) then you don't need to supply the executable location: >>> from Bio.Align.Applications import MafftCommandline >>> in_file = "../Doc/examples/opuntia.fasta" >>> mafft_cline = MafftCommandline(input=in_file) >>> print(mafft_cline) mafft ../Doc/examples/opuntia.fasta You would typically run the command line with mafft_cline() or via the Python subprocess module, as described in the Biopython tutorial. Note that MAFFT will write the alignment to stdout, which you may want to save to a file and then parse, e.g.:: stdout, stderr = mafft_cline() with open("aligned.fasta", "w") as handle: handle.write(stdout) from Bio import AlignIO align = AlignIO.read("aligned.fasta", "fasta") Alternatively, to parse the output with AlignIO directly you can use StringIO to turn the string into a handle:: stdout, stderr = mafft_cline() from io import StringIO from Bio import AlignIO align = AlignIO.read(StringIO(stdout), "fasta")