Skip to content

Instantly share code, notes, and snippets.

View jrjhealey's full-sized avatar

Joe Healey jrjhealey

View GitHub Profile
@jrjhealey
jrjhealey / align_and_remap.sh
Created January 15, 2019 09:09
Aligning and remapping reads to a reference.
#!/bin/bash
# Script to align fastq reads to a given reference, and output the necessary files sorted etc.
# Script requires bwa and samtools in path - check for existence:
command -v bwa >/dev/null 2>&1 || { echo >&2 "BWA doesn't appear to be installed. Aborting."; exit 1; }
command -v samtools >/dev/null 2>&1 || { echo >&2 "samtools doesn't appear to be installed. Aborting."; exit 1; }
# Capture inputs
@jrjhealey
jrjhealey / Orthologies_over_time.tsv
Created November 20, 2018 15:48
Results of HHPred homology queries
We can't make this file beautiful and searchable because it's too large.
PVCpnf_1 PAU_03353 PAU_03392 5W5F 5W5F_F 99.4 1.7e-16 2.8e-21 108.8 >5W5F_F Tail tube protein gp19; T4 tail tube, dose limit;{Enterobacteria phage T4 sensu lato}
PVCpnf_2 PAU_03352 PAU_03391 3J9Q 3J9Q_B 100.0 3.6e-34 6e-39 243.2 >3J9Q_B sheath, tube; pyocin, bacteriocin, sheath, tube, STRUCTURAL; 3.5A {Pseudomonas aeruginosa}
PVCpnf_3 PAU_03351 PAU_03390 3J9Q 3J9Q_B 99.9 8.9e-32 1.5e-36 234.4 >3J9Q_B sheath, tube; pyocin, bacteriocin, sheath, tube, STRUCTURAL; 3.5A {Pseudomonas aeruginosa}
PVCpnf_4 PAU_03350 PAU_03389 3J9Q 3J9Q_B 99.9 9.3e-28 1.6e-32 207.6 >3J9Q_B sheath, tube; pyocin, bacteriocin, sheath, tube, STRUCTURAL; 3.5A {Pseudomonas aeruginosa}
PVCpnf_5 PAU_03349 PAU_03388 5IV5 5IV5_I 99.0 2.4e-13 4e-18 93.6 >5IV5_IB Baseplate wedge protein gp6, Baseplate; T4, baseplate-tail tube complex, pre-attachment; 4.11A {Enterobacteria phage T4}
PVCpnf_6 PAU_03348 PAU_03387 3SLS 3SLS_B 75.1 1.5 2.5e-05 26.7 >3SLS_B Dual specificity mitogen-activated protein kinase; Serine-threonine kinase, Signalling, TRANSFER
@jrjhealey
jrjhealey / README.rst
Created November 15, 2018 17:30 — forked from sublee/README.rst
Finger Binary ASCII art generator for Python

Finger Binary

What's Finger Binary?

Here is a description of Finger Binary in Wikipedia.

Finger binary is a system for counting and displaying binary numbers on the

@jrjhealey
jrjhealey / seqcol.sh
Created October 10, 2018 11:49
Entirely uncessarily complex script to colour DNA sequences at arbitrary positions.. because...reasons? Even the help is colourful!
#!/bin/bash
# Set colours:
df=$(tput sgr0)
tr=$(tput setaf 1)
tg=$(tput setaf 2)
ty=$(tput setaf 3)
tb=$(tput setaf 4)
usage(){
@jrjhealey
jrjhealey / seqcol.sh
Created October 10, 2018 11:49
Entirely uncessarily complex script to colour DNA sequences at arbitrary positions.. because...reasons? Even the help is colourful!
#!/bin/bash
# Set colours:
df=$(tput sgr0)
tr=$(tput setaf 1)
tg=$(tput setaf 2)
ty=$(tput setaf 3)
tb=$(tput setaf 4)
usage(){
#!/usr/bin/env Rscript
# Perform cell-wise averaging of matrices (ignoring headers and row names)
# Standard install if missing
list.of.packages <- c("argparse", "abind")
new.packages <- list.of.packages[!(list.of.packages %in% installed.packages()[,"Package"])]
if(length(new.packages)) install.packages(new.packages)
for(i in list.of.packages){suppressMessages(library(i, character.only = TRUE))}
@jrjhealey
jrjhealey / getPDB.sh
Last active April 26, 2018 10:59
Fetching PDB structures from the Protein Databank
#!/bin/bash
# Script to retrieve PDBs via the command line from the PDB HTTP/FTP
# Capture inputs
usage()
{
cat << EOF
usage: $0 options
@jrjhealey
jrjhealey / prime_anagrams.py
Last active February 1, 2018 10:54
Work out if 2 words are anagrams based on their unique prime products.
#!/usr/bin/env python
"""
Using products of primes to work out whether 2 strings are anagrams of one another.
Inspired by: https://twitter.com/fermatslibrary/status/958700402647674880
Map each of the 26 english characters (A, B, C, ...) to a (unique) prime number.
Multiply the values mapped to each character together (A x B x C x ...).
Since every integer is a prime, or a unique product of primes, according to the
fundamental theorem of arithmetic), two words are anagrams of one another if their
@jrjhealey
jrjhealey / Iterative_R_images.r
Created January 30, 2018 17:39
Making a video from an R loop
#!/usr/bin/env Rscript
# Plotting surface plots via ggplot2/plotly
# Usage:
# $ Rscript CDmeltplot.R -i data.csv -o filename
############################################################
# General purpose heatmap plotting script for consistency. #
# This script can be slow as it was designed to be pretty #
@jrjhealey
jrjhealey / Fiddling_with_fastas.sh
Created November 27, 2017 14:13
A useful pure bash construct for dealing with FASTA files. Can be tweaked to perform all sorts of actions on the headers of sequences (e.g. rearrangement, regex, text matching)
#!/bin/bash
#### Print out all fastas ending in a certain string. ####
# Change *"$string" to *"$string"* to find containing,
# or "$string"* to find starts with.
file="$1"
string="$2"