Skip to content

Instantly share code, notes, and snippets.

@boydgreenfield
boydgreenfield / download_ocx_samples.py
Last active Feb 23, 2017
Download samples based on their ID from One Codex
View download_ocx_samples.py
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='+',
View gist:8435d854afab6dd9ec7abc46e3e8c1a2
'''
: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 / fetch_ocx_analyses.R
Last active Aug 23, 2016
Sample R script for generating a CSV with One Codex analysis results, one column per sample
View fetch_ocx_analyses.R
#!/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]`
@boydgreenfield
boydgreenfield / current_tables.nim
Last active Aug 29, 2015
CountTable broken in Nim v0.11
View current_tables.nim
#
#
# 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:
View gist:fcfd8f81aea967550d27
#!/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 / sample.fasta
Created Oct 13, 2014
Sample FASTA file (simulated metagenomic dataset, from Wood + Salzburg, 2014)
View sample.fasta
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
@boydgreenfield
boydgreenfield / join_paired_ends.py
Last active Mar 14, 2016
Simple no-dependency Python script for concatenating two paired end FASTQ files
View join_paired_ends.py
#!/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 / error_checking_at_runtime.nim
Last active Dec 30, 2015
Disabling overflow checking works for procs but not for blocks within a when isMainModule block?
View error_checking_at_runtime.nim
{.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 / _.md
Created Oct 20, 2012
just another inlet to tributary