Package: saber
SaberSaber(SequenceAnnotator forBiomedicalEntities andRelations) is a deep-learning based tool forinformation extractionin the biomedical domain.Installation•Quickstart•DocumentationInstallationTo install Saber, you will needpython>=3.5. If not already installed,python>=3.5can be installed viaTheofficial installerHomebrew, on MacOS (brew install python3)Miniconda3/Anaconda3(OPTIONAL) Activate your virtual environment (seebelowfor help)$condaactivatesaber# Notice your command prompt has changed to indicate that the environment is active(saber)$then install Saber(saber)$pipinstallsaberTo get the latest development version of Saber, install it right from this repository withpip(saber)$pipinstallhttps://github.com/BaderLab/saber.gitor by cloning the repository and then usingpipto install the package(saber)$gitclonehttps://github.com/BaderLab/saber.git(saber)$cdsaber(saber)$pipinstall.For now, you will need to install the requiredSpacymodel and thekeras-contribrepository (even if you installed withpip install saber)# keras-contrib(saber)$pipinstallgit+https://www.github.com/keras-team/keras-contrib.git# NeuralCoref medium model built on top of Spacy, this might take a few minutes to download!(saber)$pipinstallhttps://github.com/huggingface/neuralcoref-models/releases/download/en_coref_md-3.0.0/en_coref_md-3.0.0.tar.gz(OPTIONAL) Creating and activating virtual environmentsWhen usingpipit is generally recommended to install packages in a virtual environment to avoid modifying system state. To create a virtual environment namedsaberUsing virtualenv or venvUsingvirtualenv$virtualenv--python=python3/path/to/new/venv/saberUsingvenv$python3-mvenv/path/to/new/venv/saberNext, you need to activate the environment$source/path/to/new/venv/saber/bin/activate# Notice your command prompt has changed to indicate that the environment is active(saber)$Using CondaIf you useConda, you can create an environment namedsaberby running$condacreate-nsaberpython=3.6then activate the environment with$condaactivatesaber# Again, your command prompt should change to indicate that the environment is active(saber)$QuickstartIf your goal is to use Saber to annotate biomedical text, then you can either use theweb-serviceor apre-trained model. If you simply want to check Saber out, without installing anything locally, try theGoogle Colaboratorynotebook.Google ColaboratoryThe fastest way to check out Saber is by following along with the Google Colaboratory notebook (). In order to be able to run the cells, select "Open in Playground" or, alternatively, save a copy to your own Google Drive account (File > Save a copy in Drive).Web-serviceTo use Saber as alocalweb-service, run(saber) $ python -m saber.cli.appor, if you prefer, you can pull & run the Saber image fromDocker Hub# Pull Saber image from Docker Hub$dockerpullpathwaycommons/saber# Run docker (use `-dt` instead of `-it` to run container in background)$dockerrun-it--rm-p5000:5000--namesaberpathwaycommons/saberThere are currently two endpoints,/annotate/textand/annotate/pmid. Both expect aPOSTrequest with a JSON payload, e.g.,{"text":"The phosphorylation of Hdm2 by MK2 promotes the ubiquitination of p53."}or{"pmid":11835401}For example, running the web-service locally and usingcURL$curl-XPOST'http://localhost:5000/annotate/text'\--data'{"text": "The phosphorylation of Hdm2 by MK2 promotes the ubiquitination of p53."}'Documentation for the Saber web-service API can be foundhere.Pre-trained modelsFirst, import theSaberclass. This is the interface to Saberfromsaber.saberimportSaberTo load a pre-trained model, first create aSaberobjectsaber=Saber()and then load the model of our choicesaber.load('PRGE')You can see all the pre-trained models in theweb-service API docsor, thesaber/pretrained_modelsfolder in this repository, or by running the following line of codefromsaber.constantsimportENTITIES;print(list(ENTITIES.keys()))To annotate text with the model, just call theSaber.annotate()methodsaber.annotate("The phosphorylation of Hdm2 by MK2 promotes the ubiquitination of p53.")See thedocumentationfor more details.DocumentationDocumentation for the Saber API can be foundhere. The web-service API has its own documentationhere. Finally, we provide ajupyter notebookwhich introduces the main ways of using Saber. Seeherefor help setting upJupyterLab.