Skip to content

Instantly share code, notes, and snippets.

@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
@jovial
jovial / gist:00fdcae18ac9bfa1a6af
Last active August 29, 2015 14:08
static call method hack
import macros
macro genStaticGetter(a: expr): stmt =
## generates a getter which returns a pointer to a method with
## a particular type signature.
##
## The getter has the form methodname(typ: type(param1), typ2: type(param2), ...),
## where methodname is the name of the method passed to this macro, and param#
## corresponds to the the param in position # of the method signature. # is a integer
## representing the position of the parameter.
[include]
# For user/credentials/token/etc
path = ~/.gitconfig.local
[core]
editor = vim
excludesfile = ~/.gitignore
[color]
branch = auto
diff = auto
status = auto
@alexjironkin
alexjironkin / gist:4ed43412878723491240814a0d5a6ed6
Last active January 28, 2023 05:15
min_abundance_finder.py
'''
: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
"""
This process the tree from the Hug et al 2016 paper into a genus-resolved tree
with NCBI tax ids for the leafs. This helps make it a little more amenable to
graphing (i.e. shorter labels and fewer of them) and comparing with the
preexisting NCBI taxonomy.
(Note that not all of the nodes can be resolved into tax ids using this name
matching and the current NCBI taxonomy (e.g. CPR phyla don't generally have
genus resolution yet). Also, I had to drop some members of some of the genuses
to ensure no genuses were paraphyletic. This is good enough for my purposes, but