This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Bio.Seq | |
# Utils for Benchmark | |
# ------------------- | |
function random_seq(n, nts, probs) | |
cumprobs = cumsum(probs) | |
x = Array(Char, n) | |
for i in 1:n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Bio.Seq | |
let | |
str = "ACGT"^10000 | |
seq = DNASequence(str) | |
seq′ = DNASequence("AAA" * str)[4:end] | |
@assert hash(seq) === hash(seq′) | |
println("ASCIIString") | |
hash(str) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Toy Regular Expression Engine Written in Julia | |
# ============================================== | |
# Example | |
# ------- | |
# | |
# julia> include("re.jl") | |
# run (generic function with 1 method) | |
# | |
# julia> ast = parse("foo*|ba*r") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type PhyNode{I,T<:Tuple} | |
id::I | |
metadata::T | |
children::Vector{PhyNode{I,T}} | |
parent::PhyNode{I,T} | |
# root | |
function PhyNode(id, metadata, children) | |
node = new(id, metadata, children) | |
node.parent = node |
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Nested Containment List | |
# ======================= | |
# | |
# Alekseyenko, A. V., & Lee, C. J. (2007). "Nested Containment List (NCList): A | |
# new algorithm for accelerating interval query of genome alignment and interval | |
# databases." Bioinformatics, 23(11), 1386–1393. | |
# doi:10.1093/bioinformatics/btl647 | |
# An interval type (inclusive). | |
immutable Interval{T} |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Automa | |
using Automa.RegExp | |
const re = Automa.RegExp | |
length = re"[0-9]+\.[0-9]+" | |
name = re.rep1(re"[!-~]" \ re"[,:;()[\]]") | |
spaces = re" +" | |
const newick = compile( | |
re"\(" => :(emit(:lparen)), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Automa | |
import Automa.RegExp: @re_str | |
const re = Automa.RegExp | |
# VCF v4.2 | |
const vcf_machine = (function () | |
delim(x, sep) = re.opt(re.cat(x, re.rep(re.cat(sep, x)))) | |
nl = re"\n" | |
newline = re"\r?" * nl |