Skip to content

Instantly share code, notes, and snippets.

peterjc / V4.samples.onebp.svg
Created Feb 19, 2020
THAPBI PICT sample report Excel screenshot - mock freshwater:marine community with 18S rRNA V4
View V4.samples.onebp.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
peterjc /
Created Aug 17, 2018
Script to simplify setting up git repository for cron-based mirroring of a GitHub fork
set -euo pipefail
# See and
# for mirroring script
# Usage:
# 1. Fork upstream repo under HuttonICS, disable wiki, projects, issues etc. Protect master branch.
# 2. Run:
peterjc /
Created Apr 17, 2018
Linking my GitHub profile to my KeyBase identity

Keybase proof

I hereby claim:

  • I am peterjc on github.
  • I am pjacock ( on keybase.
  • I have a public key ASDyMh8PfhtgajUDmucW2sUhci9kIZ5U2TywiDd5GKUlyAo

To claim this, I am signing this object:

peterjc /
Created Aug 18, 2016
Hack for updating Galaxy tool_dependencies.xml files with URLs
# Copyright 2016 Peter Cock, James Hutton Institute.
# All Rights Reserved.
# Released as open source under the MIT license.
"""Update URLs in Galaxy tool_dependencies.xml files
Assumes have a copy of the urls.tsv file from
This file defines the
URL naming used for caching Galaxy dependencies.
peterjc / mirror_git
Last active Jul 14, 2019
Script to push git changes to a mirror repository using a deploy key
View mirror_git
# Enable strict bash mode - halts on any error
set -euo pipefail
# Takes exactly three command line arguments:
peterjc /
Created Oct 13, 2015
Hack for syncing local .shed.yml files with a Galaxy Tool Shed
# A hack, loosly based on Eric Rasche's
# Intended as a one-off use script to help with syncing local
# .shed.yml files with a Galaxy Tool Shed. See also:
import yaml
import os
from Bio import SeqIO
with open("CP008802.txt", "w") as output:
for record in SeqIO.parse("CP008802.gbk", "genbank"):
print("Converting %s" %
for f in record.features:
if f.type != "gene":
locus_tag = f.qualifiers["locus_tag"][0]
if len( > 1:
peterjc /
Created Apr 29, 2015
Rough script for populating Galaxy .shed.yml files with metadata already in Tool Shed
# Walks specified folders looking for .shed.yml files,
# with at least owner and name given.
# Matches the owner/name with the remote Tool Shed, and
# takes any missing meta-data from the remote Tool Shed.
# Pre-existing local data otherwise should be preserved.
# Does the yaml dump with some hackery because I couldn't
# work out how to make the library use the layout I wanted.
peterjc / shed_diff
Last active Aug 29, 2015
Galaxy Tool Shed diff command
View shed_diff
#!/usr/bin/env python
"""Galaxy Tool Shed diff command."""
import sys
import os
import subprocess
import tempfile
from optparse import OptionParser
VERSION = "v0.0.1"
peterjc /
Last active Jan 2, 2016
Standalone test case originally Biopython for resting ReportLab under Python 2 and 3. Currently seeing a segmentation fault under Python 2.7, and a TypeError under Python 3.3 when testing on Mac OS X - see
from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import letter
from reportlab.lib.units import inch
from reportlab.lib import colors
from reportlab.pdfbase.pdfmetrics import stringWidth
from import Drawing, String, Line, Rect, Wedge, ArcPath
from import renderPDF, renderPS
from import Widget