o
    RŀgM                     @   sf   d Z ddlmZ ddlmZ ddlmZ ddlmZ G dd deZedkr1dd	lm	Z	 e	  d
S d
S )z@Command line wrapper for the multiple alignment programme MAFFT.    )	_Argument)_Option)_Switch)AbstractCommandlinec                   @   s   e Zd ZdZdddZdS )MafftCommandlinea
  Command line wrapper for the multiple alignment program MAFFT.

    http://align.bmr.kyushu-u.ac.jp/mafft/software/

    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")

    mafftc                    sH  g d g t ddgdt g ddt ddgd	t d
dgdt ddgdt ddgdtddgddd ddtddgddd ddtddgd d!d ddtd"d#gd$d%d ddt d&d'gd(t d)d*gd+t d,d-gd.t d/d0gd1t d2d3gd4t d5d6gd7t d8d9gd:td;d<gd=d>d ddt d?d@gdAt dBdCgdDt dEdFgdGtdHdIgdJdKd ddtdLdMgdNdOd ddtdPdQgdRdSd ddtdTdUgdVdWd ddtdXdYgdZd[d ddtd\d]gd^d_d ddtd`dagdbdcd ddtdddegdf fdgdddtdhdigdjddktdldmgdndoddptdqdrgdsdoddpt dtdugdvtdwdxgdydzd ddt d{d|gd}t d~dgdt ddgdt ddgdt ddgdt ddgdt ddgdt ddgdtddgddoddptdgddododtdgddod| _tj| |fi | dS )zInitialize the class.)30456280z--autoautoz+Automatically select strategy. Default off.)z
--6merpair6merpair
sixmerpairzGDistance is calculated based on the number of shared 6mers. Default: onz--globalpair
globalpairzVAll pairwise alignments are computed with the Needleman-Wunsch algorithm. Default: offz--localpair	localpairzTAll pairwise alignments are computed with the Smith-Waterman algorithm. Default: offz--genafpair	genafpairz~All pairwise alignments are computed with a local algorithm with the generalized affine gap cost (Altschul 1998). Default: offz--fastapair	fastapairzWAll pairwise alignments are computed with FASTA (Pearson and Lipman 1988). Default: offz	--weightiweightiz[Weighting factor for the consistency term calculated from pairwise alignments. Default: 2.7c                 S   
   t | tS N
isinstancefloatx r   Q/var/www/html/myenv/lib/python3.10/site-packages/Bio/Align/Applications/_Mafft.py<lambda>      
 z+MafftCommandline.__init__.<locals>.<lambda>F)checker_functionequatez--retreeretreez_Guide tree is built number times in the progressive stage. Valid with 6mer distance. Default: 2c                 S   r   r   r   intr   r   r   r   r      r   z--maxiterate
maxiteratez?Number cycles of iterative refinement are performed. Default: 0c                 S   r   r   r"   r   r   r   r   r      r   z--threadthreadz$Number of threads to use. Default: 1c                 S   r   r   r"   r   r   r   r   r      r   z--fftfftz>Use FFT approximation in group-to-group alignment. Default: onz--nofftnofftzFDo not use FFT approximation in group-to-group alignment. Default: offz	--noscorenoscorezaAlignment score is not checked in the iterative refinement stage. Default: off (score is checked)z	--memsavememsavezyUse the Myers-Miller (1988) algorithm. Default: automatically turned on when the alignment length exceeds 10,000 (aa/nt).z
--parttreeparttreezDUse a fast tree-building method with the 6mer distance. Default: offz--dpparttree
dpparttreezGThe PartTree algorithm is used with distances based on DP. Default: offz--fastaparttreefastaparttreezJThe PartTree algorithm is used with distances based on FASTA. Default: offz
--partsizepartsizez?The number of partitions in the PartTree algorithm. Default: 50c                 S   r   r   r"   r   r   r   r   r      r   z--groupsize	groupsizezZDo not make alignment larger than number sequences. Default: the number of input sequencesz--adjustdirectionadjustdirectionz>Adjust direction according to the first sequence. Default off.z--adjustdirectionaccuratelyadjustdirectionaccuratelyz`Adjust direction according to the first sequence,for highly diverged data; very slowDefault off.z--opopz>Gap opening penalty at group-to-group alignment. Default: 1.53c                 S   r   r   r   r   r   r   r   r     r   z--epepzcOffset value, which works like gap extension penalty, for group-to- group alignment. Default: 0.123c                 S   r   r   r   r   r   r   r   r   
  r   z--loplopz?Gap opening penalty at local pairwise alignment. Default: 0.123c                 S   r   r   r   r   r   r   r   r     r   z--leplepz6Offset value at local pairwise alignment. Default: 0.1c                 S   r   r   r   r   r   r   r   r     r   z--lexplexpz@Gap extension penalty at local pairwise alignment. Default: -0.1c                 S   r   r   r   r   r   r   r   r   "  r   z--LOPLOPz9Gap opening penalty to skip the alignment. Default: -6.00c                 S   r   r   r   r   r   r   r   r   *  r   z--LEXPLEXPz:Gap extension penalty to skip the alignment. Default: 0.00c                 S   r   r   r   r   r   r   r   r   2  r   z--blblz)BLOSUM number matrix is used. Default: 62c                    s   |  v S r   r   r   BLOSUM_MATRICESr   r   r   :  s    z--jttjttzNJTT PAM number (Jones et al. 1992) matrix is used. number>0. Default: BLOSUM62)r    z--tmtmzXTransmembrane PAM number (Jones et al. 1994) matrix is used. number>0. Default: BLOSUM62T)filenamer    z
--aamatrixaamatrixz7Use a user-defined AA scoring matrix. Default: BLOSUM62z--fmodelfmodelzeIncorporate the AA/nuc composition information into the scoring matrix (True) or not (False, default)z--namelength
namelengthaW  Name length in CLUSTAL and PHYLIP output.

                    MAFFT v6.847 (2011) added --namelength for use with
                    the --clustalout option for CLUSTAL output.

                    MAFFT v7.024 (2013) added support for this with the
                    --phylipout option for PHYLIP output (default 10).
                    c                 S   r   r   r"   r   r   r   r   r   j  r   z--clustalout
clustaloutz7Output format: clustal (True) or fasta (False, default)z--phylipout	phylipoutz7Output format: phylip (True), or fasta (False, default)z--inputorder
inputorderzFOutput order: same as input (True, default) or alignment based (False)z	--reorderreorderz?Output order: aligned (True) or in input order (False, default)z	--treeouttreeoutzJGuide tree is output to the input.tree file (True) or not (False, default)z--quietquietz6Do not report progress (True) or not (False, default).z--nucnucz?Assume the sequences are nucleotide (True/False). Default: autoz--aminoaminoz?Assume the sequences are amino acid (True/False). Default: autoz--seedseedzXSeed alignments given in alignment_n (fasta format) are aligned with sequences in input.inputzInput file name)r=   is_requiredinput1z4Second input file name for the mafft-profile command)r=   N)r   r   r   
parametersr   __init__)selfcmdkwargsr   r9   r   rN   U   s  %-5>FMTZahqy   	        '  /  8  @  H  P  X  `
  h  p  z       
            #    )    .    4    :    ?    H    P    S    YzMafftCommandline.__init__N)r   )__name__
__module____qualname____doc__rN   r   r   r   r   r      s    Er   __main__)run_doctestN)
rU   Bio.Applicationr   r   r   r   r   rR   
Bio._utilsrW   r   r   r   r   <module>   s      &
