#!/usr/bin/env python# -*- coding: utf-8 -*-## This file is part of the `pypath` python module## Copyright 2014-2023# EMBL, EMBL-EBI, Uniklinik RWTH Aachen, Heidelberg University## Authors: see the file `README.rst`# Contact: Dénes Türei (turei.denes@gmail.com)## Distributed under the GPLv3 License.# See accompanying file LICENSE.txt or copy at# https://www.gnu.org/licenses/gpl-3.0.html## Website: https://pypath.omnipathdb.org/#importreimportsysimportpypath.resources.urlsasurlsimportpypath.share.curlascurlimportpypath.inputs.pfamaspfam_inputimportpypath.share.progressasprogress
[docs]defget_i3d():""" Interaction3D contains residue numbers in given chains in given PDB stuctures, so we need to add an offset to get the residue numbers valid for UniProt sequences. Offsets can be obtained from Instruct, or from the Pfam PDB-chain-UniProt mapping table. """dname_pfam,pfam_dname=pfam_input.pfam_names()ifdname_pfamisNone:sys.stdout.write('\n\t:: Could not get Pfam domain names\n\n')non_digit=re.compile(r'[^\d.-]+')c=curl.Curl(urls.urls['i3d_human']['url'],silent=False)data=c.resultifdataisNone:returnNonedata=data.replace('\r','').split('\n')deldata[0]i3d=[]prg=progress.Progress(len(data),'Processing domain-domain interactions',11)forlindata:prg.step()l=l.split('\t')iflen(l)>20:domain1=Noneifl[13]notindname_pfamelsedname_pfam[l[13]]domain2=Noneifl[20]notindname_pfamelsedname_pfam[l[20]]pdb=l[5]uniprot1=l[0]uniprot2=l[1]chain1=l[7]seq1=[[int(non_digit.sub('',l[11])),int(non_digit.sub('',l[12]))]]chain2=l[14]seq2=[[int(non_digit.sub('',l[18])),int(non_digit.sub('',l[19]))]]i3d.append({uniprot1:{'pfam':domain1,'chain':chain1,'seq':seq1},uniprot2:{'pfam':domain2,'chain':chain2,'seq':seq2},'uniprots':[uniprot1,uniprot2],'source':'I3D','pdb':[pdb],'references':[]})prg.terminate()returni3d