---
title: "NER using MetaMAP"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{NER using MetaMAP}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

Go to the online MetaMap service (batch mode): <https://ii.nlm.nih.gov/Batch/UTS_Required/metamap.shtml>

![](https://github.com/celehs/PheCAP/raw/master/include/img/Screenshot_MetaMap_Website.png)

MetaMap will not run on text that contains non-ascii characters, so remove them before using MetaMap. Non-ascii characters can be identified with the regular expression “[^\x00-\x7F]”.

In **Output/Display Options**, check “Show CUIs (-I)”.

In **I would like to only use specific Semantic Types**, check the checkbox, and select the semantic types relevant to the phenotype. For example, use 

acab, aapp, anab, antb, biof, bacs, bodm, chem, chvf, chvs, clnd, cgab, diap, dsyn, elii, enzy, fndg, hops, horm, imft, irda, inbe, inpo, inch, lbpr, lbtr, medd, mobd, neop, nnon, orch, patf, phsu, phpr, rcpt, sosy, topp, vita

to select the following:

Acquired Abnormality; Amino Acid, Peptide, or Protein; Anatomical Abnormality; Antibiotic; Biologic Function; Biologically Active Substance; Biomedical or Dental Material; Chemical; Chemical Viewed Functionally; Chemical Viewed Structurally; Clinical Drug; Congenital Abnormality; Diagnostic Procedure; Disease or Syndrome; Element, Ion, or Isotope; Enzyme; Finding; Hazardous or Poisonous Substance; Hormone; Immunologic Factor; Indicator, Reagent, or Diagnostic Aid; Individual Behavior; Injury or Poisoning; Inorganic Chemical; Laboratory or Test Result; Laboratory Procedure; Medical Device; Mental or Behavioral Dysfunction; Neoplastic Process; Nucleic Acid, Nucleoside, or Nucleotide; Organic Chemical; Pathologic Function; Pharmacologic Substance; Phenomenon or Process; Receptor; Sign or Symptom; Therapeutic or Preventive Procedure; Vitamin.

Click **Submit Batch MetaMap**. An email will notify you once MetaMap has finished processing the file. Download “text.out” and rename it, such as “Wikipedia.out”. Create a folder and put all the output files in it.

![](https://github.com/celehs/PheCAP/raw/master/include/img/Screenshot_MetaMap_WikiOutput.png)

<br>

As an example, 5 source articles on CAD can be uploaded to the MetaMAP website: 
<a href="https://github.com/celehs/PheCAP/raw/master/include/CAD_article_wiki.txt" download>CAD_article_wiki.txt</a>, 
<a href="https://github.com/celehs/PheCAP/raw/master/include/CAD_article_medscape.txt" download>CAD_article_medscape.txt</a>, 
<a href="https://github.com/celehs/PheCAP/raw/master/include/CAD_article_medline.txt" download>CAD_article_medline.txt</a>, 
<a href="https://github.com/celehs/PheCAP/raw/master/include/CAD_article_merck.txt" download>CAD_article_merck.txt</a>, 
<a href="https://github.com/celehs/PheCAP/raw/master/include/CAD_article_mayo.txt" download>CAD_article_mayo.txt</a>. 

Run <a href="https://github.com/celehs/PheCAP/raw/master/include/MetaMap_postprocessing.R" download>MetaMap_postprocessing.R</a> to extract the CUIs from the output and select by majority voting.

The CAD dictionary generated by MetaMAP can be found in <a href="https://github.com/celehs/PheCAP/raw/master/include/CAD_dict.txt" download>CAD_dict.txt</a>.
