Skip to content

Instantly share code, notes, and snippets.

View armanbilge's full-sized avatar
😵
Declaring notification bankruptcy. If I forgot your PR please ping me!

Arman Bilge armanbilge

😵
Declaring notification bankruptcy. If I forgot your PR please ping me!
View GitHub Profile
import string
from collections import Counter
def leastFrequentLetters(s):
C = Counter(c for c in s.lower() if c in string.ascii_lowercase)
return ''.join(k for k in string.ascii_lowercase if C[k] == min(C.itervalues()))
#!/usr/bin/env ruby
Encoding.default_external = "UTF-8"
i = 0
puts STDIN.read.sub(/(WEBVTT\s+)(\d{2}:)/){|s| "#{$2}"}.gsub(/(\d{2}:\d{2})\.(\d{3}\s+)-->(\s+\d{2}:\d{2})\.(\d{3}\s*)/) { |s|
"#{i+=1}\n#{s.sub(/(\d{2}:\d{2})\.(\d{3}\s+)-->(\s+)(\d{2}:\d{2})\.(\d{3}\s*)/){|t| "00:#{$1},#{$2}-->#{$3}00:#{$4},#{$5}"}}"
}
#!/usr/bin/env python3
import sys
from Bio import SeqIO
for fn in sys.argv[1:]:
with open(fn, 'r') as f:
print('\t<data id="{}" name="alignment">'.format(fn[:-len('_unphased.nex')]))
for record in SeqIO.parse(f, 'nexus'):
if record.id.endswith('_1'):
#!/usr/bin/env python3
# The MIT License (MIT)
#
# Copyright (c) 2015 Arman Bilge
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
#/usr/bin/env Rscript
args <- commandArgs(trailingOnly = TRUE)
pdf("boxplots.pdf", width=8,height=20)
par(mfrow=c(5,2))
for (a in args) {
x <- read.table(a)
boxplot(x, log = 'y', xlab = "Number of Taxa", main = a)
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{arrows.meta}
\makeatletter
\pgfarrowsdeclare{center*}{center*}
{
\pgfarrowsleftextend{+-.5\pgflinewidth}
x y z
0.5 1.0 1102.6653073315774
0.7272300105421488 0.8740779740855684 1095.4778163809021
1.1264366494503553 0.4759394735085066 1070.0371428485853
1.1264366494503553 0.4759394735085066 1070.0371428485853
1.116792813277176 0.4760376649851028 1069.7935934823915
1.3596616396957355 0.1133715525159581 1053.7430334714504
1.3596616396957355 0.1133715525159581 1053.7430334714504
1.143913847055679 0.21382193634748284 1051.569214273102
1.0131051618370646 0.07418646571818821 1047.4504891550416
type Node
label::String
height::Float64
parent::Node
left::Node
right::Node
end
Node(label::String, height::Float64) = Node(label, height, None, None, None)
using Distributions
using Iterators
using StatsBase
type Particle{T}
value::T
weight::Float64
end
Particle{T}(value::T) = Particle(value, 1.0)
import sys
import itertools as it
from collections import Counter
fn = sys.argv[1]
with open(fn) as f:
N = sum(1 for _ in f)
counts = {}