Saltar a contenido

Python

Population Delimitation Practice

I have developed a population genetics practice where students are tasked with delimiting genetic groups. They must do this by analyzing genetic structure alongside other variables, such as taxa and the country of origin.

The primary objective is to teach students that genetic structure alone is often insufficient for defining populations; context and additional biological data are essential.

The practice is a web application hosted on our laboratory’s static site and developed using marimo. There is quite a bit of "magic" happening under the hood to make this work seamlessly in the browser:

  • Pyodide: A Python interpreter compiled to WebAssembly, allowing the logic to run entirely client-side.

  • 3D Scatter Widget: A custom widget I developed using Python and TypeScript. This was my first serious foray into JavaScript/TypeScript, and I honestly couldn't have built it without the help of AI tools.

Scatter 3D notebook widget

For the longest time I have needed a program to plot scatter plots in 3D with the ability of selecting points using a lasso tool. For instance, I needed to select some individuals in a plot showing genetic distances in order to know its geographical origin.

During a long time we used CurlyWhirly, but that software is not maintained anymore, then we moved to glue, but I always found that software a little too cumbersome for my taste. Many times I've looked for alternatives, but I found none.

Alas, I was resigned, but last december I heard about anywidget in the Talk Python Podcast, a library created to ease the development of marimo and jupyter notebook widgets. I have never programmed anything serious in Javascript, but I thought that maybe with the help of an AI tool and anywidget I could try to build a 3D scatterplot notebook widget to my liking, and I did it!

You can download the widget from its GitHub repository or from PyPI. We have already used it in our research on the history of the tomato.

uv seminar

uv seminar announcement

Today we will talk about uv, virtual environments, package dependencies, reproducibility and Python project management.

All the seminar materials can be found in its GitHub repository.

The seminar will be held in IBMCP at UPV at the Ricardo Flores room and is open for anybody interested in Python that is not yet familiar with uv.

uv seminar

I have prepared a seminar about Python project management with uv. My idea is to teach it to PhD student's and scientists that are already using Python, but that are not yet aware of the modern tooling that could help them with reproducibility and package management.

The seminar will be held in IBMCP at UPV on the 18th of november and will be open for anybody interested.