lib/bio-ucsc/taegut1/est.rb in bio-ucsc-api-0.3.1 vs lib/bio-ucsc/taegut1/est.rb in bio-ucsc-api-0.4.0
- old
+ new
@@ -10,29 +10,32 @@
module Bio
module Ucsc
module TaeGut1
class Est
+ include DBConnector
+ DBConnection.database "taeGut1"
+
KLASS = "Est"
KLASS_S = "est"
Bio::Ucsc::TaeGut1::CHROMS.each do |chr|
class_eval %!
class #{chr[0..0].upcase + chr[1..-1]}_#{KLASS} < DBConnection
- set_table_name "#{chr[0..0].downcase + chr[1..-1]}_#{KLASS_S}"
- set_primary_key nil
- set_inheritance_column nil
+ self.table_name = "#{chr[0..0].downcase + chr[1..-1]}_#{KLASS_S}"
+ self.primary_key = nil
+ self.inheritance_column = nil
- def self.find_by_interval(interval, opt = {:partial => true})
+ def self.find_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
find_first_or_all_by_interval(interval, :first, opt)
end
- def self.find_all_by_interval(interval, opt = {:partial => true})
+ def self.find_all_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
find_first_or_all_by_interval(interval, :all, opt)
end
- def self.find_first_or_all_by_interval(interval, first_all, opt)
+ def self.find_first_or_all_by_interval(interval, first_all, opt); interval = Bio::Ucsc::Gi.wrap(interval)
zstart = interval.zero_start
zend = interval.zero_end
if opt[:partial] == true
where = <<-SQL
tName = :chrom
@@ -61,18 +64,18 @@
end
end
!
end # each chromosome
- def self.find_by_interval(interval, opt = {:partial => true})
+ def self.find_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
chrom = interval.chrom[0..0].upcase + interval.chrom[1..-1]
- chr_klass = self.const_get("#{chrom}_#{KLASS}")
+ chr_klass = self.const_get("#{chrom}_#{KLASS_S}")
chr_klass.__send__(:find_by_interval, interval, opt)
end
- def self.find_all_by_interval(interval, opt = {:partial => true})
+ def self.find_all_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
chrom = interval.chrom[0..0].upcase + interval.chrom[1..-1]
- chr_klass = self.const_get("#{chrom}_#{KLASS}")
+ chr_klass = self.const_get("#{chrom}_#{KLASS_S}")
chr_klass.__send__(:find_all_by_interval, interval, opt)
end
end # class
end # module Hg18