Skip to content

Instantly share code, notes, and snippets.

@boydgreenfield
boydgreenfield / _.md
Created October 20, 2012 00:39
just another inlet to tributary
@boydgreenfield
boydgreenfield / _.md
Created November 18, 2012 01:44
Another Inlet
@boydgreenfield
boydgreenfield / error_checking_at_runtime.nim
Last active December 30, 2015 18:19
Disabling overflow checking works for procs but not for blocks within a when isMainModule block?
{.push checks: off.}
proc unsafe_mult2(x: int32): int32 =
result = x * 2
{.pop.}
{.push checks: off.}
proc unsafe_assert(x: int): void =
assert x == (x + 1)
{.pop.}
@boydgreenfield
boydgreenfield / join_paired_ends.py
Last active March 14, 2016 22:12
Simple no-dependency Python script for concatenating two paired end FASTQ files
#!/usr/bin/env python
"""
No dependency Python script for joining two paired end FASTQ files.
Supports concatenating reads with a separator ("NNNNN") or interleaving reads via the
--interleave option. Auto-detects gzip'd files, offers header checking via a --strict flag,
and supports output to STDOUT a gzip'd FASTQ or an uncompressed FASTQ (--uncompressed flag).
"""
import argparse
import gzip
@boydgreenfield
boydgreenfield / sample.fasta
Created October 13, 2014 22:21
Sample FASTA file (simulated metagenomic dataset, from Wood + Salzburg, 2014)
This file has been truncated, but you can view the full file.
>A_hydrophila_HiSeq.922
AGGCCCACTGGAAGTTGTAGCCACCGAGCCAGCCGGTCACGTCCACCACCTCGCCGATGAAGTAGAGACCGGCTACCTTGCGCGCCTCCATGGTCTTGGAG
>A_hydrophila_HiSeq.1263
TGACTTGACGTCATCCCCACCTTCCTCCGGTTTATCACNACGGCAGTCTCCCTTGAGTTCCCACCATTACGTGCTGGCAACAAAGGACAGGGGTTGCGCTCGT
>A_hydrophila_HiSeq.2905
GACACCAAGCATATCTTCGACGAGCTGGACATCGACATAGACCCGCGGGTCAAGGTCGGCACCCTCTCCGTCTCCCAGATGCAGATGATCGAGATCGCCAA
>A_hydrophila_HiSeq.4866
TGACCCGCATCCGTAACGGTCAGGCGGCGAGCAAAGTTGNNNCGGTTTCCATGCCTTCTTCCAAGCTGAAAGTGGCTATTGCCAAAGTGCTGAAAGAAGAAGGT
>A_hydrophila_HiSeq.7009
GGTGAACCGTCTAATCCCCATCGTCGCCGACGAGCACGCCGACATGGAGAAGGGCACAGGCTGCGTGAAGATCACCCCGGCCCACGACTTCAACGACAACG
#!/usr/bin/env python
# Usage: python team_sync.py refgenomics Core [optional list of repos to sync (short name)]
from github import Github
import getpass
import sys
print "Enter user: ",
user = raw_input()
password = getpass.getpass()
@boydgreenfield
boydgreenfield / current_tables.nim
Last active August 29, 2015 14:20
CountTable broken in Nim v0.11
#
#
# Nim's Runtime Library
# (c) Copyright 2015 Andreas Rumpf
#
# See the file "copying.txt", included in this
# distribution, for details about the copyright.
#
## The ``tables`` module implements variants of an efficient `hash table`:idx:
@boydgreenfield
boydgreenfield / fetch_ocx_analyses.R
Last active August 23, 2016 00:26
Sample R script for generating a CSV with One Codex analysis results, one column per sample
#!/usr/local/bin/Rscript
# Copyright Reference Genomics, Inc. 2016
# Released under the MIT License
#
# Script for fetching analysis results from the One Codex API (v0)
# See https://docs.onecodex.com for full documentation on the REST API
#
# Script can be run from the command line with:
# `Rscript fetch_ocx_analyses.R <API_KEY> <FILE> [-d DATABASE_NAME] [-b BEGINNING_DATE_RANGE -e ENDING_DATE_RANGE]`
'''
:Date: 26 Jul 2016
:Author: Public Health England
'''
"""Detect peaks in data based on their amplitude and other features."""
import argparse
from khmer import khmer_args
import khmer
@boydgreenfield
boydgreenfield / download_ocx_samples.py
Last active February 23, 2017 22:21
Download samples based on their ID from One Codex
from __future__ import print_function
import argparse
import onecodex
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description=("Download a set of FASTA/Q files stored in One Codex with their sample IDs."))
parser.add_argument('samples', metavar='sample ID', nargs='+',