Unified Medical Language (UMLS) Filtering
This example demonstrates how to obtain an occurrence matrix associated with a UMLS concept in a previously obtained pubmed/medline search.
Note: This example uses the database created and updated by:
- Examples / Pubmed Search and Save
- Exmaples / MeSH/UMLS Map
The following backends are supported for retieving the prior information:
- MySQL
- SQLite
Set Up
using BioMedQuery.Processes using BioMedQuery.PubMed using MySQL using SQLite results_dir = "."; umls_concept = "Disease or Syndrome";
MySQL backend
Connecting to MySQL database that was created in pubmed_search_and_save example
host = "127.0.0.1"; mysql_usr = "root"; mysql_pswd = ""; dbname = "pubmed_obesity_2010_2012"; db_mysql = MySQL.connect(host, mysql_usr, mysql_pswd, db=dbname);
Getting the descriptor to index dictionary and the occurence matrix
@time labels2ind, occur = umls_semantic_occurrences(db_mysql, umls_concept);
Filter mesh query string : SELECT mesh FROM mesh2umls WHERE umls IN ( "Disease or Syndrome" ) ------------------------------------------------------------- Found 5 articles with valid descriptors ------------------------------------------------------------- 0.005654 seconds (2.62 k allocations: 163.453 KiB)
Descriptor to Index Dictionary
labels2ind
Dict{String,Int64} with 5 entries: "Obesity" => 1 "Pediatric Obesity" => 2 "Sleep Apnea, Obstructive" => 3 "Metabolic Syndrome" => 4 "Fibromyalgia" => 5
Output Data Matrix
full(occur)
5×5 Array{Float64,2}: 1.0 1.0 0.0 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 1.0 0.0 0.0 0.0 0.0
SQLite backend
Connecting to SQLite database that was created in pubmed_search_and_save example
db_path = "$(results_dir)/pubmed_obesity_2010_2012.db"; db_sqlite = SQLite.DB(db_path);
Getting the descriptor to index dictionary and occurence matrix
```@example 3_umls_semantic_occurrences @time labels2ind, occur = umls_semantic_occurrences(db_sqlite, umls_concept);
Descriptor to Index Dictionary ```julia labels2ind
Dict{String,Int64} with 5 entries: "Obesity" => 1 "Pediatric Obesity" => 2 "Sleep Apnea, Obstructive" => 3 "Metabolic Syndrome" => 4 "Fibromyalgia" => 5
Output Data Matrix
full(occur)
5×5 Array{Float64,2}: 1.0 1.0 0.0 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 1.0 0.0 0.0 0.0 0.0
This page was generated using Literate.jl.