Skip to content
Snippets Groups Projects
Commit f9dede09 authored by Hervé  MENAGER's avatar Hervé MENAGER
Browse files

add pfam information service client

parent 4009bb21
No related branches found
No related tags found
No related merge requests found
from bioservices.eutils import EUtils
from bioservices.uniprot import UniProt
from xml.etree.ElementTree import register_namespace
import xml.etree.ElementTree as ET
import requests
def get_pubmed_info(pmid):
......@@ -66,4 +66,15 @@ def get_taxonomy_info(taxonomy_id):
eu = EUtils()
r = eu.EFetch('taxonomy', taxonomy_id, retmode='dict')
scientific_name = r['TaxaSet']['Taxon']['ScientificName']
return {'scientific_name': scientific_name}
return {'scientific_name': scientific_name}
def get_pfam_info(pfam_acc):
resp = requests.get('http://pfam.xfam.org/family/{}?output=xml'.format(pfam_acc))
root = ET.fromstring(resp.text)
ns = {'pfam': 'http://pfam.xfam.org/'}
entry = root.findall('pfam:entry', ns)[0]
pfam_id = entry.attrib['id']
description = entry.findall('pfam:description', ns)[0].text.strip()
domain_family = ''
return {'id': pfam_id,
'description': description}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment