Package: biolexica
Biolexicabiolexicahelps generate and apply coherent biomedical lexica. It takes care of the following:Getting names and synonyms from a diverse set of inputs (ontologies, databases, custom)
usingpyobo,bioontologies,biosynonyms, and more.Merging equivalent terms to best take advantage of different synonyms for the same term from different sources
usingsemra.Generating lexical index and doing NER usingGildaImportantly, we pre-define lexica for several entity types that can be readily used with Gilda in
thelexica/folder including:Cells and cell linesDiseases, conditions, and other phenotypesAnatomical terms, tissues, organ systems, etc.Getting StartedLoad a pre-defined grounder like this:importbiolexicagrounder=biolexica.load_grounder("phenotype")>>>grounder.get_best_match("Alzheimer's disease")Match(reference=Reference(prefix='doid',identifier='10652'),name="Alzheimer's disease",score=0.7778)>>>grounder.annotate("Clinical trials for reducing Aβ levels in Alzheimer's disease have been controversial.")[Annotation(text="Alzheimer's disease",start=42,end=61,match=Match(reference=Reference(prefix='doid',identifier='10652'),name="Alzheimer's disease",score=0.7339))]Note: Biolexica constructs extended version ofgilda.Grounderthat has convenience functions and a more
simple match data model encoded with Pydantic.Search PubMed for abstracts and annotate them using a given grounder with:importbiolexicafrombiolexica.literatureimportannotate_abstracts_from_searchgrounder=biolexica.load_grounder("phenotype")pubmed_query="alzheimer's disease"annotations=annotate_abstracts_from_search(pubmed_query,grounder=grounder,limit=30)🚀 InstallationThe most recent release can be installed fromPyPIwith:pipinstallbiolexicaThe most recent code and data can be installed directly from GitHub with:pipinstallgit+https://github.com/biopragmatics/biolexica.git👐 ContributingContributions, whether filing an issue, making a pull request, or forking, are appreciated. SeeCONTRIBUTING.mdfor more information
on getting involved.👋 Attribution⚖️ LicenseThe code in this package is licensed under the MIT License.🍪 CookiecutterThis package was created with@audreyfeldroy'scookiecutterpackage using@cthoyt'scookiecutter-snekpacktemplate.🛠️ For DevelopersSee developer instructionsThe final section of the README is for if you want to get involved by making a code contribution.Development InstallationTo install in development mode, use the following:gitclonegit+https://github.com/biopragmatics/biolexica.gitcdbiolexica
pipinstall-e.🥼 TestingAfter cloning the repository and installingtoxwithpip install tox, the unit tests in thetests/folder can be
run reproducibly with:toxAdditionally, these tests are automatically re-run with each commit in aGitHub Action.📖 Building the DocumentationThe documentation can be built locally using the following:gitclonegit+https://github.com/biopragmatics/biolexica.gitcdbiolexica
tox-edocs
opendocs/build/html/index.htmlThe documentation automatically installs the package as well as thedocsextra specified in thesetup.cfg.sphinxplugins
liketexextcan be added there. Additionally, they need to be added to theextensionslist indocs/source/conf.py.The documentation can be deployed toReadTheDocsusingthis guide.
The.readthedocs.ymlYAML file contains all the configuration you'll need.
You can also set up continuous integration on GitHub to check not only that
Sphinx can build the documentation in an isolated environment (i.e., withtox -e docs-test)
but also thatReadTheDocs can build it too.📦 Making a ReleaseAfter installing the package in development mode and installingtoxwithpip install tox, the commands for making a new release are contained within thefinishenvironment
intox.ini. Run the following from the shell:tox-efinishThis script does the following:UsesBump2Versionto switch the version number in thesetup.cfg,src/biolexica/version.py, anddocs/source/conf.pyto not have the-devsuffixPackages the code in both a tar archive and a wheel usingbuildUploads to PyPI usingtwine. Be sure to have a.pypircfile
configured to avoid the need for manual input at this stepPush to GitHub. You'll need to make a release going with the commit where the version was bumped.Bump the version to the next patch. If you made big changes and want to bump the version by minor, you can
usetox -e bumpversion -- minorafter.