Skip to content

Instantly share code, notes, and snippets.

View ctb's full-sized avatar

C. Titus Brown ctb

View GitHub Profile
@ctb
ctb / gist:5663625
Last active November 23, 2021 04:11
Hi bwa users,
The bwa-mem manuscript has been rejected. Interestingly, the first
reviewer only raised a couple of minor concerns and then accepted the
manuscript in the second round of the review. The second reviewer made
quite a few mistakes on some basic concepts and was hostile from the
beginning. The third reviewer gave fair and good review in the first
round, all of which have been addressed, but he then tried hard to
argue one particular mapper to be the best in accuracy that on the
contrary is inferior to most others in my view. I admit that my
@ctb
ctb / README.md
Last active March 9, 2021 17:15
Cython maps

Here, the .get function on maps is about 1m times slower than the .getitem function. Why?

To run (requires Python 3, Cython, and a C/C++ build environment):

python setup.py build_ext -i
python test.py
@ctb
ctb / prefetch-gather.py
Created November 2, 2020 03:05
a simple prefetch script that searches large sourmash databases for all possible matches, and then saves them
#! /usr/bin/env python
import sys
import argparse
import copy
import sourmash
from sourmash import sourmash_args
from sourmash.logging import notify, error
import numpy
# works fine
numpy.array([5, 6, 7, 8], dtype=numpy.uint64)
# fails
numpy.array(set([5, 6, 7, 8]), dtype=numpy.uint64)
# in a Jupyter notebook, after %pylab inline
# so - not a Python bug, but a pylab/numpy thing
c = collections.Counter()
c['a'] = 5
c['b'] = 3
print('XXX:', sum(c.values()))
print('YYY:', sum([ x for x in c.values() ]))
# gives:
@ctb
ctb / README.md
Last active April 10, 2020 21:01

Implement contig contamination analysis as in (blog post)

import sys
import sourmash
sbt = sourmash.load_sbt_index(sys.argv[1])
print(next(iter(sbt.leaves())))
@ctb
ctb / Snakefile
Last active February 1, 2020 17:26
Testing out some snakemake namespace stuff.
global_var = 'a global variable'
rule all:
input:
"1-foo-hello.txt",
"2-bar-hello.txt",
"3-fiz-hello.txt",
"4-bif-hello.txt"
#

I spent Tues and Wed over by the Hermitage (downtown St Petersburg) being a tourist. A couple of suggestions for those of you who are here for a few more days and want to do the big tourism spots —

a good itinerary involving the below is,

  • hermitage early in the day, before it gets busy
  • late lunch at the blini place
  • boat trip

Everything below involves a total of about 45 minutes of walking, if you start at the hermitage.

I spent Tues and Wed over by the Hermitage (downtown St Petersburg) being a tourist. A couple of suggestions for those of you who are here for a few more days and want to do the big tourism spots —
a good itinerary involving the below is,
* hermitage early in the day, before it gets busy
* late lunch at the blini place
* boat trip
Everything below involves a total of about 45 minutes of walking, if you start at the hermitage.