Skip to content

Instantly share code, notes, and snippets.

View danmaclean's full-sized avatar

Dan MacLean danmaclean

View GitHub Profile
@danmaclean
danmaclean / config.yml
Last active December 16, 2015 01:29
config.yml for a gee fu instance
tracks:
- id: 1
name: My Gene Models Track
type: ModelsTrack
path: Gene Models
data: /features/annoj/1
showControls: true
height: 80
- id: 2
name: Reads from an RDBMS provided experiment loaded via gff
@danmaclean
danmaclean / gist:5394557
Created April 16, 2013 09:15
Minimal parented feature in GFF
Chr1 TAIR9 gene 3631 5899 . + . ID=AT1G01010;Note=protein_coding_gene;Name=AT1G01010
Chr1 TAIR9 mRNA 3631 5899 . + . ID=AT1G01010.1;Parent=AT1G01010;Name=AT1G01010.1;Index=1
Chr1 TAIR9 exon 3631 3913 . + . Parent=AT1G01010.1
{
"recipient": "earner.name@gmail.com",
"evidence": "http://google.com",
"issued_on": "2012-05-21",
"badge": { "version": "1.0.0", "name": "command line user",
"image": "http://tsltraining.tsl.ac.uk/wp-content/uploads/2013/04/unix.png",
"description": "Has displayed expertise in command line use.",
"criteria": "http://tsltraining.tsl.ac.uk",
"issuer": {
"origin": "http://www.tsl.ac.uk",
@danmaclean
danmaclean / gist:5421183
Created April 19, 2013 15:41
badge.json
{
"recipient": "maclean.daniel@gmail.com",
"evidence": "http://google.com",
"issued_on": "2012-05-21",
"badge": { "version": "1.0.0", "name": "command line user",
"image": "http://tsltraining.tsl.ac.uk/wp-content/uploads/2013/04/unix.png",
"description": "Has displayed expertise in command line use.",
"criteria": "http://tsltraining.tsl.ac.uk",
"issuer": {
"origin": "http://www.tsl.ac.uk",
@danmaclean
danmaclean / gist:5425098
Created April 20, 2013 07:05
Stack from rails db:migrate
n95829:gee_fu-experimental-6 macleand$ rake db:migrate
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /Users/macleand/Downloads/gee_fu-experimental-6/Rakefile:7)
== AddOrganismToGenome: migrating ============================================
-- add_column(:genomes, :organism_id, :integer)
-> 0.0061s
-- add_foreign_key(:genomes, :organisms)
-> 0.0252s
-- change_column(:genomes, :organism_id, :integer, {:null=>false})
-> 0.0073s
== AddOrganismToGenome: migrated (0.1046s) ===================================
@danmaclean
danmaclean / gist:5425505
Created April 20, 2013 10:17
text to fasta
require 'bio'
some_text = "aatgacccgt" * 10
seq = Bio::Sequence::NA.new(some_text)
puts seq.to_fasta("seq_name", 60)
@danmaclean
danmaclean / gist:5426143
Created April 20, 2013 14:23
Feature#to_gff method improved for adding any other stuff from the database
def to_gff(extra = {})
#arr should be hash of keys and values to add to the group attributes
#can't use symbols as keys
arr = extra.to_a
gff = Bio::GFF::GFF3::Record.new(
seqid = Reference.find(self.reference_id).name,
source = self.source,
feature = self.feature,
start = self.start,
@danmaclean
danmaclean / gist:5426171
Created April 20, 2013 14:30
Predecessor#to_gff method
def to_gff(extra = {})
#arr should be hash of keys and values to add to the group attributes
arr = extra.to_a
gff = Bio::GFF::GFF3::Record.new(
seqid = Reference.find(self.reference_id).name,
source = self.source,
feature = self.feature,
start = self.start,
stop = self.end,
@danmaclean
danmaclean / gist:5437571
Created April 22, 2013 19:00
finding a reference and creating the feature in experiments_controller.rb (lines 76 - 93)
ref = Reference.find(:first, :conditions => ["name = ? AND genome_id = ?", "#{ record.seqname }", "#{@experiment.genome_id}"])
feature = Feature.new(
:group => "#{attribute}",
:feature => "#{record.feature}",
:source => "#{record.source}",
:start => "#{record.start}",
:end => "#{record.end}",
:strand => "#{record.strand}",
:phase => "#{record.frame}",
@danmaclean
danmaclean / gist:5437636
Created April 22, 2013 19:08
Poor handling of empty lines (non chomping of line!) in experiments_controller.rb lines 51 - 54
File.open( "#{@experiment.gff_file.path}" ).each do |line|
next if line =~ /^#/
break if line =~ /^##fasta/ or line =~ /^>/
record = Bio::GFF::GFF3::Record.new(line)