o
    Rŀg߁                     @   s  d Z ddlZddl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lmZ dd	lmZ dd
lmZ ddlmZ ddlmZ ddddddddZddddddddZg dZg dZg dZi d d!d"d#dd$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>Zi d d?d"d@ddAd%dBd'dCd)dDd+dEd-dFd/dGd1dHd3dId5dJd7dKd9dLd;dMd=dNZdOdP ZedQZdRdS ZdTdU ZG dVdW dWZG dXdY dYZG dZd[ d[eZ G d\d] d]Z!							^dcd_d`Z"dddadbZ#dS )ea  SCOP: Structural Classification of Proteins.

The SCOP database aims to provide a manually constructed classification of
all know protein structures into a hierarchy, the main levels of which
are family, superfamily and fold.

* "SCOP":http://scop.mrc-lmb.cam.ac.uk/legacy/
* "Introduction":http://scop.mrc-lmb.cam.ac.uk/legacy/intro.html
* "SCOP parsable files":http://scop.mrc-lmb.cam.ac.uk/legacy/parse/

The Scop object in this module represents the entire SCOP classification. It
can be built from the three SCOP parsable files, modified is so desired, and
converted back to the same file formats. A single SCOP domain (represented
by the Domain class) can be obtained from Scop using the domain's SCOP
identifier (sid).

- nodeCodeDict -- A mapping between known 2 letter node codes and a longer
                  description. The known node types are 'cl' (class), 'cf'
                  (fold), 'sf' (superfamily), 'fa' (family), 'dm' (domain),
                  'sp' (species), 'px' (domain). Additional node types may
                  be added in the future.

This module also provides code to access SCOP over the WWW.

Functions:
 - search        -- Access the main CGI script (DEPRECATED, no longer available)..
 - _open         -- Internally used function.

    N)	urlencode)urlopen)BiopythonDeprecationWarning)SeqIO)Seq   )Cla)Des)Hie)Residuesclassfoldsuperfamilyfamilyproteinspeciesdomain)clcfsffadmsppxr   r   r   r   r   r   r   )r   r   r   r   r   r   r   )ror   r   r   r   r   r   r   )
            #   (   2   F   Z   _   d   )r      r         ?皙?皙?{Gz?{Gzt?MbP?-C6?h㈵>绽|=V瞯<#B;}:Jz5r   ze+1r&   ze+0,7ze+0r'   ze-0,3r(   ze-1r)   ze-1,3r*   ze-2r+   ze-2,3r,   ze-3r-   ze-4r.   ze-5r/   ze-10r0   ze-15r1   ze-20r2   ze-25r3   ze-50e1e0_7e0e_0_3e_1e_1_3e_2e_2_3e_3e_4e_5e_10e_15e_20e_25e_50c           
      C   s   |  d}| d}|d |d }}||k rdS ||krdS t|dd |dd D ]\}}t|}t|}||k r? dS ||krF dS q,t|}t|}	||	k rUdS ||	kr[dS dS )a  Order SCOP concise classification strings (sccs).

    a.4.5.1 < a.4.5.11 < b.1.1.1

    A sccs (e.g. a.4.5.11) compactly represents a domain's classification.
    The letter represents the class, and the numbers are the fold,
    superfamily, and family, respectively.
    .r   r   N)splitzipintlen)
sccs1sccs2s1s2c1c2i1i2n1n2 rT   E/var/www/html/myenv/lib/python3.10/site-packages/Bio/SCOP/__init__.pycmp_sccs]   s,   
	
"rV   z+>?([\w_\.]*)\s+([\w\.]*)\s+\(([^)]*)\) (.*)c                 C   sx   t | }|std|  t }|d|_|d|_t|d|_|jj	s2|jdd |j_	|d
 |_|S )ab  Convert an ASTRAL header string into a Scop domain.

    An ASTRAL (http://astral.stanford.edu/) header contains a concise
    description of a SCOP domain. A very similar format is used when a
    Domain object is converted into a string.  The Domain returned by this
    method contains most of the SCOP information, but it will not be located
    within the SCOP hierarchy (i.e. The parent node will be None). The
    description is composed of the SCOP protein and species descriptions.

    A typical ASTRAL header looks like --
    >d1tpt_1 a.46.2.1 (1-70) Thymidine phosphorylase {Escherichia coli}
    zDomain: r         r&      )
_domain_rematch
ValueErrorDomaingroupsidsccsr   residuespdbidstripdescription)termmdomrT   rT   rU   parse_domain   s   
rh   c                 C   s&   d| d| }t tj| |}|S )Nzdir.z
.scop.txt_)openospathjoin)scop_dir_pathversionfiletypefilenamehandlerT   rT   rU   _open_scop_file   s   rr   c                   @   s   e Zd ZdZ						dddZdd Zdd Zd	d
 Zdd Zdd Z	dd Z
dd Zd ddZdd Zdd Zdd Zdd Zdd ZdS )!ScopzKThe entire SCOP hierarchy.

    root -- The root node of the hierarchy
    Nc                 C   s  i | _ i | _tdd |||||fD rdS |du r.|du r.|du s*|du s*|du r.tdi }|| _z
|r8n|r\|s@td|sF|sF|rJtdt||d}t||d}t||d	}t }g }	d
|_d|_|||j< || _	d|_
t|}
|
D ],}|jdkrt }|j|_|	| nt }|j|_|j|_|j|_|j
|_
|||j< qyt|}
|
D ];}|j|vrt|j ||j }|jdkr|j|vrtd||j |_|jD ]}||vrtd|j||  qqi }t|}
|
D ]"}||j }|j|jksJ |j|jksJ |j|_|||j< q|| _|| _ t|	| _W |r;|r+|  |r2|  |r=|  dS dS dS |rX|rI|  |rP|  |rY|  w w w )a0  Build the SCOP hierarchy from the SCOP parsable files, or a sql backend.

        If no file handles are given, then a Scop object with a single
        empty root node is returned.

        If a directory and version are given (with dir_path=.., version=...) or
        file handles for each file, the whole scop tree will be built in memory.

        If a MySQLdb database handle is given, the tree will be built as needed,
        minimising construction times.  To build the SQL database to the methods
        write_xxx_sql to create the tables.

        c                 s   s    | ]}|d u V  qd S NrT   ).0hrT   rT   rU   	<genexpr>   s    
z Scop.__init__.<locals>.<genexpr>Nz)Need CLA, DES and HIE files to build SCOPz5Need SCOP version to find parsable files in directoryz0Cannot specify SCOP directory and specific filescladeshier   r   z	SCOP Rootr    zIncomplete data?)_sidDict
_sunidDictallRuntimeError	db_handlerr   Nodesunidtyperootrd   r	   parsenodetyper]   namer_   appendr`   r
   printparentr\   childrenr   ra   tuple_domainsclose)self
cla_handle
des_handle
hie_handledir_pathr   rn   	sunidDictr   domainsrecordsrecordncsidDictrT   rT   rU   __init__   s   













zScop.__init__c                 C   s
   |  dS )zGet root node.r   )getNodeBySunidr   rT   rT   rU   getRoot)  s   
zScop.getRootc                 C   B   || j v r
| j | S | jr| j|d || j v r| j | S dS dS )zReturn a domain from its sid.)r_   N)r|   r   getDomainFromSQL)r   r_   rT   rT   rU   getDomainBySid-     



zScop.getDomainBySidc                 C   r   )zReturn a node from its sunid.r   N)r}   r   r   )r   r   rT   rT   rU   r   8  r   zScop.getNodeBySunidc                 C   s   | j r
|  dS | jS )z,Return an ordered tuple of all SCOP Domains.r   )r   r   getDescendentsr   r   rT   rT   rU   
getDomainsC  s   zScop.getDomainsc                 C   2   t | j dd dD ]}|t|  qdS )z1Build an HIE SCOP parsable file from this object.c                 S      | j S rt   r   xrT   rT   rU   <lambda>M      z Scop.write_hie.<locals>.<lambda>keyN)sortedr}   valueswritestrtoHieRecordr   rq   r   rT   rT   rU   	write_hieJ     zScop.write_hiec                 C   s<   t | j dd dD ]}|| jkr|t|  qdS )z0Build a DES SCOP parsable file from this object.c                 S   r   rt   r   r   rT   rT   rU   r   S  r   z Scop.write_des.<locals>.<lambda>r   N)r   r}   r   r   r   r   toDesRecordr   rT   rT   rU   	write_desP  s
   
zScop.write_desc                 C   r   )z0Build a CLA SCOP parsable file from this object.c                 S   r   rt   r   r   rT   rT   rU   r   Z  r   z Scop.write_cla.<locals>.<lambda>r   N)r   r|   r   r   r   toClaRecordr   rT   rT   rU   	write_claW  r   zScop.write_clac           
      C   sX  |du r
|du r
dS | j  }|r%|d| | }|du r!dS |d }|d| | }|durd}|d dkrZt| d}|d| g }| D ]	}||d  qL||_n%t| d}|d	| | \|_	|_
}	t|j
|_
|	|j
_|| j|j	< |\|_|_|_|_|d d
kr|d| | d |_t|j|_|| j|j< dS dS )z4Load a node from the SQL backend using sunid or sid.Nz"SELECT sunid FROM cla WHERE sid=%sr   z SELECT * FROM des WHERE sunid=%sr   r   scop%SELECT child FROM hie WHERE parent=%sz3select sid, residues, pdbid from cla where sunid=%sr   %SELECT parent FROM hie WHERE child=%s)r   cursorexecutefetchoner   fetchallr   r   r]   r_   ra   r   rb   r|   r   r   r`   rd   r   rH   r}   )
r   r   r_   curresdatar   r   r   rb   rT   rT   rU   r   ]  sF   


zScop.getDomainFromSQLc                 C   sf   t |t |jkrdS | j }|d| d |j d |j | }|dur1| |d S dS )z!Get ascendents using SQL backend.NzSELECT z from cla WHERE =%sr   )	nodeCodeOrderindexr   r   r   r   r   r   r   )r   noder   r   resultrT   rT   rU   getAscendentFromSQL  s   
zScop.getAscendentFromSQLc              
   C   s  t |t |jkrg S g }|jdkr+| D ]}| ||D ]}|| q q|S | j }|dkr|d|j d | d |j	 |
 }|D ]Z}t|d | jvrt| d}|\|_	|_|_|_t|j	|_	|| j|j	< |d|j	 | d |_|d	|j	 g }	|
 D ]	}|	|d  q|	|_|| jt|d   qJ|S |d
|j d |j	 |
 }|D ]N}t|d | jvrt| d}|dd \|_	|_}
|_|_|_|_|_t|j|_|
|j_t|j	|_	|| j|j	< || j|j< || jt|d   q|S )zGet descendents of a node using the database backend.

        This avoids repeated iteration of SQL calls and is therefore much
        quicker than repeatedly calling node.getChildren().
        r   r   zOSELECT DISTINCT des.sunid,des.type,des.sccs,description FROM cla,des WHERE cla.z=%s AND cla.z
=des.sunidr   r   r   r   zpSELECT cla.sunid,sid,pdbid,residues,cla.sccs,type,description,sp FROM cla,des where cla.sunid=des.sunid and cla.r      )r   r   r   getChildrengetDescendentsFromSQLr   r   r   r   r   r   rH   r}   r   r`   rd   r   r   r   r]   r_   ra   r   rb   r|   )r   r   r   des_listr   dr   r   r   r   rb   rT   rT   rU   r     s   





zScop.getDescendentsFromSQLc              	   C   sX   |  }|d |d | j D ]}|jD ]}|d|j d|j d qqdS )zWrite HIE data to SQL database.zDROP TABLE IF EXISTS hiezNCREATE TABLE hie (parent INT, child INT, PRIMARY KEY (child), INDEX (parent) )zINSERT INTO hie VALUES (,)N)r   r   r}   r   r   r   )r   rq   r   pr   rT   rT   rU   write_hie_sql  s   

zScop.write_hie_sqlc                 C   s   |  }|d |d | j D ]7}| }|d|j|j|jj|j|j	|
dj|
dj|
dj|
dj|
dj|
d	j|jf qd
S )zWrite CLA data to SQL database.zDROP TABLE IF EXISTS clazCREATE TABLE cla (sunid INT, sid CHAR(8), pdbid CHAR(4), residues VARCHAR(50), sccs CHAR(10), cl INT, cf INT, sf INT, fa INT, dm INT, sp INT, px INT, PRIMARY KEY (sunid), INDEX (SID) )z<INSERT INTO cla VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)r   r   r   r   r   r   N)r   r   r|   r   r   r   r_   ra   rb   r`   getAscendent)r   rq   r   r   r   rT   rT   rU   write_cla_sql  s0   






zScop.write_cla_sqlc                 C   sL   |  }|d |d | j D ]}|d|j|j|j|jf qdS )zWrite DES data to SQL database.zDROP TABLE IF EXISTS desziCREATE TABLE des (sunid INT, type CHAR(2), sccs CHAR(10), description VARCHAR(255), PRIMARY KEY (sunid) )z$INSERT INTO des VALUES (%s,%s,%s,%s)N)r   r   r}   r   r   r   r`   rd   )r   rq   r   r   rT   rT   rU   write_des_sql  s   
zScop.write_des_sql)NNNNNNNN)__name__
__module____qualname____doc__r   r   r   r   r   r   r   r   r   r   r   r   r   r   rT   rT   rT   rU   rs      s,    
}
2Lrs   c                   @   sR   e Zd ZdZdddZdd Zdd Zd	d
 Zdd Zdd Z	dd Z
dd ZdS )r   ag  A node in the Scop hierarchy.

    Attributes:
     - sunid  -- SCOP unique identifiers. e.g. '14986'
     - parent -- The parent node
     - children -- A list of child nodes
     - sccs     -- SCOP concise classification string. e.g. 'a.1.1.2'
     - type     -- A 2 letter node type code. e.g. 'px' for domains
     - description -- Description text.

    Nc                 C   s.   d| _ d| _g | _d| _d| _d| _|| _dS )a  Initialize a Node in the scop hierarchy.

        If a Scop instance is provided to the constructor, this will be used
        to lookup related references using the SQL methods.  If no instance
        is provided, it is assumed the whole tree exists and is connected.
        r{   N)r   r   r   r`   r   rd   r   r   r   rT   rT   rU   r   5  s   
zNode.__init__c                 C   sB   g }| t| j | | j | | j | | j d|S )zRepresent the node as a string. )r   r   r   r`   r   rd   rl   )r   srT   rT   rU   __str__D  s   
zNode.__str__c                 C   sX   t  }t| j|_|  rt|  j|_nd|_|  D ]}|jt|j q|S )zReturn an Hie.Record.-)	r
   Recordr   r   	getParentr   r   r   r   )r   recr   rT   rT   rU   r   N  s   zNode.toHieRecordc                 C   s0   t  }t| j|_| j|_| j|_| j|_|S zReturn a Des.Record.)r	   r   r   r   r   r   r`   rd   r   r   rT   rT   rU   r   Z  s   zNode.toDesRecordc                    s$    j du r jS  fdd jD S )z'Return a list of children of this Node.Nc                       g | ]} j |qS rT   )r   r   ru   r   r   rT   rU   
<listcomp>h      z$Node.getChildren.<locals>.<listcomp>)r   r   r   rT   r   rU   r   c  s   
zNode.getChildrenc                 C   s   | j du r| jS | j | jS )zReturn the parent of this Node.N)r   r   r   r   rT   rT   rU   r   j  s   
zNode.getParentc                 C   s   |t v rt | }| g}| jr| j| |S |d j|krA|d jdkr%g S g }|D ]}| D ]}|| q/|}q)|d j|ks|S )zReturn a list of all descendant nodes of the given type.

        Node type can be a two letter code or longer description,
        e.g. 'fa' or 'family'.
        r   r   )_nodetype_to_coder   r   r   r   r   )r   	node_typenodes
child_listr   childrT   rT   rU   r   q  s   	zNode.getDescendentsc                 C   sd   |t v rt | }| jr| j| |S | }|j|krdS |j|kr0|jdkr'dS | }|j|ks |S )zReturn the ancenstor node of the given type, or None.

        Node type can be a two letter code or longer description,
        e.g. 'fa' or 'family'.
        Nr   )r   r   r   r   r   )r   r   r   rT   rT   rU   r     s   



zNode.getAscendentrt   )r   r   r   r   r   r   r   r   r   r   r   r   rT   rT   rT   rU   r   (  s    

	r   c                   @   s2   e Zd ZdZdddZdd Zdd Zd	d
 ZdS )r]   zA SCOP domain. A leaf node in the Scop hierarchy.

    Attributes:
        - sid - The SCOP domain identifier. e.g. ``"d5hbib_"``
        - residues - A Residue object. It defines the collection of PDB
          atoms that make up this domain.

    Nc                 C   s   t j| |d d| _d| _dS )z Initialize a SCOP Domain object.r   r{   N)r   r   r_   ra   r   rT   rT   rU   r     s   
zDomain.__init__c                 C   s   g }| | j | | j | dt| j d  |  s%| | j n|  }| }| |j | d|j d  d|S )z&Represent the SCOP Domain as a string.(r   {}r   )r   r_   r`   r   ra   r   rd   rl   )r   r   r   r   rT   rT   rU   r     s   
zDomain.__str__c                 C   s   t | }| j|_|S r   )r   r   r_   r   r   rT   rT   rU   r     s   
zDomain.toDesRecordc                 C   s^   t  }| j|_| j|_| j|_| j|_| }|jdkr-t|j|j|j< |	 }|jdks|S )zReturn a Cla.Record.r   )
r   r   r_   ra   r`   r   r   	hierarchyr   r   )r   r   r   rT   rT   rU   r     s   

zDomain.toClaRecordrt   )r   r   r   r   r   r   r   r   rT   rT   rT   rU   r]     s    
	r]   c                   @   sv   e Zd ZdZ	dddZdd Zdd Zdd	d
Zdd Zdd Z	dd Z
dd Zdd Zdd Zdd Zdd ZdS )AstralzRepresentation of the ASTRAL database.

    Abstraction of the ASTRAL database, which has sequences for all the SCOP domains,
    as well as clusterings by percent id or evalue.
    Nc                 C   s   |du r|du r|du rt d|st d|| _|| _|sI|sI|du s(|du r,t d|| _tj|d| | _d| j d}tj| j|}|rUtt	|d| _
|| _i | _i | _i | _i | _dS )	am  Initialize the astral database.

        You must provide either a directory of SCOP files:
            - dir_path - string, the path to location of the scopseq-x.xx directory
                       (not the directory itself), and
            - version   -a version number.

        or, a FASTA file:
            - astral_file - string, a path to a fasta file (which will be loaded in memory)

        or, a MYSQL database:
            - db_handle - a database handle for a MYSQL database containing a table
              'astral' with the astral data in it.  This can be created
              using writeToSQL.

        NzXNeed either file handle, or (dir_path + version), or database handle to construct Astralz)Must provide a Scop instance to constructz!must provide dir_path and versionzscopseq-zastral-scopdom-seqres-all-z.fafasta)r   r   r   rn   rj   rk   rl   r   to_dictr   
fasta_dictastral_file
EvDatasets
EvDatahash
IdDatasets
IdDatahash)r   r   rn   r   r   r   rT   rT   rU   r     s,   
zAstral.__init__c                 C   sv   || j vr6| jr| t| | j |< n#| jstdd}d|t| | jf }tj	| j|}| 
|| j |< | j | S )z Get domains clustered by evalue.No scopseq directory specifiedastral-scopdom-seqres-sel-gsz%s-e100m-%s-%s.id)r   r   getAstralDomainsFromSQLastralEv_to_sqlrk   r   astralEv_to_filern   rj   rl   getAstralDomainsFromFiler   idfile_prefixrp   rT   rT   rU   domainsClusteredByEv  s   

zAstral.domainsClusteredByEvc                 C   s~   || j vr:| jr| dt| | j |< n%| jstdd}| d| d| j d}tj| j|}| 	|| j |< | j | S )z-Get domains clustered by percentage identity.r  r   r   z-bib-r   z.id)
r   r   r   r   rk   r   rn   rj   rl   r  r  rT   rT   rU   domainsClusteredById'  s   

zAstral.domainsClusteredByIdc                    s|   |du r|du rt d|st|}g }	 | }|sn
| }|| q|r,|  dd |D } fdd|D }|S )z;Get the scop domains from a file containing a list of sids.Nz%You must provide a filename or handleTc                 S   s   g | ]
}|d  dkr|qS )r   r   rT   )ru   arT   rT   rU   r   F      z3Astral.getAstralDomainsFromFile.<locals>.<listcomp>c                    r   rT   r   r   r   r   rT   rU   r   G  r   )r   ri   readlinerstripr   r   )r   rp   file_handledomslinerT   r   rU   r  6  s"   
zAstral.getAstralDomainsFromFilec                    s:    j  }|d| d  | } fdd|D }|S )zLoad ASTRAL domains from the MySQL database.

        Load a set of astral domains from a column in the astral table of a MYSQL
        database (which can be created with writeToSQL(...).
        zSELECT sid FROM astral WHERE z=1c                    s   g | ]
} j |d  qS )r   r	  r   r   rT   rU   r   S  r  z2Astral.getAstralDomainsFromSQL.<locals>.<listcomp>)r   r   r   r   )r   columnr   r   rT   r   rU   r   J  s
   
zAstral.getAstralDomainsFromSQLc                 C   s<   | j du r| j| jS | j  }|d| t| d S )z2Get the seq record of a given domain from its sid.Nz#SELECT seq FROM astral WHERE sid=%sr   )r   r   seqr   r   r   r   )r   r   r   rT   rT   rU   getSeqBySidW  s
   

zAstral.getSeqBySidc                 C   s   |  |jS )z"Return seq associated with domain.)r  r_   )r   r   rT   rT   rU   getSeq`  s   zAstral.getSeqc                 C   <   || j vri | j |< | |D ]	}d| j | |< q| j | S )z5Get domains clustered by sequence identity in a dict.r   )r   r  r   r  r   rT   rT   rU   hashedDomainsByIdd  
   


zAstral.hashedDomainsByIdc                 C   r  )z*Get domains clustered by evalue in a dict.r   )r   r  r  rT   rT   rU   hashedDomainsByEvl  r  zAstral.hashedDomainsByEvc                 C      ||  |v S )zCReturn true if the domain is in the astral clusters for percent ID.)r  r   rg   r  rT   rT   rU   isDomainInIdt     zAstral.isDomainInIdc                 C   r  )z@Return true if the domain is in the ASTRAL clusters for evalues.)r  r  rT   rT   rU   isDomainInEvx  r  zAstral.isDomainInEvc                 C   s   |  }|d |d | jD ]}|d|| j| jf qtD ]"}|dt| d  | |D ]}|dt| d |j q4q"tD ]"}|dt	|  d  | 
|D ]}|d	t	|  d |j qYqGd
S )z.Write the ASTRAL database to a MYSQL database.zDROP TABLE IF EXISTS astralz>CREATE TABLE astral (sid CHAR(8), seq TEXT, PRIMARY KEY (sid))z+INSERT INTO astral (sid,seq) values (%s,%s)zALTER TABLE astral ADD (idz	 TINYINT)zUPDATE astral SET idz=1  WHERE sid=%szALTER TABLE astral ADD (zUPDATE astral SET N)r   r   r   r  astralBibIdsr   r  r_   	astralEvsr   r  )r   r   r   rg   ir   evrT   rT   rU   
writeToSQL|  s,   


zAstral.writeToSQL)NNNNNr   )r   r   r   r   r   r  r  r  r   r  r  r  r  r  r  r!  rT   rT   rT   rU   r     s    
1
	r   /http://scop.mrc-lmb.cam.ac.uk/legacy/search.cgic                 K   sX   t dt | |||||d}i }	| D ]\}
}|dur!||	|
< q|	| t||	S )a  Access SCOP search and return a handle to the results (DEPRECATED).

    Access search.cgi and return a handle to the results.  See the
    online help file for an explanation of the parameters:
    http://scop.mrc-lmb.cam.ac.uk/legacy/help.html

    Raises an IOError if there's a network error.

    This function is now DEPRECATED and will be removed in a future
    release of Biopython because this search.cgi API is no longer
    available with SCOP now hosted the the EBI.
    zuThe SCOP search function is deprecated and will be removed as the CGI based SCOP search is no longer availble online.)pdbr   r_   dispdirlocN)warningswarnr   itemsupdate_open)r#  r   r_   r$  r%  r&  cgikeywdsparams	variableskvrT   rT   rU   search  s   

r2  c                 C   sD   |du ri }t |}|r|r| d| 7 } t| }|S t| |d}|S )zOpen a handle to SCOP and return it (PRIVATE).

    Open a handle to SCOP.  cgi is the URL for the cgi script to access.
    params is a dictionary with the options to pass to it.  get is a boolean
    that describes whether a GET should be used.

    N?)r   )r   r   )r,  r.  getoptionsrq   rT   rT   rU   r+    s   	r+  )NNNNNNr"  )Nr   )$r   rj   rer'  urllib.parser   urllib.requestr   Bior   r   Bio.Seqr   r{   r   r	   r
   r   nodeCodeDictr   r   r  r  r   r   rV   compilerZ   rh   rr   rs   r   r]   r   r2  r+  rT   rT   rT   rU   <module>   s     
$   x; @
$