bio-ucsc-api 0.5.2 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. data/ChangeLog.md +3 -0
  2. data/Gemfile +6 -6
  3. data/Gemfile.lock +59 -30
  4. data/README.md +17 -13
  5. data/VERSION +1 -1
  6. data/bio-ucsc-api.gemspec +40 -45
  7. data/lib/bio-ucsc.rb +4 -3
  8. data/lib/bio-ucsc/drosim1.rb +1 -1
  9. data/lib/bio-ucsc/galgal4.rb +65 -0
  10. data/lib/bio-ucsc/hgfixed.rb +0 -1
  11. data/lib/bio-ucsc/rn5.rb +66 -0
  12. data/lib/bio-ucsc/rn5/chaincanfam2.rb +82 -0
  13. data/lib/bio-ucsc/{galgal3/chainmm9link.rb → rn5/chaincanfam2link.rb} +7 -9
  14. data/lib/bio-ucsc/{galgal3 → rn5}/chaincavpor3.rb +3 -6
  15. data/lib/bio-ucsc/rn5/chaincavpor3link.rb +81 -0
  16. data/lib/bio-ucsc/{galgal3 → rn5}/chaindanrer4.rb +3 -6
  17. data/lib/bio-ucsc/rn5/chaindanrer4link.rb +81 -0
  18. data/lib/bio-ucsc/rn5/chainequcab1.rb +81 -0
  19. data/lib/bio-ucsc/rn5/chainequcab1link.rb +81 -0
  20. data/lib/bio-ucsc/rn5/chaingalgal3.rb +81 -0
  21. data/lib/bio-ucsc/rn5/chaingalgal3link.rb +81 -0
  22. data/lib/bio-ucsc/{galgal3 → rn5}/chainmm9.rb +3 -6
  23. data/lib/bio-ucsc/rn5/chainmm9link.rb +81 -0
  24. data/lib/bio-ucsc/rn5/chainmondom4.rb +81 -0
  25. data/lib/bio-ucsc/rn5/chainmondom4link.rb +81 -0
  26. data/lib/bio-ucsc/{galgal3/chainfr2link.rb → rn5/chainpantro2.rb} +5 -8
  27. data/lib/bio-ucsc/{galgal3/chainrn4.rb → rn5/chainpantro2link.rb} +6 -8
  28. data/lib/bio-ucsc/rn5/chainrhemac2.rb +81 -0
  29. data/lib/bio-ucsc/rn5/chainrhemac2link.rb +81 -0
  30. data/lib/bio-ucsc/{galgal3 → rn5}/est.rb +2 -5
  31. data/lib/bio-ucsc/{galgal3 → rn5}/gap.rb +2 -5
  32. data/lib/bio-ucsc/{galgal3 → rn5}/gold.rb +2 -5
  33. data/lib/bio-ucsc/{galgal3 → rn5}/intronest.rb +2 -5
  34. data/lib/bio-ucsc/{galgal3 → rn5}/mrna.rb +2 -5
  35. data/lib/bio-ucsc/{galgal3 → rn5}/rmsk.rb +2 -5
  36. data/lib/bio-ucsc/taegut1/chaingalgal3.rb +1 -1
  37. data/lib/bio-ucsc/taegut1/chaingalgal3link.rb +1 -1
  38. data/lib/bio-ucsc/visigene.rb +0 -1
  39. metadata +55 -60
  40. data/lib/bio-ucsc/galgal3.rb +0 -56
  41. data/lib/bio-ucsc/galgal3/chainanocar1.rb +0 -84
  42. data/lib/bio-ucsc/galgal3/chainanocar1link.rb +0 -84
  43. data/lib/bio-ucsc/galgal3/chainbraflo1.rb +0 -84
  44. data/lib/bio-ucsc/galgal3/chainbraflo1link.rb +0 -84
  45. data/lib/bio-ucsc/galgal3/chaincavpor3link.rb +0 -84
  46. data/lib/bio-ucsc/galgal3/chaindanrer4link.rb +0 -84
  47. data/lib/bio-ucsc/galgal3/chainfr2.rb +0 -84
  48. data/lib/bio-ucsc/galgal3/chaingasacu1.rb +0 -84
  49. data/lib/bio-ucsc/galgal3/chaingasacu1link.rb +0 -84
  50. data/lib/bio-ucsc/galgal3/chainornana1.rb +0 -84
  51. data/lib/bio-ucsc/galgal3/chainornana1link.rb +0 -84
  52. data/lib/bio-ucsc/galgal3/chainpetmar1.rb +0 -84
  53. data/lib/bio-ucsc/galgal3/chainpetmar1link.rb +0 -84
  54. data/lib/bio-ucsc/galgal3/chainrn4link.rb +0 -84
  55. data/lib/bio-ucsc/galgal3/chaintaegut1.rb +0 -84
  56. data/lib/bio-ucsc/galgal3/chaintaegut1link.rb +0 -84
  57. data/lib/bio-ucsc/galgal3/chainxentro2.rb +0 -84
  58. data/lib/bio-ucsc/galgal3/chainxentro2link.rb +0 -84
@@ -1,84 +0,0 @@
1
- # Copyright::
2
- # Copyright (C) 2011 MISHIMA, Hiroyuki <missy at be.to / hmishima at nagasaki-u.ac.jp>
3
- # License:: The Ruby licence (Ryby's / GPLv2 dual)
4
- #
5
- # In the hg18 database, this table is actually separated
6
- # into "chr1_*", "chr2_*", etc. This class dynamically
7
- # define *::Chr1_*, *::Chr2_*, etc. The
8
- # Rmsk.find_by_interval calls an appropreate class automatically.
9
-
10
- module Bio
11
- module Ucsc
12
- module GalGal3
13
-
14
- class ChainDanRer4Link
15
- include DBConnector
16
- DBConnection.database "galGal3"
17
-
18
- KLASS = "ChainDanRer4Link"
19
- KLASS_S = KLASS[0..0].downcase + KLASS[1..-1]
20
-
21
- Bio::Ucsc::GalGal3::CHROMS.each do |chr|
22
- class_eval %!
23
- class #{chr[0..0].upcase + chr[1..-1]}_#{KLASS} < DBConnection
24
- self.table_name = "#{chr[0..0].downcase + chr[1..-1]}_#{KLASS_S}"
25
- self.primary_key = nil
26
- self.inheritance_column = nil
27
-
28
- def self.find_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
29
- find_first_or_all_by_interval(interval, :first, opt)
30
- end
31
-
32
- def self.find_all_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
33
- find_first_or_all_by_interval(interval, :all, opt)
34
- end
35
-
36
- def self.find_first_or_all_by_interval(interval, first_all, opt); interval = Bio::Ucsc::Gi.wrap(interval)
37
- zstart = interval.zero_start
38
- zend = interval.zero_end
39
- if opt[:partial] == true
40
- where = <<-SQL
41
- tName = :chrom
42
- AND bin in (:bins)
43
- AND ((tStart BETWEEN :zstart AND :zend)
44
- OR (tEnd BETWEEN :zstart AND :zend)
45
- OR (tStart <= :zstart AND tEnd >= :zend))
46
- SQL
47
- else
48
- where = <<-SQL
49
- tName = :chrom
50
- AND bin in (:bins)
51
- AND ((tStart BETWEEN :zstart AND :zend)
52
- AND (tEnd BETWEEN :zstart AND :zend))
53
- SQL
54
- end
55
- cond = {
56
- :chrom => interval.chrom,
57
- :bins => Bio::Ucsc::UcscBin.bin_all(zstart, zend),
58
- :zstart => zstart,
59
- :zend => zend,
60
- }
61
- self.find(first_all,
62
- { :select => "*",
63
- :conditions => [where, cond], })
64
- end
65
- end
66
- !
67
- end # each chromosome
68
-
69
- def self.find_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
70
- chrom = interval.chrom[0..0].upcase + interval.chrom[1..-1]
71
- chr_klass = self.const_get("#{chrom}_#{KLASS}")
72
- chr_klass.__send__(:find_by_interval, interval, opt)
73
- end
74
-
75
- def self.find_all_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
76
- chrom = interval.chrom[0..0].upcase + interval.chrom[1..-1]
77
- chr_klass = self.const_get("#{chrom}_#{KLASS}")
78
- chr_klass.__send__(:find_all_by_interval, interval, opt)
79
- end
80
- end # class
81
-
82
- end # module Hg18
83
- end # module Ucsc
84
- end # module Bio
@@ -1,84 +0,0 @@
1
- # Copyright::
2
- # Copyright (C) 2011 MISHIMA, Hiroyuki <missy at be.to / hmishima at nagasaki-u.ac.jp>
3
- # License:: The Ruby licence (Ryby's / GPLv2 dual)
4
- #
5
- # In the hg18 database, this table is actually separated
6
- # into "chr1_*", "chr2_*", etc. This class dynamically
7
- # define *::Chr1_*, *::Chr2_*, etc. The
8
- # Rmsk.find_by_interval calls an appropreate class automatically.
9
-
10
- module Bio
11
- module Ucsc
12
- module GalGal3
13
-
14
- class ChainFr2
15
- include DBConnector
16
- DBConnection.database "galGal3"
17
-
18
- KLASS = "ChainFr2"
19
- KLASS_S = KLASS[0..0].downcase + KLASS[1..-1]
20
-
21
- Bio::Ucsc::GalGal3::CHROMS.each do |chr|
22
- class_eval %!
23
- class #{chr[0..0].upcase + chr[1..-1]}_#{KLASS} < DBConnection
24
- self.table_name = "#{chr[0..0].downcase + chr[1..-1]}_#{KLASS_S}"
25
- self.primary_key = nil
26
- self.inheritance_column = nil
27
-
28
- def self.find_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
29
- find_first_or_all_by_interval(interval, :first, opt)
30
- end
31
-
32
- def self.find_all_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
33
- find_first_or_all_by_interval(interval, :all, opt)
34
- end
35
-
36
- def self.find_first_or_all_by_interval(interval, first_all, opt); interval = Bio::Ucsc::Gi.wrap(interval)
37
- zstart = interval.zero_start
38
- zend = interval.zero_end
39
- if opt[:partial] == true
40
- where = <<-SQL
41
- tName = :chrom
42
- AND bin in (:bins)
43
- AND ((tStart BETWEEN :zstart AND :zend)
44
- OR (tEnd BETWEEN :zstart AND :zend)
45
- OR (tStart <= :zstart AND tEnd >= :zend))
46
- SQL
47
- else
48
- where = <<-SQL
49
- tName = :chrom
50
- AND bin in (:bins)
51
- AND ((tStart BETWEEN :zstart AND :zend)
52
- AND (tEnd BETWEEN :zstart AND :zend))
53
- SQL
54
- end
55
- cond = {
56
- :chrom => interval.chrom,
57
- :bins => Bio::Ucsc::UcscBin.bin_all(zstart, zend),
58
- :zstart => zstart,
59
- :zend => zend,
60
- }
61
- self.find(first_all,
62
- { :select => "*",
63
- :conditions => [where, cond], })
64
- end
65
- end
66
- !
67
- end # each chromosome
68
-
69
- def self.find_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
70
- chrom = interval.chrom[0..0].upcase + interval.chrom[1..-1]
71
- chr_klass = self.const_get("#{chrom}_#{KLASS}")
72
- chr_klass.__send__(:find_by_interval, interval, opt)
73
- end
74
-
75
- def self.find_all_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
76
- chrom = interval.chrom[0..0].upcase + interval.chrom[1..-1]
77
- chr_klass = self.const_get("#{chrom}_#{KLASS}")
78
- chr_klass.__send__(:find_all_by_interval, interval, opt)
79
- end
80
- end # class
81
-
82
- end # module Hg18
83
- end # module Ucsc
84
- end # module Bio
@@ -1,84 +0,0 @@
1
- # Copyright::
2
- # Copyright (C) 2011 MISHIMA, Hiroyuki <missy at be.to / hmishima at nagasaki-u.ac.jp>
3
- # License:: The Ruby licence (Ryby's / GPLv2 dual)
4
- #
5
- # In the hg18 database, this table is actually separated
6
- # into "chr1_*", "chr2_*", etc. This class dynamically
7
- # define *::Chr1_*, *::Chr2_*, etc. The
8
- # Rmsk.find_by_interval calls an appropreate class automatically.
9
-
10
- module Bio
11
- module Ucsc
12
- module GalGal3
13
-
14
- class ChainGasAcu1
15
- include DBConnector
16
- DBConnection.database "galGal3"
17
-
18
- KLASS = "ChainGasAcu1"
19
- KLASS_S = KLASS[0..0].downcase + KLASS[1..-1]
20
-
21
- Bio::Ucsc::GalGal3::CHROMS.each do |chr|
22
- class_eval %!
23
- class #{chr[0..0].upcase + chr[1..-1]}_#{KLASS} < DBConnection
24
- self.table_name = "#{chr[0..0].downcase + chr[1..-1]}_#{KLASS_S}"
25
- self.primary_key = nil
26
- self.inheritance_column = nil
27
-
28
- def self.find_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
29
- find_first_or_all_by_interval(interval, :first, opt)
30
- end
31
-
32
- def self.find_all_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
33
- find_first_or_all_by_interval(interval, :all, opt)
34
- end
35
-
36
- def self.find_first_or_all_by_interval(interval, first_all, opt); interval = Bio::Ucsc::Gi.wrap(interval)
37
- zstart = interval.zero_start
38
- zend = interval.zero_end
39
- if opt[:partial] == true
40
- where = <<-SQL
41
- tName = :chrom
42
- AND bin in (:bins)
43
- AND ((tStart BETWEEN :zstart AND :zend)
44
- OR (tEnd BETWEEN :zstart AND :zend)
45
- OR (tStart <= :zstart AND tEnd >= :zend))
46
- SQL
47
- else
48
- where = <<-SQL
49
- tName = :chrom
50
- AND bin in (:bins)
51
- AND ((tStart BETWEEN :zstart AND :zend)
52
- AND (tEnd BETWEEN :zstart AND :zend))
53
- SQL
54
- end
55
- cond = {
56
- :chrom => interval.chrom,
57
- :bins => Bio::Ucsc::UcscBin.bin_all(zstart, zend),
58
- :zstart => zstart,
59
- :zend => zend,
60
- }
61
- self.find(first_all,
62
- { :select => "*",
63
- :conditions => [where, cond], })
64
- end
65
- end
66
- !
67
- end # each chromosome
68
-
69
- def self.find_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
70
- chrom = interval.chrom[0..0].upcase + interval.chrom[1..-1]
71
- chr_klass = self.const_get("#{chrom}_#{KLASS}")
72
- chr_klass.__send__(:find_by_interval, interval, opt)
73
- end
74
-
75
- def self.find_all_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
76
- chrom = interval.chrom[0..0].upcase + interval.chrom[1..-1]
77
- chr_klass = self.const_get("#{chrom}_#{KLASS}")
78
- chr_klass.__send__(:find_all_by_interval, interval, opt)
79
- end
80
- end # class
81
-
82
- end # module Hg18
83
- end # module Ucsc
84
- end # module Bio
@@ -1,84 +0,0 @@
1
- # Copyright::
2
- # Copyright (C) 2011 MISHIMA, Hiroyuki <missy at be.to / hmishima at nagasaki-u.ac.jp>
3
- # License:: The Ruby licence (Ryby's / GPLv2 dual)
4
- #
5
- # In the hg18 database, this table is actually separated
6
- # into "chr1_*", "chr2_*", etc. This class dynamically
7
- # define *::Chr1_*, *::Chr2_*, etc. The
8
- # Rmsk.find_by_interval calls an appropreate class automatically.
9
-
10
- module Bio
11
- module Ucsc
12
- module GalGal3
13
-
14
- class ChainGasAcu1Link
15
- include DBConnector
16
- DBConnection.database "galGal3"
17
-
18
- KLASS = "ChainGasAcu1Link"
19
- KLASS_S = KLASS[0..0].downcase + KLASS[1..-1]
20
-
21
- Bio::Ucsc::GalGal3::CHROMS.each do |chr|
22
- class_eval %!
23
- class #{chr[0..0].upcase + chr[1..-1]}_#{KLASS} < DBConnection
24
- self.table_name = "#{chr[0..0].downcase + chr[1..-1]}_#{KLASS_S}"
25
- self.primary_key = nil
26
- self.inheritance_column = nil
27
-
28
- def self.find_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
29
- find_first_or_all_by_interval(interval, :first, opt)
30
- end
31
-
32
- def self.find_all_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
33
- find_first_or_all_by_interval(interval, :all, opt)
34
- end
35
-
36
- def self.find_first_or_all_by_interval(interval, first_all, opt); interval = Bio::Ucsc::Gi.wrap(interval)
37
- zstart = interval.zero_start
38
- zend = interval.zero_end
39
- if opt[:partial] == true
40
- where = <<-SQL
41
- tName = :chrom
42
- AND bin in (:bins)
43
- AND ((tStart BETWEEN :zstart AND :zend)
44
- OR (tEnd BETWEEN :zstart AND :zend)
45
- OR (tStart <= :zstart AND tEnd >= :zend))
46
- SQL
47
- else
48
- where = <<-SQL
49
- tName = :chrom
50
- AND bin in (:bins)
51
- AND ((tStart BETWEEN :zstart AND :zend)
52
- AND (tEnd BETWEEN :zstart AND :zend))
53
- SQL
54
- end
55
- cond = {
56
- :chrom => interval.chrom,
57
- :bins => Bio::Ucsc::UcscBin.bin_all(zstart, zend),
58
- :zstart => zstart,
59
- :zend => zend,
60
- }
61
- self.find(first_all,
62
- { :select => "*",
63
- :conditions => [where, cond], })
64
- end
65
- end
66
- !
67
- end # each chromosome
68
-
69
- def self.find_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
70
- chrom = interval.chrom[0..0].upcase + interval.chrom[1..-1]
71
- chr_klass = self.const_get("#{chrom}_#{KLASS}")
72
- chr_klass.__send__(:find_by_interval, interval, opt)
73
- end
74
-
75
- def self.find_all_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
76
- chrom = interval.chrom[0..0].upcase + interval.chrom[1..-1]
77
- chr_klass = self.const_get("#{chrom}_#{KLASS}")
78
- chr_klass.__send__(:find_all_by_interval, interval, opt)
79
- end
80
- end # class
81
-
82
- end # module Hg18
83
- end # module Ucsc
84
- end # module Bio
@@ -1,84 +0,0 @@
1
- # Copyright::
2
- # Copyright (C) 2011 MISHIMA, Hiroyuki <missy at be.to / hmishima at nagasaki-u.ac.jp>
3
- # License:: The Ruby licence (Ryby's / GPLv2 dual)
4
- #
5
- # In the hg18 database, this table is actually separated
6
- # into "chr1_*", "chr2_*", etc. This class dynamically
7
- # define *::Chr1_*, *::Chr2_*, etc. The
8
- # Rmsk.find_by_interval calls an appropreate class automatically.
9
-
10
- module Bio
11
- module Ucsc
12
- module GalGal3
13
-
14
- class ChainOrnAna1
15
- include DBConnector
16
- DBConnection.database "galGal3"
17
-
18
- KLASS = "ChainOrnAna1"
19
- KLASS_S = KLASS[0..0].downcase + KLASS[1..-1]
20
-
21
- Bio::Ucsc::GalGal3::CHROMS.each do |chr|
22
- class_eval %!
23
- class #{chr[0..0].upcase + chr[1..-1]}_#{KLASS} < DBConnection
24
- self.table_name = "#{chr[0..0].downcase + chr[1..-1]}_#{KLASS_S}"
25
- self.primary_key = nil
26
- self.inheritance_column = nil
27
-
28
- def self.find_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
29
- find_first_or_all_by_interval(interval, :first, opt)
30
- end
31
-
32
- def self.find_all_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
33
- find_first_or_all_by_interval(interval, :all, opt)
34
- end
35
-
36
- def self.find_first_or_all_by_interval(interval, first_all, opt); interval = Bio::Ucsc::Gi.wrap(interval)
37
- zstart = interval.zero_start
38
- zend = interval.zero_end
39
- if opt[:partial] == true
40
- where = <<-SQL
41
- tName = :chrom
42
- AND bin in (:bins)
43
- AND ((tStart BETWEEN :zstart AND :zend)
44
- OR (tEnd BETWEEN :zstart AND :zend)
45
- OR (tStart <= :zstart AND tEnd >= :zend))
46
- SQL
47
- else
48
- where = <<-SQL
49
- tName = :chrom
50
- AND bin in (:bins)
51
- AND ((tStart BETWEEN :zstart AND :zend)
52
- AND (tEnd BETWEEN :zstart AND :zend))
53
- SQL
54
- end
55
- cond = {
56
- :chrom => interval.chrom,
57
- :bins => Bio::Ucsc::UcscBin.bin_all(zstart, zend),
58
- :zstart => zstart,
59
- :zend => zend,
60
- }
61
- self.find(first_all,
62
- { :select => "*",
63
- :conditions => [where, cond], })
64
- end
65
- end
66
- !
67
- end # each chromosome
68
-
69
- def self.find_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
70
- chrom = interval.chrom[0..0].upcase + interval.chrom[1..-1]
71
- chr_klass = self.const_get("#{chrom}_#{KLASS}")
72
- chr_klass.__send__(:find_by_interval, interval, opt)
73
- end
74
-
75
- def self.find_all_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
76
- chrom = interval.chrom[0..0].upcase + interval.chrom[1..-1]
77
- chr_klass = self.const_get("#{chrom}_#{KLASS}")
78
- chr_klass.__send__(:find_all_by_interval, interval, opt)
79
- end
80
- end # class
81
-
82
- end # module Hg18
83
- end # module Ucsc
84
- end # module Bio
@@ -1,84 +0,0 @@
1
- # Copyright::
2
- # Copyright (C) 2011 MISHIMA, Hiroyuki <missy at be.to / hmishima at nagasaki-u.ac.jp>
3
- # License:: The Ruby licence (Ryby's / GPLv2 dual)
4
- #
5
- # In the hg18 database, this table is actually separated
6
- # into "chr1_*", "chr2_*", etc. This class dynamically
7
- # define *::Chr1_*, *::Chr2_*, etc. The
8
- # Rmsk.find_by_interval calls an appropreate class automatically.
9
-
10
- module Bio
11
- module Ucsc
12
- module GalGal3
13
-
14
- class ChainOrnAna1Link
15
- include DBConnector
16
- DBConnection.database "galGal3"
17
-
18
- KLASS = "ChainOrnAna1Link"
19
- KLASS_S = KLASS[0..0].downcase + KLASS[1..-1]
20
-
21
- Bio::Ucsc::GalGal3::CHROMS.each do |chr|
22
- class_eval %!
23
- class #{chr[0..0].upcase + chr[1..-1]}_#{KLASS} < DBConnection
24
- self.table_name = "#{chr[0..0].downcase + chr[1..-1]}_#{KLASS_S}"
25
- self.primary_key = nil
26
- self.inheritance_column = nil
27
-
28
- def self.find_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
29
- find_first_or_all_by_interval(interval, :first, opt)
30
- end
31
-
32
- def self.find_all_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
33
- find_first_or_all_by_interval(interval, :all, opt)
34
- end
35
-
36
- def self.find_first_or_all_by_interval(interval, first_all, opt); interval = Bio::Ucsc::Gi.wrap(interval)
37
- zstart = interval.zero_start
38
- zend = interval.zero_end
39
- if opt[:partial] == true
40
- where = <<-SQL
41
- tName = :chrom
42
- AND bin in (:bins)
43
- AND ((tStart BETWEEN :zstart AND :zend)
44
- OR (tEnd BETWEEN :zstart AND :zend)
45
- OR (tStart <= :zstart AND tEnd >= :zend))
46
- SQL
47
- else
48
- where = <<-SQL
49
- tName = :chrom
50
- AND bin in (:bins)
51
- AND ((tStart BETWEEN :zstart AND :zend)
52
- AND (tEnd BETWEEN :zstart AND :zend))
53
- SQL
54
- end
55
- cond = {
56
- :chrom => interval.chrom,
57
- :bins => Bio::Ucsc::UcscBin.bin_all(zstart, zend),
58
- :zstart => zstart,
59
- :zend => zend,
60
- }
61
- self.find(first_all,
62
- { :select => "*",
63
- :conditions => [where, cond], })
64
- end
65
- end
66
- !
67
- end # each chromosome
68
-
69
- def self.find_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
70
- chrom = interval.chrom[0..0].upcase + interval.chrom[1..-1]
71
- chr_klass = self.const_get("#{chrom}_#{KLASS}")
72
- chr_klass.__send__(:find_by_interval, interval, opt)
73
- end
74
-
75
- def self.find_all_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
76
- chrom = interval.chrom[0..0].upcase + interval.chrom[1..-1]
77
- chr_klass = self.const_get("#{chrom}_#{KLASS}")
78
- chr_klass.__send__(:find_all_by_interval, interval, opt)
79
- end
80
- end # class
81
-
82
- end # module Hg18
83
- end # module Ucsc
84
- end # module Bio