Skip to content

Instantly share code, notes, and snippets.

View michaelbarton's full-sized avatar

Michael Barton michaelbarton

View GitHub Profile
import System.Environment
import Data.List.Split
import Data.List
import qualified Data.Map.Strict as Map
main = do
[f] <- getArgs
contents <- readFile f
putStr . unlines . map unwords . map (kmers 6) . getSequences $ contents

Continuous, reproducible genome assembler benchmarking

New bioinformatics software is always being produced and published. The constant stream of new developments makes it difficult to keep track of the software available for common bioinformatics tasks. An example of this is the domain of genome assembly where there is already a large number of existing software.

If you are researching which bioinformatics software to use, it can be difficult understanding how effective the software is. For example given a new

DATA = SRR013437
# Allowed errors for primers and barcodes
# Even reads containing errors in these may still be usuable.
BCDE_ERS = 2
PRMR_ERS = 3
# Nucleotides differences to cluster sequences
DIFF = 4
@michaelbarton
michaelbarton / .gitignore
Created October 28, 2012 20:30
R code for examining principle components analysis
*.png
*.tab
functions = [ [:map, lambda{|x| x * 3}],
[:select, lambda{|x| x % 2 == 0 }],
[:reduce, lambda{|x,y| x + y}] ]
values = [1, 2, 3, 4]
p functions.inject(values){|x,(f,args)| x.send(f,&args) }
#=> 18
#!/usr/bin/env clj
(use 'clojure.java.io)
(require ['clojure.contrib.string :as 'string])
(def pairs (first *command-line-args*))
(defn reciprocal-edge? [edges]
(let [a (nth edges 0)
b (nth edges 1)]
(= (take 2 a) (take 2 b))))
vimux
- https://github.com/benmills/vimux
- https://www.braintreepayments.com/braintrust/vimux-simple-vim-and-tmux-integration
vimrx-ruby-test
- https://github.com/pgr0ss/vimux-ruby-test
tslime
- https://github.com/kikijump/tslime.vim
- try using with clojure repl
@michaelbarton
michaelbarton / gist:2292903
Created April 3, 2012 15:25
Update GFF records for tRNAs from identifiers in a different fasta file
#!/usr/bin/env ruby
require 'bio'
trnas = Bio::FlatFile.auto('genes.fna').
map(&:definition).
grep(/tRNA_..._.../).
map{|i| /^(?<id>\d+).+tRNA_(?<amino_acid>...)_(?<codon>...)/.match(i)}.
inject(Hash.new){|h,i| h[i[:id]] = {:amino_acid => i[:amino_acid], :codon => i[:codon]}; h}
#!/usr/bin/env clj
(ns format
(:require [clojure.string :as str1])
(:require [clojure.contrib.string :as str2]))
(def csv
(map #(str2/split #"," %)
(str2/split-lines
(slurp (first *command-line-args*)))))
#!/usr/bin/env Rscript
library(lubridate)
library(plyr)
library(ggplot2)
split.out <- function(string,split.at,position){
sort(unlist(strsplit(string,split.at)))[[position]]
}