from typing import List
import mygene
import requests
def render_html(pdb_id, chain):
if pdb_id is None or chain is None:
return ""
html = f"""
"
"""
iframe = f"""
"""
return iframe
def get_gene_names(genes: List[str]):
mg = mygene.MyGeneInfo()
ginfo = mg.querymany(genes, scopes="ensembl.gene", verbose=False, fields="name")
gene_names = [gene["name"] for gene in ginfo]
return gene_names
def get_protein_name(pdb_id: str):
url = f"https://data.rcsb.org/rest/v1/core/entry/{pdb_id}"
response = requests.get(url, timeout=1)
if response.ok:
data = response.json()
protein_name = data["struct"]["title"]
else:
protein_name = "Unknown"
return protein_name