ó
{™xTc           @   s¡   d  d l  m Z d  d l m Z d  d l Z d e j f d „  ƒ  YZ e j ƒ  j e ƒ Z	 e j
 e	 g ƒ Z d „  Z e d k r� e j d d	 ƒ j e ƒ n  d S(
   iÿÿÿÿ(   t   division(   t   ncbi_blast_xmlNt	   TestParsec           B   s;   e  Z d Z d  „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C   s…   |  j  j d  k r� d d  l } | j j d d ƒ } d d  l } d d  l } t j	 d | j
 | j j | d d ƒ ƒ ƒ |  j  _ n  d  S(   Niÿÿÿÿt   iotbxt   bioinformaticst   sourcet   tests   ncbi_blast.xml.gz(   t	   __class__t   HSEARCHt   Nonet   libtbx.load_envt   envt
   under_distt   os.patht   gzipR   t   parset   opent   patht   join(   t   selft   libtbxt   roott   osR   (    (    sZ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/bioinformatics/test/tst_ncbi_blast_xml.pyt   setUp   s    	c         C   sž  |  j  j j d j d j d } |  j | j d ƒ |  j | j d d ƒ |  j | j	 d ƒ |  j | j
 d d ƒ |  j | j j d ƒ |  j | j j d	 ƒ |  j | j j d ƒ |  j | j j d
 ƒ |  j | j j d ƒ |  j | j j d ƒ |  j | j d ƒ |  j | j d ƒ |  j | j d ƒ |  j | j d	 ƒ |  j | j j d d d ƒ |  j | j j d d d ƒ |  j | j d d d ƒ d  S(   Ni    i   i   gu“Vâc@i   i‘  g:;_IóJÎ7i   iÀ   i   iÁ   iN   i   i   sB   KSKIIFVVGGPGSGKGTQCEKIVQKYGYTHLSTGDLLRAEVSS-GSARGKMLSEIMEKGQLVPLETs@   VLDMLR---DAMVAKVDTSKGFLIDGYPREVKQGEEFERKI---GQPTLLLYVDAGPETMTKRLt>   LKRGETSGRVDDNEETIKKRLETYYKATEPVIAFYEKRGIVRKVNAEGSVDDVFSQVCTHLDtB   KPLVVFVLGGPGAGKGTQCARIVEKYGYTHLSAGELLRDERKNPDSQYGELIEKYIKEGKIVPVEIt@   TISLLKREMDQTMAANAQKNKFLIDGFPRNQDNLQGWNKTMDGKADVSFVLFFDCNNEICIERCt>   LERGKSSGRSDDNRESLEKRIQTYLQSTKPIIDLYEEMGKVKKIDASKSVDEVFDEVVQIFDsB   K  ++FV+GGPG+GKGTQC +IV+KYGYTHLS G+LLR E  +  S  G+++ + +++G++VP+E s@    + +L+   D  +A       FLIDG+PR     + + + +      + +L+ D   E   +R s>   L+RG++SGR DDN E+++KR++TY ++T+P+I  YE+ G V+K++A  SVD+VF +V    D(   R   R   t
   iterationst   hitst   hspst   assertEqualt   numt   assertAlmostEqualt	   bit_scoret   scoret   evaluet   queryt   startt   endt   framet   hitt   identityt   positivet   gapst   lengtht   seqt   midline(   R   t   hsp(    (    sZ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/bioinformatics/test/tst_ncbi_blast_xml.pyt   testHsps   s0    !		c         C   s–   |  j  j j d j d } |  j | j d ƒ |  j | j d ƒ |  j | j d ƒ |  j | j d ƒ |  j | j	 d ƒ |  j t
 | j ƒ d ƒ d  S(	   Ni    i   i   s   gi|50513735|pdb|1TEV|AsJ   Chain A, Crystal Structure Of The Human UmpCMP KINASE IN OPEN Conformationt   1TEV_AiÄ   i   (   R   R   R   R   R   R    t
   identifiert
   annotationt	   accessionR-   t   lenR   (   R   R)   (    (    sZ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/bioinformatics/test/tst_ncbi_blast_xml.pyt   testHits?   s    c         C   s  |  j  j j d } |  j | j d ƒ |  j | j d ƒ |  j | j d ƒ |  j | j d ƒ |  j t | j	 ƒ d ƒ |  j | j
 j d ƒ |  j | j
 j d ƒ |  j | j
 j d ƒ |  j | j
 j d ƒ |  j | j
 j d	 ƒ |  j | j
 j d
 ƒ |  j | j
 j d ƒ d  S(   Ni    i   t   77636s   3ADK:A|PDBID|CHAIN|SEQUENCEiÃ   iD   ièž  i£À� gË¡E¶óý¤?gJ+‡Ñ?gìQ¸…ëÁ?(   R   R   R   R   R    t   query_idt	   query_deft	   query_lenR6   R   t
   statisticst   db_numt   db_lent   hsp_lent	   eff_spacet   kappat   lambdavt   entropy(   R   t	   iteration(    (    sZ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/bioinformatics/test/tst_ncbi_blast_xml.pyt   testIterationsN   s    c         C   s0  |  j  j } |  j | j d ƒ |  j | j d ƒ |  j | j d d d d d d ƒ |  j | j d	 ƒ |  j | j d
 ƒ |  j | j d ƒ |  j | j	 d ƒ |  j t
 | j ƒ d ƒ |  j | j j d ƒ |  j | j j d ƒ |  j | j j d ƒ |  j | j j d ƒ |  j | j j d ƒ d  S(   Nt   blastps   BLASTP 2.2.20+s:   Alejandro A. Sch&auml;ffer, L. Aravind, Thomas L. Madden, sA   Sergei Shavirin, John L. Spouge, Yuri I. Wolf, Eugene V. Koonin, s    and Stephen F. Altschul (2001), sD   "Improving the accuracy of PSI-BLAST protein database searches with s5   composition-based statistics and other refinements", s    Nucleic Acids Res. 29:2994-3005.t   pdbR8   s   3ADK:A|PDBID|CHAIN|SEQUENCEiÃ   i   t   BLOSUM62i
   i   t   F(   R   R   R   t   programt   versiont	   referencet   dbR9   R:   R;   R6   R   t
   parameterst   matrixt   expectt   gap_opent
   gap_extendt   filter(   R   t   output(    (    sZ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/bioinformatics/test/tst_ncbi_blast_xml.pyt   testRoot`   s     N(	   t   __name__t
   __module__R	   R   R   R1   R7   RE   RU   (    (    (    sZ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/bioinformatics/test/tst_ncbi_blast_xml.pyR      s   		&		c         C   s   t  S(   N(   t   alltests(   t   loadert   testst   pattern(    (    sZ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/bioinformatics/test/tst_ncbi_blast_xml.pyt
   load_tests„   s    t   __main__t	   verbosityi   (   t
   __future__R    t   iotbx.bioinformaticsR   t   unittestt   TestCaseR   t
   TestLoadert   loadTestsFromTestCaset   suite_parset	   TestSuiteRX   R\   RV   t   TextTestRunnert   run(    (    (    sZ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/bioinformatics/test/tst_ncbi_blast_xml.pyt   <module>   s   s	