SlideShare a Scribd company logo
Biothings.api
https://github.com/SuLab/biothings.api
Generalizing MyGene and MyVariant
Motivation
• Isolate the common aspects of MyGene and
MyVariant codebases and make them
available in a separate framework:
biothings.api
• Allows easier development of additional
biothings APIs (Disease, Drug/Chemical, GO,
Species… -> JSON, aggregate on a single field)
• Allows easier maintenance and development
of current biothings (gene, variant).
System Overview
• The tornado HTTP server consists of handlers that contain the code to run
when a particular URL pattern is matched, e.g. /variant/, or /metadata
• The biothing codebase essentially contains the connection between the
appropriate Tornado HTTP Request Handler for a request and the elasticsearch
query that executes that request
Biothings – HTTP Handling
• tornado.web.RequestHandler: base tornado class for HTTP request handling. Important class methods:
get/post, get_arguments, write
• biothings.www.helper.BaseHandler: contains methods common to all biothings RequestHandlers.
Important class methods: get_query_params, return_json
• biothings.www.api.handlers.QueryHandler: contains methods to implement the biothings query
endpoint. Important class methods: get, post, _examine_kwargs
• biothings.www.api.handlers.BiothingHandler: contains methods to implement the biothings annotation
endpoint. Important class methods: get, post, _examine_kwargs
• biothings.www.api.handlers.MetaDataHandler: contains methods to implement the metadata endpoint
• biothings.www.api.handlers.StatusHandler: contains methods to implement a status endpoint for AWS
ELB
Biothings – HTTP Handling
• biothings.www.api.handlers.BiothingHandler:
– GET request (e.g. /variant/chr6:g.152708291G>A)
– POST request (e.g. /variant/)
Biothings – HTTP Handling
• biothings.www.api.handlers.QueryHandler:
– GET request (e.g. /query?q=_exists_:dbsnp)
– POST request (e.g. /query/)
Biothings – Elasticsearch query
• biothings.www.api.es.ESQuery – contains the python code
for constructing the elasticsearch query and formatting the resulting data
– query(q, **kwargs) – Contains the elasticsearch query to run with data obtained from a
GET or POST to the /query/ endpoint.
– get_biothing(bid, **kwargs) – Contains the elasticsearch query to run with data
obtained from a GET to the /annotation/ endpoint.
– mget_biothings(bid_list, **kwargs) – Contains the elasticsearch query to run with data
obtained from a POST to the /annotation/ endpoint.
– _cleaned_res(res) – Contains the code to format the return object for get_biothing and
mget_biothings.
– _cleaned_res2(res) – Contains the code to format the return object for query.
– _get_biothingdoc(hit) – Contains the code to format a single biothing object from any
elasticsearch query. Called by _cleaned_res and _cleaned_res2.
– _modify_biothingdoc(doc) – Contains the code to modify a biothing_doc. Called in
_get_biothingdoc. Currently empty -> for subclassing.
Biothings - Settings
• Problem: Until now, we have left out the problem of how to
refer to things that MUST be project specific (e.g., the name
of the elasticsearch index to search, the type of the
document, etc). How do we do this?
• Solution: We make a settings module in biothings that all
code within biothings refers to. That module looks for an
environment variable called BIOTHING_SETTINGS with the
name of a module that can be imported to set project specific
variables.
– export BIOTHING_SETTINGS = ‘biothings.config’
• Similar to Django.
Biothings - Settings
Biothings – Project template
• At this point, we have the tools necessary to easily create and
subclass 4 types of biothings handlers (BiothingHandler,
QueryHandler, MetaDataHandler, StatusHandler), and the
elasticsearch query class (ESQuery)
• Could definitely stop here and have a useful tool, but we
wanted to make it even easier to create a new project (also
enforces a uniform project structure across all biothings APIs).
• To do this we have a project template folder containing the
project directory structure and some skeleton code:
– config.py,
– URL patterns to Handlers connection
– Handlers to ESQuery connection
Biothings - Project template
• To create the actual project directory from the
template, we wrote a small function: start-project.py
– Usage: python start-project.py <path-to-project-
directory> <biothing-object-name>
– python start-project.py ~ variant
• Any folder or file in the template directory will be
created in the project directory. The contents of any
file are passed through the python String.template
function before they are created in the project
directory.
Biothings –
Project
template
www.api.handlers
Biothings –
MyVariant
Project
www.api.handlers
Biothings –
MyVariant
Project
www.api.handlers
Part 1
Biothings –
MyVariant
Project
www.api.handlers
Part 2
Biothings –
MyVariant
Project
www.api.es
Part 1
Biothings –
MyVariant
Project
www.api.es
Part 2
Recreating MyVariant.info using biothings.api
• Recreated current MyVariant.info service using the
biothings.api framework
– Very little extra code required (~100 lines)
– Less than a day of time to create the web front end from start.
– https://github.com/cyrus0824/myvariant.info_new
• Seems disingenuous to gauge the utility of a tool by recreating
a codebase if that tool was itself created from the codebase
=> Should try implementing other APIs, especially
MyGene.info (has more varied gene specific query options),
and modify biothings as needed.
Future work
• Integrate data load and data index functions into
biothings
• Documentation! – Projects like this need very good
documentation to be of any use to an API developer
(on the level of tornado’s excellent documentation:
http://www.tornadoweb.org/en/stable/web.html)
• Auto-generate clients (python client, R client)
• Auto-generate ansible-playbook to create cluster
hardware on AWS
• One-click API…

More Related Content

Viewers also liked

Google drive examen final
Google  drive examen finalGoogle  drive examen final
Google drive examen final
MILAGROS1804
 
Larry M. Girard Resume
Larry M. Girard ResumeLarry M. Girard Resume
Larry M. Girard Resume
Larry Girard
 
Sistemas economicos
Sistemas economicosSistemas economicos
Sistemas economicos
Sammy ToPs
 
Treball sintesis
Treball sintesisTreball sintesis
Treball sintesis
grupde5
 
cv-Mansoor Engineering-New
cv-Mansoor Engineering-Newcv-Mansoor Engineering-New
cv-Mansoor Engineering-New
Mansoor Qureshi
 
WRC Live
WRC LiveWRC Live
WRC Live
naissaerasder
 
Historic Cruise ms Rotterdam
Historic Cruise ms RotterdamHistoric Cruise ms Rotterdam
Historic Cruise ms Rotterdam
Chantal Hettich
 
Trabajar el ataque organizado
Trabajar el ataque organizadoTrabajar el ataque organizado
Trabajar el ataque organizado
Íñigo López de Carrizosa
 
Digital Leadership, Ibrahim Evsan, 2015
Digital Leadership, Ibrahim Evsan, 2015Digital Leadership, Ibrahim Evsan, 2015
Digital Leadership, Ibrahim Evsan, 2015
Ibrahim Evsan
 
147561730 slum-case-study-kolkata
147561730 slum-case-study-kolkata147561730 slum-case-study-kolkata
147561730 slum-case-study-kolkata
homeworkping3
 

Viewers also liked (11)

Google drive examen final
Google  drive examen finalGoogle  drive examen final
Google drive examen final
 
Larry M. Girard Resume
Larry M. Girard ResumeLarry M. Girard Resume
Larry M. Girard Resume
 
Sistemas economicos
Sistemas economicosSistemas economicos
Sistemas economicos
 
Treball sintesis
Treball sintesisTreball sintesis
Treball sintesis
 
cv-Mansoor Engineering-New
cv-Mansoor Engineering-Newcv-Mansoor Engineering-New
cv-Mansoor Engineering-New
 
WRC Live
WRC LiveWRC Live
WRC Live
 
Toast Masters
Toast MastersToast Masters
Toast Masters
 
Historic Cruise ms Rotterdam
Historic Cruise ms RotterdamHistoric Cruise ms Rotterdam
Historic Cruise ms Rotterdam
 
Trabajar el ataque organizado
Trabajar el ataque organizadoTrabajar el ataque organizado
Trabajar el ataque organizado
 
Digital Leadership, Ibrahim Evsan, 2015
Digital Leadership, Ibrahim Evsan, 2015Digital Leadership, Ibrahim Evsan, 2015
Digital Leadership, Ibrahim Evsan, 2015
 
147561730 slum-case-study-kolkata
147561730 slum-case-study-kolkata147561730 slum-case-study-kolkata
147561730 slum-case-study-kolkata
 

Similar to Biothings presentation

People aggregator
People aggregatorPeople aggregator
People aggregator
Huntor Group
 
Opinioz_intern
Opinioz_internOpinioz_intern
Opinioz_intern
Sai Ganesh
 
IBM File Net P8
IBM File Net P8IBM File Net P8
IBM File Net P8
Mohammed El Rafie Tarabay
 
NCBO Technology
NCBO TechnologyNCBO Technology
NCBO Technology
Trish Whetzel
 
Advanced guide to develop ajax applications using dojo
Advanced guide to develop ajax applications using dojoAdvanced guide to develop ajax applications using dojo
Advanced guide to develop ajax applications using dojo
Fu Cheng
 
Semantic web technologies applied to bioinformatics and laboratory data manag...
Semantic web technologies applied to bioinformatics and laboratory data manag...Semantic web technologies applied to bioinformatics and laboratory data manag...
Semantic web technologies applied to bioinformatics and laboratory data manag...
Toni Hermoso Pulido
 
CTS2 Development Framework In Action
CTS2 Development Framework In ActionCTS2 Development Framework In Action
CTS2 Development Framework In Action
cts2framework
 
InterMine Infrastructure LF Meeting 20150428
InterMine Infrastructure LF Meeting 20150428InterMine Infrastructure LF Meeting 20150428
InterMine Infrastructure LF Meeting 20150428
Vivek Krishnakumar
 
Play framework
Play frameworkPlay framework
Play framework
Keshaw Kumar
 
SFDC Deployments
SFDC DeploymentsSFDC Deployments
SFDC Deployments
Sujit Kumar
 
PyPedia
PyPediaPyPedia
PyPedia
kantale
 
Ploneforwebdev
PloneforwebdevPloneforwebdev
Ploneforwebdev
brighteyes
 
Codeigniter
CodeigniterCodeigniter
Codeigniter
ShahRushika
 
Owner - Java properties reinvented.
Owner - Java properties reinvented.Owner - Java properties reinvented.
Owner - Java properties reinvented.
Luigi Viggiano
 
Collection
CollectionCollection
Collection
abhay singh
 
Write code that writes code!
Write code that writes code!Write code that writes code!
Write code that writes code!
Jason Feinstein
 
Write code that writes code! A beginner's guide to Annotation Processing - Ja...
Write code that writes code! A beginner's guide to Annotation Processing - Ja...Write code that writes code! A beginner's guide to Annotation Processing - Ja...
Write code that writes code! A beginner's guide to Annotation Processing - Ja...
DroidConTLV
 
DSpace 4.2 Transmission: Import/Export
DSpace 4.2 Transmission: Import/ExportDSpace 4.2 Transmission: Import/Export
DSpace 4.2 Transmission: Import/Export
DuraSpace
 
China Science Challenge
China Science ChallengeChina Science Challenge
China Science Challenge
remko caprio
 
SgCodeJam24 Workshop
SgCodeJam24 WorkshopSgCodeJam24 Workshop
SgCodeJam24 Workshop
remko caprio
 

Similar to Biothings presentation (20)

People aggregator
People aggregatorPeople aggregator
People aggregator
 
Opinioz_intern
Opinioz_internOpinioz_intern
Opinioz_intern
 
IBM File Net P8
IBM File Net P8IBM File Net P8
IBM File Net P8
 
NCBO Technology
NCBO TechnologyNCBO Technology
NCBO Technology
 
Advanced guide to develop ajax applications using dojo
Advanced guide to develop ajax applications using dojoAdvanced guide to develop ajax applications using dojo
Advanced guide to develop ajax applications using dojo
 
Semantic web technologies applied to bioinformatics and laboratory data manag...
Semantic web technologies applied to bioinformatics and laboratory data manag...Semantic web technologies applied to bioinformatics and laboratory data manag...
Semantic web technologies applied to bioinformatics and laboratory data manag...
 
CTS2 Development Framework In Action
CTS2 Development Framework In ActionCTS2 Development Framework In Action
CTS2 Development Framework In Action
 
InterMine Infrastructure LF Meeting 20150428
InterMine Infrastructure LF Meeting 20150428InterMine Infrastructure LF Meeting 20150428
InterMine Infrastructure LF Meeting 20150428
 
Play framework
Play frameworkPlay framework
Play framework
 
SFDC Deployments
SFDC DeploymentsSFDC Deployments
SFDC Deployments
 
PyPedia
PyPediaPyPedia
PyPedia
 
Ploneforwebdev
PloneforwebdevPloneforwebdev
Ploneforwebdev
 
Codeigniter
CodeigniterCodeigniter
Codeigniter
 
Owner - Java properties reinvented.
Owner - Java properties reinvented.Owner - Java properties reinvented.
Owner - Java properties reinvented.
 
Collection
CollectionCollection
Collection
 
Write code that writes code!
Write code that writes code!Write code that writes code!
Write code that writes code!
 
Write code that writes code! A beginner's guide to Annotation Processing - Ja...
Write code that writes code! A beginner's guide to Annotation Processing - Ja...Write code that writes code! A beginner's guide to Annotation Processing - Ja...
Write code that writes code! A beginner's guide to Annotation Processing - Ja...
 
DSpace 4.2 Transmission: Import/Export
DSpace 4.2 Transmission: Import/ExportDSpace 4.2 Transmission: Import/Export
DSpace 4.2 Transmission: Import/Export
 
China Science Challenge
China Science ChallengeChina Science Challenge
China Science Challenge
 
SgCodeJam24 Workshop
SgCodeJam24 WorkshopSgCodeJam24 Workshop
SgCodeJam24 Workshop
 

Recently uploaded

Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
MysoreMuleSoftMeetup
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
iammrhaywood
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
مصحف القراءات العشر أعد أحرف الخلاف سمير بسيوني.pdf
مصحف القراءات العشر   أعد أحرف الخلاف سمير بسيوني.pdfمصحف القراءات العشر   أعد أحرف الخلاف سمير بسيوني.pdf
مصحف القراءات العشر أعد أحرف الخلاف سمير بسيوني.pdf
سمير بسيوني
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
haiqairshad
 
Benner "Expanding Pathways to Publishing Careers"
Benner "Expanding Pathways to Publishing Careers"Benner "Expanding Pathways to Publishing Careers"
Benner "Expanding Pathways to Publishing Careers"
National Information Standards Organization (NISO)
 
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptxBIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
RidwanHassanYusuf
 
HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.
deepaannamalai16
 
SWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptxSWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptx
zuzanka
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Denish Jangid
 
Nutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour TrainingNutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour Training
melliereed
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
Celine George
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
Nguyen Thanh Tu Collection
 
Electric Fetus - Record Store Scavenger Hunt
Electric Fetus - Record Store Scavenger HuntElectric Fetus - Record Store Scavenger Hunt
Electric Fetus - Record Store Scavenger Hunt
RamseyBerglund
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
Celine George
 
Pharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brubPharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brub
danielkiash986
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
 
Stack Memory Organization of 8086 Microprocessor
Stack Memory Organization of 8086 MicroprocessorStack Memory Organization of 8086 Microprocessor
Stack Memory Organization of 8086 Microprocessor
JomonJoseph58
 
Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...
PsychoTech Services
 

Recently uploaded (20)

Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
مصحف القراءات العشر أعد أحرف الخلاف سمير بسيوني.pdf
مصحف القراءات العشر   أعد أحرف الخلاف سمير بسيوني.pdfمصحف القراءات العشر   أعد أحرف الخلاف سمير بسيوني.pdf
مصحف القراءات العشر أعد أحرف الخلاف سمير بسيوني.pdf
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
 
Benner "Expanding Pathways to Publishing Careers"
Benner "Expanding Pathways to Publishing Careers"Benner "Expanding Pathways to Publishing Careers"
Benner "Expanding Pathways to Publishing Careers"
 
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptxBIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
 
HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.
 
SWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptxSWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptx
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
 
Nutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour TrainingNutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour Training
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
 
Electric Fetus - Record Store Scavenger Hunt
Electric Fetus - Record Store Scavenger HuntElectric Fetus - Record Store Scavenger Hunt
Electric Fetus - Record Store Scavenger Hunt
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
 
Pharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brubPharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brub
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
 
Stack Memory Organization of 8086 Microprocessor
Stack Memory Organization of 8086 MicroprocessorStack Memory Organization of 8086 Microprocessor
Stack Memory Organization of 8086 Microprocessor
 
Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...
 

Biothings presentation

  • 2. Motivation • Isolate the common aspects of MyGene and MyVariant codebases and make them available in a separate framework: biothings.api • Allows easier development of additional biothings APIs (Disease, Drug/Chemical, GO, Species… -> JSON, aggregate on a single field) • Allows easier maintenance and development of current biothings (gene, variant).
  • 3. System Overview • The tornado HTTP server consists of handlers that contain the code to run when a particular URL pattern is matched, e.g. /variant/, or /metadata • The biothing codebase essentially contains the connection between the appropriate Tornado HTTP Request Handler for a request and the elasticsearch query that executes that request
  • 4. Biothings – HTTP Handling • tornado.web.RequestHandler: base tornado class for HTTP request handling. Important class methods: get/post, get_arguments, write • biothings.www.helper.BaseHandler: contains methods common to all biothings RequestHandlers. Important class methods: get_query_params, return_json • biothings.www.api.handlers.QueryHandler: contains methods to implement the biothings query endpoint. Important class methods: get, post, _examine_kwargs • biothings.www.api.handlers.BiothingHandler: contains methods to implement the biothings annotation endpoint. Important class methods: get, post, _examine_kwargs • biothings.www.api.handlers.MetaDataHandler: contains methods to implement the metadata endpoint • biothings.www.api.handlers.StatusHandler: contains methods to implement a status endpoint for AWS ELB
  • 5. Biothings – HTTP Handling • biothings.www.api.handlers.BiothingHandler: – GET request (e.g. /variant/chr6:g.152708291G>A) – POST request (e.g. /variant/)
  • 6. Biothings – HTTP Handling • biothings.www.api.handlers.QueryHandler: – GET request (e.g. /query?q=_exists_:dbsnp) – POST request (e.g. /query/)
  • 7. Biothings – Elasticsearch query • biothings.www.api.es.ESQuery – contains the python code for constructing the elasticsearch query and formatting the resulting data – query(q, **kwargs) – Contains the elasticsearch query to run with data obtained from a GET or POST to the /query/ endpoint. – get_biothing(bid, **kwargs) – Contains the elasticsearch query to run with data obtained from a GET to the /annotation/ endpoint. – mget_biothings(bid_list, **kwargs) – Contains the elasticsearch query to run with data obtained from a POST to the /annotation/ endpoint. – _cleaned_res(res) – Contains the code to format the return object for get_biothing and mget_biothings. – _cleaned_res2(res) – Contains the code to format the return object for query. – _get_biothingdoc(hit) – Contains the code to format a single biothing object from any elasticsearch query. Called by _cleaned_res and _cleaned_res2. – _modify_biothingdoc(doc) – Contains the code to modify a biothing_doc. Called in _get_biothingdoc. Currently empty -> for subclassing.
  • 8. Biothings - Settings • Problem: Until now, we have left out the problem of how to refer to things that MUST be project specific (e.g., the name of the elasticsearch index to search, the type of the document, etc). How do we do this? • Solution: We make a settings module in biothings that all code within biothings refers to. That module looks for an environment variable called BIOTHING_SETTINGS with the name of a module that can be imported to set project specific variables. – export BIOTHING_SETTINGS = ‘biothings.config’ • Similar to Django.
  • 10. Biothings – Project template • At this point, we have the tools necessary to easily create and subclass 4 types of biothings handlers (BiothingHandler, QueryHandler, MetaDataHandler, StatusHandler), and the elasticsearch query class (ESQuery) • Could definitely stop here and have a useful tool, but we wanted to make it even easier to create a new project (also enforces a uniform project structure across all biothings APIs). • To do this we have a project template folder containing the project directory structure and some skeleton code: – config.py, – URL patterns to Handlers connection – Handlers to ESQuery connection
  • 11. Biothings - Project template • To create the actual project directory from the template, we wrote a small function: start-project.py – Usage: python start-project.py <path-to-project- directory> <biothing-object-name> – python start-project.py ~ variant • Any folder or file in the template directory will be created in the project directory. The contents of any file are passed through the python String.template function before they are created in the project directory.
  • 18. Recreating MyVariant.info using biothings.api • Recreated current MyVariant.info service using the biothings.api framework – Very little extra code required (~100 lines) – Less than a day of time to create the web front end from start. – https://github.com/cyrus0824/myvariant.info_new • Seems disingenuous to gauge the utility of a tool by recreating a codebase if that tool was itself created from the codebase => Should try implementing other APIs, especially MyGene.info (has more varied gene specific query options), and modify biothings as needed.
  • 19. Future work • Integrate data load and data index functions into biothings • Documentation! – Projects like this need very good documentation to be of any use to an API developer (on the level of tornado’s excellent documentation: http://www.tornadoweb.org/en/stable/web.html) • Auto-generate clients (python client, R client) • Auto-generate ansible-playbook to create cluster hardware on AWS • One-click API…