close
close

first Drop

Com TW NOw News 2024

biorecap: an R package for summarizing bioRxiv preprints with a local LLM
news

biorecap: an R package for summarizing bioRxiv preprints with a local LLM

(This article was first published on Have genetics doneand kindly contributed to R-bloggers). (You can report problems with the content of this page here)


Want to share your content on R-bloggers? Click here if you have a blog, or here if you don’t.

This is a repeat of my newsletter, where from now on I will post the following:

https://blog.stephenturner.us/p/biorecap-r-package-for-summarizing-biorxiv-preprints-local-llm

  • I wrote an R package that summarizes recent bioRxiv preprints using a locally running LLM via Ollama+ollamar, and produces a summary HTML report from a parameterized RMarkdown template. The package is on GitHub and you can install it with devtools: https://github.com/stephenturner/biorecap.

  • I published a paper about the package on arXiv: Turner, SD (2024). biorecap: an R package for summarizing bioRxiv preprints with a local LLM. arXiv2408.11707. https://doi.org/10.48550/arXiv.2408.11707.

  • I wrote both the package and the article with help from LLMs: GitHub copilot for the documentation, llama3.1:70b for the testing, llama3.1:405b via HuggingFace assistants for drafting, and GPT-4o for editing.

I recently started exploring prompting a local LLM (e.g. Llama3.1) from R via Ollama. Last week I wrote about how to do thiswith a couple of made-up examples: (1) trying to figure out what’s interesting about a set of genes, and (2) summarizing a set of preprints retrieved from the bioRxiv RSS feed. The gene set analysis was really made up — as I said in the footnote to that messageYou would actually never want to perform gene set analysis in this manner, as there are plenty of well-understood, principle-based approaches to gene set analysis.

The second example wasn’t so contrived. I subscribe to bioRxiv’s RSS feeds, along with many other journals and blogs in genetics, bioinformatics, data science, synthetic biology, and more. The flood of new preprints and peer-reviewed papers relevant to my work is relentless. Late last year bioRxiv has started adding AI summaries to newly published preprintsbut this required multiple clicks to get from my RSS feed to the article landing page, and another to click through to the AI ​​summary. I wanted a way to give me a quick TL;DR of all the recent articles published in certain fields (e.g. bioinformatics, genomics, or synthetic biology).

Shortly after I put together that unique demo, on a sultry Sunday afternoon in Virginia where it was too hot to do anything outside, I took the code from that post, generalized it a bit, and created the biorecap package: https://github.com/stephenturner/biorecap.

You can install it with devtools/remotes:

remotes::install_github("stephenturner/biorecap", 
                        dependencies=TRUE)

Create a report with two-sentence summaries of recent papers published in the bioinformatics, genomics, and synthetic biology sections, using llama3.1:8b running locally on your laptop:

my_subjects 

This report will look different each time you run it, depending on what’s been published that day in the sections you’re interested in.

Figure 1 from Turner 2024 arXiv: Example biorecap report for bioinformatics, genomics, and synthetic biology from August 6, 2024.

The package documentation provides further instructions on usage.

I mentioned I used LLMs to help write this package. I started out using Positron for package development, but quickly fell back to RStudio because I wanted GitHub copilot integration. Among other things, Copilot is great for quickly writing Roxygen documentation for relatively simple functions. I also used llama3.1:70b running locally via Open WebUI to help me write some of the unit tests using testthat. Starting from the code I worked out in the previous post, it took about 2 hours to get the package working, and another hour or so to write documentation and tests and set up GitHub actions for pkgdown deployment and R CMD checks on PRs to main.

I published a short paper about the package on arXiv: Turner, S. D. (2024). biorecap: an R package for summarizing bioRxiv preprints with a local LLM. arXiv, 2408.11707. https://doi.org/10.48550/arXiv.2408.11707.

biorecap-preprint

266KB ∙ PDF file

Download

The biorecap preprint published on arXiv

I used two LLMs to assist me in writing the package, which itself uses an LLM to summarize research published on bioRxiv. It only makes sense to close the circle and use an LLM to help me write a preprint to publish on arXiv describing the software.

I’ll write a post soon about how to set up a llama3.1:405b-powered chatbot on HuggingFace connected to a GitHub repository to be able to ask questions about the codebase in that repo. It’s free and takes about 60 seconds or less. I started out doing this, asking for help crafting a narrative outline and introduction section for a paper based on the code in the repo. I ended up scrapping this and writing most of the first draft text myself, then using GPT-4o to help with editing, tone, and length reduction. It’s hard to exactly put my finger on it, but what I ended up with still had that feeling of “sounds like it was written by ChatGPT.” I did some of the final editing on my own, and used Mike Mahoney’s arXiv template Quarto plugin to write and typeset the final document.