σ
X_Sc           @@  s   d  d l  m Z d  d l Z d  d l Td  d l Td  d l Td  d l m Z d  d l Td d l	 m
 Z
 d e j f d     YZ e d	 k r e j   n  d S(
   i    (   t   absolute_importN(   t   *(   t   StringIOi   (   t   test_genbank_iot   test_seq_ioc           B@  sb   e  Z d    Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z RS(
   c         C@  sA   t  j } x | D] } | j d q Wt  j   } t  j   } d  S(   Ni    (   t   seq_iot   formatst   namest   format_namest   format_extensions(   t   selft   ft   it   nt   e(    (    sL   /Users/gec/Work/Projects/corebioproj/weblogo-3.4/test_corebio/test_seq_io.pyt	   test_attr*   s
    	 c         C@  so   t  d   } t j |  } Wd  QX|  j t |  d  |  j | d j d  |  j t | d  d  d  S(   Ns   clustal.alni   i   t
   CATH_HUMANi  (   t   testdata_streamR   t   readt   assertEqualt   lent   name(   R
   R   t   seqs(    (    sL   /Users/gec/Work/Projects/corebioproj/weblogo-3.4/test_corebio/test_seq_io.pyt   test_parse_clustal2   s
    c      	   C@  s2   t  d    } |  j t t j | t  Wd QXd S(   s-    Wrong alphabet should throw a parsing error s   clustal.alnN(   R   t   assertRaisest
   ValueErrorR   R   t   nucleic_alphabet(   R
   R   (    (    sL   /Users/gec/Work/Projects/corebioproj/weblogo-3.4/test_corebio/test_seq_io.pyt   test_parse_error:   s    	c         C@  s+   t  d   } t j | t  } Wd  QXd  S(   Ns   clustal181.aln(   R   R   R   t   protein_alphabet(   R
   R   R   (    (    sL   /Users/gec/Work/Projects/corebioproj/weblogo-3.4/test_corebio/test_seq_io.pyt   test_parse_clustal181@   s    c         C@  s+   t  d   } t j | t  } Wd  QXd  S(   Ns   clustal_glualign.aln(   R   R   R   R   (   R
   R   R   (    (    sL   /Users/gec/Work/Projects/corebioproj/weblogo-3.4/test_corebio/test_seq_io.pyt   test_parse_clustal_glualignD   s    c         C@  s+   t  d   } t j | t  } Wd  QXd  S(   Ns   clustalw182.aln(   R   R   R   R   (   R
   R   R   (    (    sL   /Users/gec/Work/Projects/corebioproj/weblogo-3.4/test_corebio/test_seq_io.pyt   test_parse_clustalw182H   s    c         C@  si   t  t j  } t j |  } |  j t |  d  |  j | d j d   |  j t | d  d  d  S(   Ni   i    i   i<   (	   R   t   array_iot   exampleR   R   R   R   R   t   None(   R
   R   R   (    (    sL   /Users/gec/Work/Projects/corebioproj/weblogo-3.4/test_corebio/test_seq_io.pyt   test_read_example_arrayL   s
    c         C@  si   t  t j  } t j |  } |  j t |  d  |  j | d j d  |  j t | d  d  d  S(   Ni   i    s   Lamprey GLOBIN V - SEA LAMPREYi   iη   (   R   t   fasta_ioR!   R   R   R   R   t   description(   R
   R   R   (    (    sL   /Users/gec/Work/Projects/corebioproj/weblogo-3.4/test_corebio/test_seq_io.pyt   test_read_fastaT   s
    c         C@  s>   t  d   } t j |  } Wd  QX|  j t |  d  d  S(   Ns	   globin.fai8   (   R   R   R   R   R   (   R
   R   R   (    (    sL   /Users/gec/Work/Projects/corebioproj/weblogo-3.4/test_corebio/test_seq_io.pyt   test_parse_globin_fasta\   s    c         C@  sΙ  t  t j  t d  f } t  t j  t d  t d  t d  t d  f } t  t j  f } t d  t d  t d  t d	  t d
  t d  f } t d  t d  t d  f } t d  t d  t d  t d  t d  f } t d  t d  f } t  t j  t d  t d  f } t  t j  f }	 t  t j  f }
 i | t 6| t 6| t 6| t	 6| t
 6| t 6| t 6| t 6|	 t 6|
 t 6t j   t 6} t j } x t d t |   D]j } xa t | d t |   D]F } x= | | | D]- } | j d  |  j t | | j |  q WqλWqΛWt    } xN t j D]C } y) | j |  } |  j t |  d  WqLt k
 rqLXqLWx/ | j   D]! } x | D] } | j   q­Wq Wd  S(   Ns	   globin.fas   clustal.alns   clustal181.alns   clustal_glualign.alns   clustalw182.alns   phylip_test_1.phys   phylip_test_2.phys   phylip_test_3.phys   phylip_test_4.phys   phylip_test_5.phys   dna.phys   dna.msfs   cox2.msfs   1beo.msfs	   cox2.nbrfs	   crab.nbrfs   dna.pirs   rhod.pirs   protein.pirs   nexus/protein.nexs   nexus/dna.nexs   pfam_example.txts   pfam.txti    i   (   R   R$   R!   R   t
   clustal_iot   plain_iot   stockholm_iot   table_ioR    t	   phylip_iot   msf_iot   nbrf_iot   nexus_ioR   t   examplest
   genbank_ioR   t   _parserst   rangeR   t   seekR   R   R   R   t   valuest   close(   R
   t   fasta_examplest   clustal_examplest   plain_examplest   phylip_examplest   msf_examplest   nbrf_examplest   nexus_examplest   stockholm_examplest   table_examplest   array_examplesR0   t   parsersR   t   jR   R   t   pt   s(    (    sL   /Users/gec/Work/Projects/corebioproj/weblogo-3.4/test_corebio/test_seq_io.pyt   test_parsersa   sr    																	 &	(   t   __name__t
   __module__R   R   R   R   R   R   R#   R&   R'   RE   (    (    (    sL   /Users/gec/Work/Projects/corebioproj/weblogo-3.4/test_corebio/test_seq_io.pyR   '   s   									t   __main__(   t
   __future__R    t   unittestt   corebiot   corebio.seqt   corebio.seq_iot   corebio._py3kR   t   test_corebiot    R   t   TestCaseR   RF   t   main(    (    (    sL   /Users/gec/Work/Projects/corebioproj/weblogo-3.4/test_corebio/test_seq_io.pyt   <module>   s   



