Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View cjw85's full-sized avatar

Chris Wright cjw85

  • Oxford Nanopore Technologies
View GitHub Profile
@cjw85
cjw85 / chrom_reg.nf
Last active August 30, 2022 13:09
Non-blocking Nextflow workflow with unknown-sized gather step
#!/usr/bin/env nextflow
// Demonstration of hierarchical scatter/gather in Nextflow
// Tasks have two pieces of meta a chr (chromosome) and a reg (sub-
// chromosomal region). The workflow includes a step which gathers
// of all regions for a chromosome.
//
// The process phase_region is fast when chr in {"chr1", "chr2"} and slow
// when chr == "chr3". The gather process for distinct chromosomes
@cjw85
cjw85 / run_deepvariant.sh
Last active November 11, 2020 15:16
Run DeepVariant on a VCF produced by medaka
#!/usr/bin/env bash
set -eo pipefail
THREADS=8
usage="
DeepVariant genotyping of medaka variants.
First run:
@cjw85
cjw85 / fastx.py
Last active May 19, 2020 14:46
A minimal fasta/q parser in python using kseq.h
/* The MIT License
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
@cjw85
cjw85 / Dockerfile
Created March 9, 2020 19:52
flappie ubuntu 18.04 docker
FROM ubuntu:18.04
RUN groupadd -g 1001 -r flappie && useradd -r -u 999 -g flappie flappie
# Install flappie
RUN apt-get update \
&& apt-get install -y libcunit1 libhdf5-100 libopenblas-base cmake libcunit1-dev libhdf5-dev libopenblas-dev git git-lfs \
&& git lfs install \
&& git clone https://github.com/nanoporetech/flappie \
&& cd flappie \
&& git lfs install \
@cjw85
cjw85 / 2019-ncov.ipynb
Created February 5, 2020 10:51
2019-nCov.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cjw85
cjw85 / simulate_calls.py
Last active April 18, 2018 23:11
Simulate basecalls via simulated squiggles. This is not a serious attempt to model correctly error profiles in basecalls.
# Requirements: pip install numpy, pysam, scrappie
#
# usage: simulate_calls.py [-h] [--mu MU] [--sigma SIGMA] [--noise NOISE]
# [--threads THREADS]
# fasta ncalls
#
# Simulate basecalls with scrappy.
#
# positional arguments:
# fasta Source sequence file.
@cjw85
cjw85 / keras_call.py
Created June 21, 2017 16:06
Implementation of nanonet using keras.
"""
Reimplementation of nanonet using keras.
Follow the instructions at
https://www.tensorflow.org/install/install_linux
to setup an NVIDIA GPU with CUDA8.0 and cuDNN v5.1.
virtualenv venv --python=python3
. venv/bin/activate
pip install numpy
@cjw85
cjw85 / myarray.py
Created January 18, 2016 21:34
Nicely pickling numpy array
import numpy as np
import pickle
class MyArray(np.ndarray):
"""An np.ndarray subclass with attrs that behave nicely."""
def __new__(cls, a, meta=None):
obj = np.asarray(a).view(cls)
obj.meta = meta
return obj