Skip to content

Instantly share code, notes, and snippets.

View michaelbarton's full-sized avatar

Michael Barton michaelbarton

View GitHub Profile
#!/usr/bin/env ruby
require 'csv'
require 'yaml'
require 'bio'
def records(file)
Hash[Bio::GFF::GFF3.new(File.read(file)).records.map{|i| [i.id,i]}]
end
bad = records("assembly/bad.gff")
#!/usr/bin/env ruby
require 'csv'
require 'yaml'
require 'bio'
def records(file)
Hash[Bio::GFF::GFF3.new(File.read(file)).records.map{|i| [i.id,i]}]
end
bad = records("assembly/bad.gff")
#!/usr/bin/env ruby
require 'csv'
require 'yaml'
require 'bio'
gff = "/Users/mike/Dropbox/bad.gff"
re = /\w[a-z]{2}[A-Z]/
reformatted = Bio::GFF::GFF3.new(File.read(gff)).records.each do |record|
all: build
build: plasmid.sqn
plasmid.fsa:
genomer view fasta \
--identifier=PRJNA68653 \
--organism='Pseudomonas fluorescens' \
--strain='R124' \
--gcode='11' \
* Topic
|---+ Biological data resources
| |---+ Laboratory resources
| |---> Microarrays
| |---> Cell culture resources
| +---> Medical informatics resources
| +---+ Biological science resources
|---> Cell biology resources
|---+ Developmental biology resources
| +---> Embryology resources
%!test assert(descend([[1 1 1]' [2 2 2]'],[2 2 2]',[0 1]',1) == 0,
%! "should return 0 for theta_0 when x maps onto y")
%!
%!test assert(descend([[1 1 1]' [2 2 2]'],[2 2 2]',[0 1]',2) == 0,
%! "should return 0 for theta_1 when x maps onto y")
%!
%!test assert(descend([[1 1 1]' [4 4 4]'],[2 2 2]',[0 1]',1) == 2,
%! "should return error for theta_0 when x doesn't map onto y")
%!
%!test assert(descend([[1 1 1]' [4 4 4]'],[2 2 2]',[0 1]',2) == 8,
(ns download
(:require [clojure.contrib.io :as io])
(:import [java.io File FileOutputStream]))
(defn download-binary [to from]
(with-open [out (FileOutputStream. to)]
(.write out
(io/to-byte-array
(io/input-stream
(io/as-url from))))))
@michaelbarton
michaelbarton / gist:1177434
Created August 29, 2011 00:09
Download binary files from a url
(nsdownload
(:require [clojure.contrib.io :as io])
(:import [java.io File]))
(defn download-binary [to from]
(with-open [in (io/input-stream (io/as-url from))]
(io/copy in (File. to))))
/Users/mike/.gem/gems/ffi-1.0.7/lib/ffi_c.bundle: [BUG] Segmentation fault
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin10.8.0]
-- control frame ----------
c:0045 p:-542296850 s:0139 b:0139 l:000138 d:000138 TOP
c:0044 p:---- s:0137 b:0137 l:000136 d:000136 CFUNC :require
c:0043 p:0029 s:0133 b:0133 l:000129 d:000132 BLOCK /Users/mike/.gem/gems/ffi-1.0.7/lib/ffi.rb:8
c:0042 p:0056 s:0130 b:0130 l:000129 d:000129 TOP /Users/mike/.gem/gems/ffi-1.0.7/lib/ffi.rb:1
c:0041 p:---- s:0128 b:0128 l:000127 d:000127 FINISH
c:0040 p:---- s:0126 b:0126 l:000125 d:000125 CFUNC :require
(ns leiningen.database
(:import (org.biojava.bio.seq.io SeqIOTools))
(:require [clj-redis.client :as redis])
(:use [clojure.contrib.duck-streams :only (reader)]))
(defn sequence-stream [file]
(SeqIOTools/readFastaDNA (reader file)))
(defn sequences [stream]
(lazy-seq