flybase api

Flybase api

API documentation

from bs4 import BeautifulSoup
from urllib.request import urlopen

ID = "FBgn0051624"
url = "https://api.flybase.org/api/v1.0/chadoxml/" + ID
html = urlopen(url)
soup = BeautifulSoup(html, features='xml')

Orth_all = [i for i in soup.find_all("feature_relationship") if i.find('name').get_text() == 'orthologous_to']
Orth_Homo = [i for i in Orth_all if i.find('genus').get_text() == 'Homo']
Gene_Syambol = [i.find_all('name')[2].get_text().split('\\')[1] for i in Orth_Homo]
Gene_Ensembl = [[i.find('accession').get_text() for i in ii.find_all("dbxref_id") if i.find('name').get_text() == "Ensembl_Homo_sapiens"][0] for ii in Orth_Homo]
Author

Karobben

Posted on

2022-12-05

Updated on

2024-01-11

Licensed under

Comments