Posts

Condition Stable Diffusion images with ControlNet
21 September 2023
This is another aspect of the Stable Diffusion AI art library, covered previously. With ControlNet, users can ‘condition’ the generation of an image with a spatial context such as a segmentation map or a scribble. That is, you can weight the model to produce images that are constrained to the form of another. We can turn a cartoon drawing into a realistic photo for example, or place another face in a portrait. We can still provide a prompt to guide...
AI art with Stable Diffusion in Python
19 September 2023
Stable Diffusion is a text-to-image model trained on 512x512 images from a subset of the LAION-5B dataset. You can implement this model on your own computer using the Python Diffusers library, which is a library for state-of-the-art pre-trained diffusion models for generating images, audio, and 3D structures. It is hosted by huggingface. The workings of the library are beyond the scope of this post, there are guides here if interested. To make this work fast enough you should have a...
SNP clustering and type naming of pathogens from WGS
15 September 2023
Whole genome sequencing (WGS) has emerged as a powerful tool in the field of public health, specifically in the context of pathogen strain typing. In order to categorize strains they are traditionally ‘typed’ using molecular methods like spoligotyping, MIRU-VNTR, RFLP or MLST. With WGS this can be accomplished at a superior resolution. WGS provides a detailed blueprint of virtually the entire genome. This allows every SNP difference between samples to be counted, within the error of instrument measurement. This information...
A phylogenetic tree viewer with PyQt and ToyTree
18 June 2023
Toyplot is a Python toolkit for plotting using HTML, SVG, and Javascript to create embeddable graphs. Toytree is based on toyplot and provides the ability to plot tree structures. It is a fairly minimalist package but can create useful tree plots that are better than some alternatives in Python. There are relatively few packages in Python that support rendering of phylogenetic trees that are much use. I have tried to use ete3 but found it frustrating and overly complex. Biopython...
Simulate land parcels and fragmentation with geopandas
22 March 2023
Land fragmentation is the division of land holdings into discrete parcels that may be dispersed over a wide area. It is common in an agricultural context where a single farmer can own multiple parcels of contiguous (separated by roads, hedgerows or fencing) or non-contiguous land. For cattle farming this means animals could spend their time in different portions of land at different times of the year. This presents a challenge for something like contact networks where determining connections between farms...
An individual based model of farm pathogen spread with Python/Mesa
19 March 2023
Computer-based disease spread models are frequently used in veterinary science to simulate disease spread. So called Agent based (ABM) or individual based models simulate each ‘agent’ in a network of contacts. Each agent could be an animal or other entity like a herd with certain behaviours. For example the agents can randomly contact each other and transmit disease. Running such a simulation with many heterogeneous entities over many steps produces emergent complex behaviour that is meant to approximate real life...
Make a contact network from a geopandas geodataframe
15 March 2023
Similar to the previous post the example here shows how to get a contact network from a random geodataframe of points. Unlike the delaunay graph this uses a distance threshold to determing if nodes should be connected. The function returns the position of nodes taken from the original geodataframe. The attrs parameter is if we want to assign any of the columns in the dataframe to the node attributes. Code
Make networkx Delaunay graphs from geopandas dataframes
23 January 2023
Geopandas Geodataframes store spatial data such as points and polygons. This post adapts code a from some examples online to show how to convert spatial points into a Delaunay graph. This is a undirected graph with edges between adjacent points only. This may be useful for building a spatial contact network of neighbouring points and doing further processing. Here we convert into networkx graphs. First we make a GeoDataFrame from some random points: def random_points(n): import random # Create an...
Using Molecular Nodes in Blender to visualise proteins
14 January 2023
Blender is a free program capable of advanced 3D modelling, animation and rendering. It is used to create photo realistic images for many applications such as animated films or architecture. I used to be interested in using Blender to create images of proteins and other molecules. This was a rather convoluted process. It seems things have moved on since I last looked at this area. There is now a very useful addon called Molecular Nodes that can import and render...
Scrape dynamic tables in Python with Playwright
29 December 2022
Sometimes it’s necessary to scrape a website or some pages that contain elements generated dynamically, often via javascript. This means you can’t always get all the html content in the page directly from the url. You may have to simulate interaction in the browser like clicking a button on a form and then waiting to get the content. This can be done with the Playwright library which was created to support automated testing of websites. Note that some websites won’t...All posts
- 21 Sep 2023 » Condition Stable Diffusion images with ControlNet
- 19 Sep 2023 » AI art with Stable Diffusion in Python
- 15 Sep 2023 » SNP clustering and type naming of pathogens from WGS
- 18 Jun 2023 » A phylogenetic tree viewer with PyQt and ToyTree
- 22 Mar 2023 » Simulate land parcels and fragmentation with geopandas
- 19 Mar 2023 » An individual based model of farm pathogen spread with Python/Mesa
- 15 Mar 2023 » Make a contact network from a geopandas geodataframe
- 23 Jan 2023 » Make networkx Delaunay graphs from geopandas dataframes
- 14 Jan 2023 » Using Molecular Nodes in Blender to visualise proteins
- 29 Dec 2022 » Scrape dynamic tables in Python with Playwright
- 21 Dec 2022 » Can ChatGPT solve bioinformatic problems with Python?
- 19 Dec 2022 » DALLE-2 and AI generated art.
- 15 Oct 2022 » How to host your podcast with github
- 08 Sep 2022 » Excess mortality in Ireland is still high in 2022
- 13 Aug 2022 » Mapping the historical development of Tallaght
- 07 Aug 2022 » Plotting gridded quantitative data with geopandas - Irish forestry
- 04 Aug 2022 » Make regular grids from polygons with geopandas
- 02 Aug 2022 » Plot phylogenies with annotation in R using ggtree and gheatmap
- 10 Apr 2022 » Parallelize a function in Python that returns a pandas DataFrame
- 28 Mar 2022 » batchfilerename - A simple utility for batch file renaming
- 20 Mar 2022 » Using IGV inside Jupyter Lab notebooks
- 23 Feb 2022 » Scrape paginated tables in Python with beautifulsoup
- 29 Jan 2022 » Ireland mortality data from RIP.ie, updated for 2021
- 12 Jan 2022 » Pandemic restrictions have caused misery in low income countries
- 14 Nov 2021 » High vaccination rates don't prevent transmission of SARS-CoV-2
- 12 Nov 2021 » Seasonality of SARS-CoV-2
- 18 Oct 2021 » Bacterial SNP detection with nanopore vs. illumina sequencing
- 03 Sep 2021 » Natural immunity to SARS-CoV-2
- 10 Jul 2021 » Comparison of SNP detection using duplicate sequencing runs in SNiPgenie
- 19 Jun 2021 » wgMLST vs the reference-align-SNP-calling method for M.bovis
- 15 Jun 2021 » Deaths in Ireland from RIP.ie - another look
- 10 Jun 2021 » A whole genome MLST (wgMLST) implementation in Python
- 18 May 2021 » Viewing the THOR dataset with Bokeh and Panel
- 15 May 2021 » The scale of US bombing in Southeast Asia revealed in the THOR dataset
- 26 Feb 2021 » A phylogenetic tree viewer with Qt and Toytree
- 16 Feb 2021 » A simple GIS plugin for Tablexplore
- 28 Jan 2021 » Ireland deaths in 2019/2020 compared to previous years
- 25 Jan 2021 » Daily deaths in Ireland from RIP.ie in 2019 and 2020
- 20 Jan 2021 » Visualizing Irish girls names since 1970
- 15 Jan 2021 » M. bovis spoligotyping from WGS reads
- 11 Jan 2021 » Linux application packaging and universal formats
- 23 Dec 2020 » Detecting polymorphisms in the RD900 region of MTBC species
- 19 Dec 2020 » Tablexplore - a desktop tool for table analysis
- 29 Nov 2020 » Epidemics, PCR and the dangers of mass testing
- 28 Nov 2020 » Convert a multi-sample VCF to a pandas DataFrame
- 15 Nov 2020 » A network agent based infection model with Mesa
- 10 Nov 2020 » Find PFAM domains in protein sequences with Python
- 02 Nov 2020 » Covid-19 and T cell immunity
- 28 Oct 2020 » Estimating Irelands tree coverage with QGIS and GeoPandas
- 18 Oct 2020 » Build an exe using pyinstaller with GitHub Actions
- 06 Oct 2020 » A simple image gallery in Jekyll without plugins
- 05 Sep 2020 » An MHC-Class I binding predictor with sklearn, part 2
- 18 Aug 2020 » Ireland COVID-19 trend in positive rate
- 15 Aug 2020 » Predicting cross-reactive T cell epitopes in Sars-CoV-2
- 06 Aug 2020 » COVID tracking project - tests vs positive rates
- 24 Jul 2020 » Death causes in England and Wales comparison - Winton Centre
- 21 Jul 2020 » Sequence alignment viewer with Qt/PySide2
- 11 Jul 2020 » Eurostat deaths from all causes dataset plots
- 07 Jul 2020 » pathogenie - A desktop application for microbial genome annotation
- 19 May 2020 » Fasta alignment from a multi sample VCF - a less terrible method
- 12 May 2020 » SNiPgenie - a tool for SNP site detection from NGS data
- 28 Apr 2020 » Simple MTBC regions of difference analysis with Python
- 19 Apr 2020 » Finding all amino acid mutations in SARS-CoV-2
- 14 Apr 2020 » A simple agent based infection model with Mesa and Bokeh
- 07 Apr 2020 » Create a fasta alignment from a multi sample VCF
- 01 Apr 2020 » COVID-19 ECDC data dashboard with Panel
- 28 Mar 2020 » COVID-19 ECDC data plots with Bokeh
- 18 Mar 2020 » Run bcftools mpileup in parallel with Python
- 11 Mar 2020 » Deploy a Python application with snapcraft
- 02 Mar 2020 » Model of the SARS-CoV-2 spike protein in Blender
- 28 Feb 2020 » Explore the SARS-CoV-2 spike protein sequences using Python tools
- 18 Feb 2020 » Updates to a genome annotation on the ENA via Webin-CLI
- 05 Feb 2020 » Plot fastq file metrics with Python
- 30 Jan 2020 » Compile windows exe files with MSYS2
- 25 Jan 2020 » A simple genome browser with Qt and dna_features_viewer
- 06 Jan 2020 » Interactive plots of World development indicators with Panel
- 03 Jan 2020 » Concurrent processes in PySide2/PyQt5 applications
- 14 Dec 2019 » Genome annotation with BLAST, Prodigal and Biopython
- 29 Nov 2019 » Embed Bokeh plots in Jekyll markdown
- 28 Nov 2019 » Categorical region plots with geopandas
- 15 Nov 2019 » Choropleth maps with geopandas, Bokeh and Panel
- 05 Nov 2019 » Analysis of MTBC regions of difference with NucDiff
- 20 Oct 2019 » Rapid Average Nucleotide Identity calculation with FastANI
- 13 Oct 2019 » NucDiff for bacterial whole genome comparisons
- 30 Sep 2019 » Plotting global sea ice extent data with four different Python packages
- 24 Sep 2019 » Interactively view datasets with HoloViews
- 15 Sep 2019 » Javascript callbacks for linking bokeh plots to panel widgets
- 31 Aug 2019 » Retrieving genome assemblies via Entrez with Python
- 12 Aug 2019 » Accessing data from the PDB with Python
- 22 Jul 2019 » Bioinformatics on the Raspberry Pi 4
- 11 Jul 2019 » A sequence alignment viewer with Bokeh and Panel
- 02 Jul 2019 » Dashboards with PyViz Panel for interactive web apps
- 17 May 2019 » Predicting neoantigens
- 04 Apr 2019 » Make protein models with Blender
- 20 Mar 2019 » Sequence, gene and protein databases: are you confused?
- 27 Feb 2019 » Unknown proteins in Mycobacterium tuberculosis
- 25 Feb 2019 » Reading and writing genbank/embl files with Python
- 25 Nov 2018 » Using epitopepredict for MHC binding prediction in Python
- 12 Nov 2018 » Create an MHC-Class I binding predictor in Python
- 09 Oct 2018 » Creating a local RefSeq protein blast database
- 14 Aug 2018 » Create a bacterial GFF from a genbank file for BCFtools/csq
- 05 Jul 2017 » DataExplore - grouped plots in version 0.8.0
- 11 Dec 2015 » Example: plotting miRNA abundance data (advanced)
- 15 Sep 2015 » Looking at the Titanic dataset
- 18 Jul 2015 » Zenodo and sharing your software
- 14 Jun 2015 » Educational software for data analysis
- 11 Jun 2015 » DataExplore Features
- 30 May 2015 » DataExplore Introduction