
z.Ic           @   sx   d  Z  d d l Z d d l m Z d d l m Z d d l m Z d d l m Z d d  Z	 d	 e f d
     YZ
 d S(   s  
Code to deal with alignments written in Fasta format (OBSOLETE).

This module is considered obsolete and likely to be deprecated.  Please use
Bio.AlignIO instead for reading and writing alignments in FASTA format.

This mostly just uses the regular Fasta parsing stuff written by Jeff
to deal with all of the input and output formats.

functions:
o parse_file()

classes:
FastaAlignmentiN(   t	   Alignment(   t   Alphabet(   t   IUPAC(   t   Fastat   DNAc         C   s   | j    d k r t j } nL | j    d k r< t j } n. | j    d k rZ t j } n t d |   t t j |   } t	 |  d  } t
 j   } t
 j | |  } | j   } x, | r | j | j | j  | j   } q W| S(   s   Parse the given file into a FastaAlignment object.

    Arguments:
    o file_name - The location of the file to parse.
    o type - The type of information contained in the file.
    R   t   RNAt   PROTEINs0   Invalid type %s passed. Need DNA, RNA or PROTEINt   r(   t   upperR   t   ambiguous_dnat   ambiguous_rnat   proteint
   ValueErrort   FastaAlignmentR   t   Gappedt   openR   t   RecordParsert   Iteratort   nextt   add_sequencet   titlet   sequence(   t	   file_namet   typet   alphabett   fasta_alignt
   align_filet   parsert   iteratort	   cur_align(    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Fasta/FastaAlign.pyt
   parse_file   s"    
	R   c           B   s/   e  Z d  Z e j e j  d  Z d   Z RS(   s   Work with the Fasta Alignment format.

    The fasta alignment format is basically the same as the regular ol'
    Fasta format we know and love, except the sequences have gaps
    (represented by -'s).
    c         C   s   t  j |  |  d  S(   N(   R    t   __init__(   t   selfR   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Fasta/FastaAlign.pyR   A   s    c         C   sp   d } xV |  j  D]K } t j   } | j | _ | j j | _ | t |  t	 j
 t	 j
 } q W| j   t	 j
 S(   s0   Print out a fasta version of the alignment info.t    (   t   _recordsR   t   Recordt   descriptionR   t   seqt   dataR   t   strt   ost   linesept   rstrip(   R    t   return_stringt   itemt   new_f_record(    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Fasta/FastaAlign.pyt   __str__D   s    "(	   t   __name__t
   __module__t   __doc__R   R   R   R	   R   R.   (    (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Fasta/FastaAlign.pyR   :   s   (   R1   R(   t   Bio.Align.GenericR    t   BioR   t   Bio.AlphabetR   R   R   R   (    (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/Fasta/FastaAlign.pyt   <module>   s   "