Skip to content

Instantly share code, notes, and snippets.

Avatar

cjw85

  • Oxford Nanopore Technologies
View GitHub Profile
@cjw85
cjw85 / chrom_reg.nf
Last active Nov 13, 2021
Non-blocking Nextflow workflow with unknown-sized gather step
View chrom_reg.nf
#!/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 Nov 11, 2020
Run DeepVariant on a VCF produced by medaka
View run_deepvariant.sh
#!/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
A minimal fasta/q parser in python using kseq.h
View fastx.py
/* 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 Mar 9, 2020
flappie ubuntu 18.04 docker
View Dockerfile
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 \
View 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 Apr 18, 2018
Simulate basecalls via simulated squiggles. This is not a serious attempt to model correctly error profiles in basecalls.
View simulate_calls.py
# 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 Jun 21, 2017
Implementation of nanonet using keras.
View keras_call.py
"""
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 Jan 18, 2016
Nicely pickling numpy array
View myarray.py
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