Skip to content

Map Medical Subject Headings (MeSH) to UMLS

nbviewer

This example demonstrates the typical workflow to populate a MESH2UMLS database table relating all concepts associated with all MeSH terms in the input database.

The following backends are supported for storing the results:

  • MySQL
  • SQLite

Set Up

using SQLite
using MySQL
using BioMedQuery.DBUtils
using BioMedQuery.Processes
using BioServices.UMLS

Credentials are environment variables (e.g set in your .juliarc.jl)

umls_user = ENV["UMLS_USER"];
umls_pswd = ENV["UMLS_PSSWD"];

results_dir = ".";

Using MySQL as a backend

Note: this example reuses the MySQL DB from the PubMed Search and Save example.

Create MySQL DB connection

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);

Map MeSH to UMLS

@time map_mesh_to_umls_async!(db_mysql, umls_user, umls_pswd; append_results=false, timeout=3);
----------Matching MESH to UMLS-----------
String["Adult", "Aged", "Aged, 80 and over", "Analysis of Variance", "Body Weight", "C-Reactive Protein", "Child", "Cross-Sectional Studies", "Fatigue", "Female", "Fibromyalgia", "Germany", "Health Status", "Humans", "Japan", "Male", "Middle Aged", "Nutrition Surveys", "Obesity", "Pain", "Pain Measurement", "Physical Fitness", "Prognosis", "Quality of Life", "Surveys and Questionnaires", "Reference Values", "Risk Factors", "ROC Curve", "Severity of Illness Index", "Sports", "Television", "Thyrotropin", "Biomarkers", "Weight Gain", "Exercise", "Body Mass Index", "Incidence", "Prevalence", "Logistic Models", "Odds Ratio", "Case-Control Studies", "Age Distribution", "Sex Distribution", "Sleep Apnea, Obstructive", "Metabolic Syndrome", "Overweight", "Waist Circumference", "Young Adult", "Obesity, Abdominal", "Republic of Korea", "Sedentary Lifestyle", "Pediatric Obesity"]
INFO: UTS: Requesting new TGT
INFO: Descriptor 7 out of 52: Child
INFO: Descriptor 21 out of 52: Pain Measurement
INFO: Descriptor 39 out of 52: Logistic Models
INFO: Descriptor 8 out of 52: Cross-Sectional Studies
INFO: Descriptor 40 out of 52: Odds Ratio
INFO: Descriptor 13 out of 52: Health Status
INFO: Descriptor 33 out of 52: Biomarkers
INFO: Descriptor 29 out of 52: Severity of Illness Index
INFO: Descriptor 17 out of 52: Middle Aged
INFO: Descriptor 12 out of 52: Germany
INFO: Descriptor 48 out of 52: Young Adult
INFO: Descriptor 26 out of 52: Reference Values
INFO: Descriptor 5 out of 52: Body Weight
INFO: Descriptor 24 out of 52: Quality of Life
INFO: Descriptor 18 out of 52: Nutrition Surveys
INFO: Descriptor 19 out of 52: Obesity
INFO: Descriptor 11 out of 52: Fibromyalgia
INFO: Descriptor 30 out of 52: Sports
INFO: Descriptor 28 out of 52: ROC Curve
INFO: Descriptor 50 out of 52: Republic of Korea
INFO: Descriptor 35 out of 52: Exercise
INFO: Descriptor 20 out of 52: Pain
INFO: Descriptor 44 out of 52: Sleep Apnea, Obstructive
INFO: Descriptor 49 out of 52: Obesity, Abdominal
INFO: Descriptor 4 out of 52: Analysis of Variance
INFO: Descriptor 10 out of 52: Female
INFO: Descriptor 1 out of 52: Adult
INFO: Descriptor 3 out of 52: Aged, 80 and over
INFO: Descriptor 2 out of 52: Aged
INFO: Descriptor 25 out of 52: Surveys and Questionnaires
INFO: Descriptor 42 out of 52: Age Distribution
INFO: Descriptor 22 out of 52: Physical Fitness
INFO: Descriptor 23 out of 52: Prognosis
INFO: Descriptor 15 out of 52: Japan
INFO: Descriptor 16 out of 52: Male
INFO: Descriptor 45 out of 52: Metabolic Syndrome
INFO: Descriptor 51 out of 52: Sedentary Lifestyle
INFO: Descriptor 27 out of 52: Risk Factors
INFO: Descriptor 41 out of 52: Case-Control Studies
INFO: Descriptor 31 out of 52: Television
INFO: Descriptor 38 out of 52: Prevalence
INFO: Descriptor 34 out of 52: Weight Gain
INFO: Descriptor 43 out of 52: Sex Distribution
INFO: Descriptor 36 out of 52: Body Mass Index
INFO: Descriptor 6 out of 52: C-Reactive Protein
INFO: Descriptor 14 out of 52: Humans
INFO: Descriptor 37 out of 52: Incidence
INFO: Descriptor 9 out of 52: Fatigue
INFO: Descriptor 47 out of 52: Waist Circumference
INFO: Descriptor 32 out of 52: Thyrotropin
INFO: Descriptor 46 out of 52: Overweight
INFO: Descriptor 51 out of 52: Sedentary Lifestyle
INFO: Descriptor 52 out of 52: Pediatric Obesity
121.707381 seconds (582.61 k allocations: 31.890 MiB, 0.01% gc time)

Explore the output table

db_query(db_mysql, "SELECT * FROM mesh2umls")
56×2 DataFrames.DataFrame
│ Row │ mesh                       │ umls                            │
├─────┼────────────────────────────┼─────────────────────────────────┤
│ 1   │ Adult                      │ Age Group                       │
│ 2   │ Age Distribution           │ Quantitative Concept            │
│ 3   │ Aged                       │ Organism Attribute              │
│ 4   │ Aged, 80 and over          │ Age Group                       │
│ 5   │ Analysis of Variance       │ Quantitative Concept            │
│ 6   │ Biomarkers                 │ Clinical Attribute              │
│ 7   │ Body Mass Index            │ Diagnostic Procedure            │
│ 8   │ Body Weight                │ Organism Attribute              │
⋮
│ 48  │ Sports                     │ Daily or Recreational Activity  │
│ 49  │ Surveys and Questionnaires │ Research Activity               │
│ 50  │ Television                 │ Manufactured Object             │
│ 51  │ Thyrotropin                │ Amino Acid, Peptide, or Protein │
│ 52  │ Thyrotropin                │ Hormone                         │
│ 53  │ Thyrotropin                │ Pharmacologic Substance         │
│ 54  │ Waist Circumference        │ Clinical Attribute              │
│ 55  │ Weight Gain                │ Finding                         │
│ 56  │ Young Adult                │ Age Group                       │

Using SQLite as a backend

Note: this example reuses the MySQL DB from the PubMed Search and Save example.

Create SQLite DB connection

db_path = "$(results_dir)/pubmed_obesity_2010_2012.db";
db_sqlite = SQLite.DB(db_path);

Map MeSH to UMLS

```@example 2_pubmed_mesh_to_umls_map @time map_mesh_to_umls_async!(db_sqlite, umls_user, umls_pswd; append_results=false, timeout=3);

<a id='Explore-the-output-table-2'></a>

#### Explore the output table


```julia
db_query(db_sqlite, "SELECT * FROM mesh2umls;")
0×2 DataFrames.DataFrame

This page was generated using Literate.jl.