Schedule

Date Time Activity
Mon 02/11/2026 10:00 to 16:00 Unix-like systems, connecting to SCWales, bash
Tue 03/11/2026 10:00 to 16:00 More bash, scripts, markdown and Rmarkdown, SCWales, using SCWales and slurm
Wed 04/11/2026 10:00 to 16:00 Illumina data, population genomics, ANGSD, population structure, intro to R, EVENING SOCIAL
Thu 05/11/2026 10:00 to 16:00 Genetic diversity, Rmarkdown notebooks
Fri 06/11/2026 10:00 to 16:00 Phylogenomics, iqtree, admixture

Prequisites

  • a computer with internet connection
    • eduroam with bangor email address
  • an account on falcon
  • invite to SCWF00251, with signed EULA
  • basic knowledge of DNA and genome structure

Resources

Introductions

Axel Barlow, Lecturer in Zoology at Bangor University

  • Self taught post-PhD
  • No proper bioinformatics/computer science background
  • Knowledge of bash and R.

Johanna Paijmans, Lecturer in Zoology at Bangor University

  • Self taught (rebelling against a Linux-expert dad)
  • No proper bioinformatics/computer science background
  • Knowledge of bash and R.
  • By far the better coder of the pair ;)

Introductions

Unix-like systems and bash

Unix

  • Operating system developed in 1969 by Bell Labs
  • Unix philosophy: operating system should provide a set of simple tools, each of which performs a limited, well-defined function.
  • Modular (small programs strung together)
  • Inter-process communication: “pipes”
  • Separate normal and “super” users (sudo)
  • Hierarchical filesystem
  • A shell for executing and combining tools
  • The basis of many subsequent OS

Unix

Unix-like systems

Mac OS

  • Released 1984
  • Developed from NeXTSTEP, which is developed from Unix
  • Proprietary, Apple hardware only

Linux

  • 21 year old Linus Torvalds coded a Unix inspired OS in 1991
  • Free and open source
  • The core linux kernel available under many distributions: Ubuntu, Mint, Arch, Android, Tesla, etc.

MS-DOS (Windows)

  • Developed by Microsoft, released 1981
  • Main OS for IBM PCs in 1980s
  • GUI introduced with Windows, released 1985
  • Largest market share (70% of PCs)
  • Some bioinformatics possible (e.g. R typically via Rstudio)
  • No bash
  • Encoding of text files is different
  • Majority of bioinfomatics software unsupported
  • Windows subsystem for linux https://learn.microsoft.com/en-us/windows/wsl/install
  • Seamless transfer between DOS and Unix-like OS not yet possible

Windows Subsystem for Linux

  • Released in 2016
  • Allows installation of Linux distributions (e.g. Ubuntu) within Windows 10/11
  • Provides a bash terminal and Linux environment
  • Transfer between Windows and Linux filesystems possible
  • Essentially WSL is Microsoft’s admittance to Linux superiority

OS comparison

Windows Mac Linux
standard PC functions yes yes yes
cost yes yes free
hardware choice yes no yes
bioinformatics no yes yes
HPC no no yes
open source with active community no no yes
games yes no no

Terminal emulators and Bash

  • A shell allows users to execute OS tools
  • Accessed using a terminal
  • Unix terminal came with the Bourne shell (sh), developed by Steven Bourne in 1979
  • In 1979 Brian Fox in improved version: the Bourne again shell (bash)

  • Most Unix-like OS (incl Mac) use bash or something like it
    • execute standard OS functions and installed programs
    • access filesystem
    • supports bash scripts
    • pipes, auto-completion, loops, wildcards, etc.

Supercomputing Wales

“Falcon”

Falcon

  • Computational nodes
    • >70x computing nodes with 192 cores + 768 Gb RAM each
    • >8x highmem nodes with 192 cores + 1536 Gb RAM each
    • >18x Nvidia GPU nodes with 2-8 nodes each
  • Storage space
    • 1192TB (usable) scratch space
    • 457TB of home (redundant) directory space

Falcon usage

  • Command-line only (via ssh)
  • Access through SSH jump host
  • File transfer using scp or sftp
  • Job submission using slurm job scheduler
  • Software installed as modules
  • No super user access
  • Space & quota
    • Home directory (small, persistent): 50Gb
    • Scratch space (bigger, temporary): SCW projects, few Tb
    • Variable max active jobs, max 10 in the queue
    • Max 3 day runtime
    • check with myquota

Secure shell (SSH)

SSH via jump host

SSH via jump host

Getting logged on…

Connecting to the jump host (with MFA)

ssh you26usr@ssh.bangor.ac.uk

Note: most UNIX systems do not show anything when you’re typing your password!

If successful, connecting to Falcon

ssh b.you26usr@falconlogin.cf.ac.uk

Raise your hand if you are having issues 🙌

markdown and Rmarkdown

markdown and Rmarkdown

  • Simple text editor
  • knit to html, pdf, word, etc
  • html in particular integrates well with github and github pages
  • e.g. this presentation, the worksheet
  • Allows executable code chunks in R and other languages

Rmarkdown

AI

A brief note on AI in Bioinformatics

  • AI tools (LLMs) are becoming increasingly common in bioinformatics (and everywhere else)
  • AI lowers the barrier to implementation but it does not remove the need for computational understanding
  • Changing workflows: more time on conceptualisation and design. Less time on implementation. Less time on testing. More time on debugging.
  • Once you get into higher level bioinformatics, the possibilities are just astronomical 😱

A brief note on AI in Bioinformatics

Problems…

Problems…

Problems…

Problems…

Falcon tour

Filesystem

  • / [root] is uppermost level of filesystem
  • Everything is contained in /
  • Directories exist within the filesystem, they can contain files and other directories
  • We specify a path through this hierarchy using forward-slashes
  • Our current directory is called the working directory
/home/b.xlb21brx/
/scratch/SCWF00251/
  • We can navigate through the filesystem (change working directory)
  • Or we can specify the patch to directories or files remotely

Copying files via SCP

Slurm

  • Simple Linux Utility for Resource Management: slurm
  • Free open source job scheduler for linux systems
  • Used on 60% of World’s top 500 computers
  • Assigns user jobs to computer resources
  • Submit to queue
  • Short, low-resource jobs move faster through the queue
  • Useful tools for scheduling, reporting, etc

Illumina data

Illumina sequencing platforms

Illumina summary

  • The current market leader
  • Massive output
  • Many applications (genome resequencing, RADseq, transcriptomes, metabarcoding)
  • Cheap (£10 per Gb)
  • Major limitation is the read length

Data output

Platform Million reads Read length Gb data Genome coverage
iSeq 4 2 x 150 bp 1.2 0.4x
MiniSeq 25 2 x 150 bp 7.5 2.5x
MiSeq 100 2 x 500 bp 30 10x
Nextseq 550 400 2 x 150 bp 120 40x
NextSeq 1000/2000 1800 2 x 300 bp 540 180x
NovaSeq 6000 20000 2 x 250 bp 3000 1000x
NovaSeq X 52000 2 x 150 bp 8000 2667x

Sequencing by synthesis

  1. Sample preparation
  2. Bind DNA to flowcell
  3. Generate clusters
  4. Sequencing by synthesis
  5. Image analysis

Sample preparation

*Indexes allow multiple samples to be sequenced at the same time

Flow cell

Cluster generation

Sequencing by synthesis

Data analysis (in the machine)

What do we sequence?

[Not an exhaustive list]

  • Whole genome sequencing (pure DNA sample from a single individual)
  • Reduced representation genome data (RADseq, targeted SNPs, single individual)
  • Poolseq (multiple individuals)
  • Transcriptome (RNA sample from single tissue/individual)
  • Metabarcoding (PCR amplicon, multiple individuals/species)
  • Metagenomics (whole genomes, multiple individuals/species)

Whole genome sequencing

Short reads from a single individual can be mapped to a reference genome assembly

Whole genome sequencing

Our project: adder population genomics

  • Adders (Vipera berus) widespread across northern Eurasia
  • Vulnerable or near-threatened in UK
  • Illumina PE data from 50 individuals
  • 5 locations: Anglesey, Gwynedd, Yorkshire north, Yorkshire south, Sweden
  • 10 snakes per population
  • Mapped to chr 6 of rVipBer3

BEARCAVE

BEARCAVE2

  • An environment for organising, processing, and archiving Illumina data
  • BEARCAVE philosophy
    • All users can access all data
    • Avoid data redundancy
    • All samples processed using identical software programs and parameters
    • Incorporates sample metadata
    • Documents results of data processing
    • Publicly available
    • Safeguards in place to ensure consistency
  • NEW for 2026, fully automated, most users just get bam files for immediate analysis

BEARCAVE trim and merge script

  • trim adapter seqs using Cutadapt
  • reads < 30 bp removed
  • merge overlapping read pair using FLASH
  • compress files and clean up
  • save appropriate log files

Cutadapt

FLASH

Mapping

BEARCAVE mapping script

  • decompress fastqs
  • merged (SE) and PE data processed separately
    • mapping using bwa mem algorithm
    • PCR duplicates identified and removed using samtools
    • Reads with poor mapping quality (Q30) removed using samtools
  • SE and PE data merged
  • mapping log file generated
  • file cleanup and renaming

Expected output /BEARCAVE2/mappedrViperBer3_chr6/

  • mapped filtered data *.bam [big file]
  • bam index *.bam.bai

bwa

samtools (48,024 citations)

Population genomics using angsd

angsd

  • Widely used program, see: https://github.com/angsd/angsd

  • MANY population genetics analyses possible

  • Tends to work directly from bam files (unlike plink, admixtools, etc)

  • MANY filters available

  • Genotype likelihood approach is a particular speciality

  • Several spin off programs that use GLs

    • NGSadmix
    • PCangsd
    • NGSrelate
    • realSFS
    • etc

Whole genome sequencing

How it works

  • Considers all data for all individuals
  • initial pass to calculate GLs and identify biallelic SNPs
AA AT AG AC TT TG TC GG GC CC
0.05 0.1 0.05 0.05 0.1 0.05 0.05 0.1 0.05 0.4

How it works

  • second pass: GLs for 3 possible genotypes and allele frequencies
  • Range of filters, for e.g.:
    • minor allele frequency
    • minimum individuals with data
    • max/min depth per individual
    • base and map quality
  • output in beagle format
Allele0 Allele1 prob00 prob01 prob11
A T 0.05 0.9 0.05

angsd paper

Population structure

Principal components analysis (PCA)

  • No assumptions on the underlying population structure
  • Input is allele covariance matrix
  • Calculated from GLs in PCAngsd
  • eigen decompositionin R eigen()
  • Actually a recent method
  • No knowledge of PC loadings in terms of SNPs/sites
  • PC scatterplot
  • PC variance explained

Neighbour-joining clustering

  • Input is distance matrix
  • Calculated from GLs in NGSdist
  • Neighbour joining clustering in R using ape library
  • Clusters based on genetic similarity
  • Needs rooting, e.g. using an outgroup
  • Basic estimate of phylogeny

STRUCTURE-type analysis

  • Assigns individuals to K populations allowing admixture
  • NGSadmix can take GLs as input
  • K is assumed in advance, but several K can be tested

Intro to R

What is R

  • R was born from S in the Bell labs in 1992
  • Statistical analysis
  • Data visualisation
  • Free and open source
  • Linux, Mac, Windows
  • Many additional packages
  • Several GUIs e.g. Rstudio
  • Graphics (even interactive), text documents, websites
  • This presentation!

R from a heretic and a pragmatist

(guess who is who)

Most people disagree (in some cases strongly)

  • Base R is really good!
  • R ≠ Rstudio
  • tidyverse is not the way to teach R to beginners
  • Data doesn’t have to be tidy
  • ggplot2 code is restrictive
  • It’s boring if everyone’s graphs look the same
  • It’s OK to type commands directly into the terminal
  • It’s OK to modify a raw data file
  • It’s OK to combine other tools and languages

How R works

“Everything is an object; everything that happens is a function”

How R works

Objects and functions

Objects

  • Contain data and results
  • Created with <-
  • Stored in active memory
  • Names include letters numbers _ .
  • Names must begin with a letter

Functions

  • Carry out operations on objects
  • Often generates new objects
  • function()
  • ?function, example(function)

Data structures: vector and matrix

Vector

  • List of values of the same type
  • Numbers, strings, or logical values
  • Can be generated using c()
  • Indexing vector objects my_vector[]

Matrix

  • 2D data of same type in rows and columns
  • Indexing matrix objects my_matrix[row, column]

Data structures: dataframe and list

Dataframe

  • Rectangular “table”
  • Mixture of data types
  • Set of vectors of equal length
  • Extract columns with $, which can then be indexed like vectors

List

  • Set of components with different structures
  • Extract named components with $

Data structures: as shapes

Rstudio

  • GUI for R
  • Preferred by many
  • Linked to tidyverse
  • Linked to R markdown
  • Version control (git) and other development tools

Rstudio

Genetic diversity

Heterozygosity

  • measured in a single individual
  • het sites per kb
  • Computed from GLs in ANGSD as site frequency spectrum of a single individual
  • Outgroup used to assign ancestral allele (unfolded SFS)
  • Can be computed along a sliding window to identify ROH
AA AB BB
9900 80 20

Population nucleotide diversity

  • Measured in a population
  • Average differences between 2 randomly sampled chromosomes
  • Sort of population average heterozygosity
  • Calculated from population SFS computed from GLs in ANGSD along a sliding window

Phylogenomics

Phylogenomics

  • Phylogenetic analysis of genome-scale data
  • Data preparation
    • Concatenation
    • Reduced/ascertained SNPs
    • Aligned genome blocks, unlinked or don’t care
  • Inference methods
    • Maximum likelihood (ML)
    • Coalescent-based methods (e.g. ASTRAL, BPP)

Phylogenomics

European vipers: Vipera

  • A. V. aspis
  • B. V. latastei
  • C. V. ammodytes
  • D. V. ursinii
  • E. V. seoanei
  • F. V. berus

Di Nicola et al. Toxicology 453 (2021): 152724.

Data

  • 1 individual per species
  • Outgroup is Macrovipera schweizeri
  • Data mapped to outgroup to avoid reference bias
  • Tasks:
    • call consensus sequences
    • generate alignment
    • ML phylogeny using iqtree
    • D statistics

D statistics

D statistics with angsd

  • Computed in ANGSD using the -doAbbababa option
  • Computes all possible combinations of P1,P2,P3 (2/3 results are redundant)
  • Single read sampling, alleviates reference bias and normalises coverage
  • Other methods exist (e.g. consensify)
  • Standard error estimated using block jackknife
  • Z score > 3 indicates significant admixture

That’s all folks!

See you next year :)