Skip to content

Instantly share code, notes, and snippets.

View dcjones's full-sized avatar

Daniel C. Jones dcjones

View GitHub Profile
#!/usr/bin/env julia
using IntervalTrees
using Bio.Intervals: Interval
function random_interval(seqname, minlen, maxlen, minstart, maxstart)
first = rand(minstart:maxstart)
last = first + rand(minlen:maxlen) - 1
return Interval(seqname[1:end], first, last)
end
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dcjones
dcjones / BGZF.jl
Last active September 7, 2015 05:38
Parallel BGZF decompression
module BGZF
using BufferedStreams, Libz
# compressed and decompressed blocks are <= this in BGZF
const MAX_SIZE = 65536
using SQLite
# generate some random data
function binned_data(xbins, ybins, n)
xs = rand(n)
ys = rand(n)
# bin data
bins = zeros(Float64, (xbins, ybins))
@dcjones
dcjones / gist:9f20218f58e438c96476
Created May 21, 2015 16:17
Random FASTQ entries
function main()
if length(ARGS) < 2
println(STDERR, "Usage: fastq_rnd_seek_proper.jl filename numsamples")
exit()
end
filename = ARGS[1]
numsamples = parse(Int, ARGS[2])
pattern = r"@.+[\n\r]+[A-Z-]+[\n\r]+\+[\n\r]+.+[\n\r]{0,1}"
# Note: This only works on julia-0.4 currently.
using Bio.Seq
include("fogsaa.jl")
scoring = AlignmentScoring(2, -1, -3, -1)
FOGSAA(
dna"AACGTACGTACAATAGTTTTACGATAACCGATAGCGATACCCATTAGACTATA",
x=[ -1.2
-1.19868
-1.1947
-1.18809
-1.17886
-1.16703
-1.15263
-1.1357
-1.11627
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.