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
# Reasons to use rails approach for bioinformatics | |
## Generic Ruby | |
* Modules like enumerable are great for sorting data | |
## Activerecord | |
* Simple to add indexes to enforce uniqueness of data |
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
task :environment do | |
require 'database' | |
require 'logger' | |
@log = Logger.new('log/analysis.log') | |
end | |
namespace :db do | |
desc 'Create database' | |
task :create => :environment do |
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
require 'database' | |
gene = Gene.find(2) | |
gene.alignment_sequences.each do |a| | |
puts "#{a.species.letter}#{gene.name} #{a.protein}" | |
end |
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
Can I over-ride task :environment in test_helper.rb to test rake tasks? | |
I have a series of rake tasks in a Rakefile which I'd like to test as part of my specs etc. Each task is defined in the form: | |
task :do_somthing => :environment do | |
# Do something with the database here | |
end | |
Where the :environment task sets up an ActiveRecord/DataMapper database connection and classes. I'm not using this as part of Rails but I have a series of tests which I like to run as part of BDD. |
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
BEGIN { FS = OFS = "," | |
print "gene", "cost", "cost-type"} | |
/yeast-carbon|weight/ && /0\.1/ && /nitrogen/{ | |
gsub(/"/,"") | |
gsub(/yeast-carbon-/,"") | |
printf "%s,%3.4f,%s\n", $2, $3, $13 | |
} |
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
*.swp |
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
module NavigationHelpers | |
# Maps a name to a path. Used by the | |
# | |
# When /^I go to (.+)$/ do |page_name| | |
# | |
# step definition in webrat_steps.rb | |
# | |
def path_to(page_name) | |
"http://0.0.0.0:3000" + case page_name | |
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
require 'www/mechanize' | |
# Patches WWW::Mechanize for Cucumber + Webrat | |
module WWW | |
class Mechanize | |
def self.log_disabled | |
@@log ||= Logger.new(STDOUT) | |
end |
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
#! /usr/local/bin/ruby | |
require 'rubygems' | |
require 'fastercsv' | |
layout = Hash.new | |
FasterCSV.open(ARGV.first, :headers => true).each do |row| | |
row.headers.each do |header| | |
layout[header] ||= Hash.new |
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
\documentclass[12pt,PhD]{muthesis} | |
\usepackage{verbatim} | |
\usepackage{graphicx} | |
\usepackage{url} % typeset URL's reasonably | |
\usepackage{listings} | |
\usepackage{phdthesis} | |
\usepackage{rotating} | |
\usepackage{subfig} | |
\usepackage{psfrag} |