Skip to content

Instantly share code, notes, and snippets.

@rtirrell
Created June 29, 2010 00:02
Show Gist options
  • Save rtirrell/456576 to your computer and use it in GitHub Desktop.
Save rtirrell/456576 to your computer and use it in GitHub Desktop.
# file1.rb
USER_RPT_REPOSITORY_NAME = :user_rpt
class Gene
include DataMapper::Resource
def self.default_repository_name; USER_RPT_REPOSITORY_NAME; end
belongs_to :gene_info, :child_key => [:GeneID], :parent_key => [:GeneID],
:key => true, :repository => repository(:annot_gene)
belongs_to :homologene, :child_key => [:HID], :parent_key => [:HID],
:repository => repository(:annot_gene)
belongs_to :subset_comparison, #:child_key => [:subset_comparison_id],
:parent_key => [:id], :key => true, :repository => repository(:nosology)
property :value, Float
end
# file2.rb
ANNOT_GENE_REPOSITORY_NAME = :annot_gene
class GeneInfo
include DataMapper::Resource
def self.default_repository_name; ANNOT_GENE_REPOSITORY_NAME; end
property :tax_id, Integer
# property :GeneID, Integer, :key => true
property :Symbol, String
property :description, String
# def homologene
# Homologene.get(GeneID)
# end
has n, :genes, :child_key => [:GeneID], :parent_key => [:GeneID], :repository => repository(:user_rpt)
belongs_to :homologene, :child_key => [:GeneID], :parent_key => [:GeneID], :key => true
end
class Homologene
include DataMapper::Resource
def self.default_repository_name; ANNOT_GENE_REPOSITORY_NAME; end
property :HID, Integer
property :tax_id, Integer
property :GeneID, String, :key => true
property :Symbol, String
has n, :gene_infos, :child_key => [:GeneID], :parent_key => [:GeneID]
has n, :genes, :child_key => [:HID], :parent_key => [:HID], :repository => repository(:user_rpt)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment