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.
- data/ChangeLog.md +3 -0
- data/Gemfile +6 -6
- data/Gemfile.lock +59 -30
- data/README.md +17 -13
- data/VERSION +1 -1
- data/bio-ucsc-api.gemspec +40 -45
- data/lib/bio-ucsc.rb +4 -3
- data/lib/bio-ucsc/drosim1.rb +1 -1
- data/lib/bio-ucsc/galgal4.rb +65 -0
- data/lib/bio-ucsc/hgfixed.rb +0 -1
- data/lib/bio-ucsc/rn5.rb +66 -0
- data/lib/bio-ucsc/rn5/chaincanfam2.rb +82 -0
- data/lib/bio-ucsc/{galgal3/chainmm9link.rb → rn5/chaincanfam2link.rb} +7 -9
- data/lib/bio-ucsc/{galgal3 → rn5}/chaincavpor3.rb +3 -6
- data/lib/bio-ucsc/rn5/chaincavpor3link.rb +81 -0
- data/lib/bio-ucsc/{galgal3 → rn5}/chaindanrer4.rb +3 -6
- data/lib/bio-ucsc/rn5/chaindanrer4link.rb +81 -0
- data/lib/bio-ucsc/rn5/chainequcab1.rb +81 -0
- data/lib/bio-ucsc/rn5/chainequcab1link.rb +81 -0
- data/lib/bio-ucsc/rn5/chaingalgal3.rb +81 -0
- data/lib/bio-ucsc/rn5/chaingalgal3link.rb +81 -0
- data/lib/bio-ucsc/{galgal3 → rn5}/chainmm9.rb +3 -6
- data/lib/bio-ucsc/rn5/chainmm9link.rb +81 -0
- data/lib/bio-ucsc/rn5/chainmondom4.rb +81 -0
- data/lib/bio-ucsc/rn5/chainmondom4link.rb +81 -0
- data/lib/bio-ucsc/{galgal3/chainfr2link.rb → rn5/chainpantro2.rb} +5 -8
- data/lib/bio-ucsc/{galgal3/chainrn4.rb → rn5/chainpantro2link.rb} +6 -8
- data/lib/bio-ucsc/rn5/chainrhemac2.rb +81 -0
- data/lib/bio-ucsc/rn5/chainrhemac2link.rb +81 -0
- data/lib/bio-ucsc/{galgal3 → rn5}/est.rb +2 -5
- data/lib/bio-ucsc/{galgal3 → rn5}/gap.rb +2 -5
- data/lib/bio-ucsc/{galgal3 → rn5}/gold.rb +2 -5
- data/lib/bio-ucsc/{galgal3 → rn5}/intronest.rb +2 -5
- data/lib/bio-ucsc/{galgal3 → rn5}/mrna.rb +2 -5
- data/lib/bio-ucsc/{galgal3 → rn5}/rmsk.rb +2 -5
- data/lib/bio-ucsc/taegut1/chaingalgal3.rb +1 -1
- data/lib/bio-ucsc/taegut1/chaingalgal3link.rb +1 -1
- data/lib/bio-ucsc/visigene.rb +0 -1
- metadata +55 -60
- data/lib/bio-ucsc/galgal3.rb +0 -56
- data/lib/bio-ucsc/galgal3/chainanocar1.rb +0 -84
- data/lib/bio-ucsc/galgal3/chainanocar1link.rb +0 -84
- data/lib/bio-ucsc/galgal3/chainbraflo1.rb +0 -84
- data/lib/bio-ucsc/galgal3/chainbraflo1link.rb +0 -84
- data/lib/bio-ucsc/galgal3/chaincavpor3link.rb +0 -84
- data/lib/bio-ucsc/galgal3/chaindanrer4link.rb +0 -84
- data/lib/bio-ucsc/galgal3/chainfr2.rb +0 -84
- data/lib/bio-ucsc/galgal3/chaingasacu1.rb +0 -84
- data/lib/bio-ucsc/galgal3/chaingasacu1link.rb +0 -84
- data/lib/bio-ucsc/galgal3/chainornana1.rb +0 -84
- data/lib/bio-ucsc/galgal3/chainornana1link.rb +0 -84
- data/lib/bio-ucsc/galgal3/chainpetmar1.rb +0 -84
- data/lib/bio-ucsc/galgal3/chainpetmar1link.rb +0 -84
- data/lib/bio-ucsc/galgal3/chainrn4link.rb +0 -84
- data/lib/bio-ucsc/galgal3/chaintaegut1.rb +0 -84
- data/lib/bio-ucsc/galgal3/chaintaegut1link.rb +0 -84
- data/lib/bio-ucsc/galgal3/chainxentro2.rb +0 -84
- data/lib/bio-ucsc/galgal3/chainxentro2link.rb +0 -84
@@ -0,0 +1,81 @@
|
|
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 Rn4
|
13
|
+
|
14
|
+
class ChainEquCab1Link
|
15
|
+
KLASS = "ChainEquCab1Link"
|
16
|
+
KLASS_S = "chainEquCab1Link"
|
17
|
+
|
18
|
+
Bio::Ucsc::Rn4::CHROMS.each do |chr|
|
19
|
+
class_eval %!
|
20
|
+
class #{chr[0..0].upcase + chr[1..-1]}_#{KLASS} < DBConnection
|
21
|
+
self.table_name = "#{chr[0..0].downcase + chr[1..-1]}_#{KLASS_S}"
|
22
|
+
self.primary_key = nil
|
23
|
+
self.inheritance_column = nil
|
24
|
+
|
25
|
+
def self.find_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
|
26
|
+
find_first_or_all_by_interval(interval, :first, opt)
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.find_all_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
|
30
|
+
find_first_or_all_by_interval(interval, :all, opt)
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.find_first_or_all_by_interval(interval, first_all, opt); interval = Bio::Ucsc::Gi.wrap(interval)
|
34
|
+
zstart = interval.zero_start
|
35
|
+
zend = interval.zero_end
|
36
|
+
if opt[:partial] == true
|
37
|
+
where = <<-SQL
|
38
|
+
tName = :chrom
|
39
|
+
AND bin in (:bins)
|
40
|
+
AND ((tStart BETWEEN :zstart AND :zend)
|
41
|
+
OR (tEnd BETWEEN :zstart AND :zend)
|
42
|
+
OR (tStart <= :zstart AND tEnd >= :zend))
|
43
|
+
SQL
|
44
|
+
else
|
45
|
+
where = <<-SQL
|
46
|
+
tName = :chrom
|
47
|
+
AND bin in (:bins)
|
48
|
+
AND ((tStart BETWEEN :zstart AND :zend)
|
49
|
+
AND (tEnd BETWEEN :zstart AND :zend))
|
50
|
+
SQL
|
51
|
+
end
|
52
|
+
cond = {
|
53
|
+
:chrom => interval.chrom,
|
54
|
+
:bins => Bio::Ucsc::UcscBin.bin_all(zstart, zend),
|
55
|
+
:zstart => zstart,
|
56
|
+
:zend => zend,
|
57
|
+
}
|
58
|
+
self.find(first_all,
|
59
|
+
{ :select => "*",
|
60
|
+
:conditions => [where, cond], })
|
61
|
+
end
|
62
|
+
end
|
63
|
+
!
|
64
|
+
end # each chromosome
|
65
|
+
|
66
|
+
def self.find_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
|
67
|
+
chrom = interval.chrom[0..0].upcase + interval.chrom[1..-1]
|
68
|
+
chr_klass = self.const_get("#{chrom}_#{KLASS}")
|
69
|
+
chr_klass.__send__(:find_by_interval, interval, opt)
|
70
|
+
end
|
71
|
+
|
72
|
+
def self.find_all_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
|
73
|
+
chrom = interval.chrom[0..0].upcase + interval.chrom[1..-1]
|
74
|
+
chr_klass = self.const_get("#{chrom}_#{KLASS}")
|
75
|
+
chr_klass.__send__(:find_all_by_interval, interval, opt)
|
76
|
+
end
|
77
|
+
end # class
|
78
|
+
|
79
|
+
end # module Hg18
|
80
|
+
end # module Ucsc
|
81
|
+
end # module Bio
|
@@ -0,0 +1,81 @@
|
|
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 Rn4
|
13
|
+
|
14
|
+
class ChainGalGal3
|
15
|
+
KLASS = "ChainGalGal3"
|
16
|
+
KLASS_S = "chainGalGal3"
|
17
|
+
|
18
|
+
Bio::Ucsc::Rn4::CHROMS.each do |chr|
|
19
|
+
class_eval %!
|
20
|
+
class #{chr[0..0].upcase + chr[1..-1]}_#{KLASS} < DBConnection
|
21
|
+
self.table_name = "#{chr[0..0].downcase + chr[1..-1]}_#{KLASS_S}"
|
22
|
+
self.primary_key = nil
|
23
|
+
self.inheritance_column = nil
|
24
|
+
|
25
|
+
def self.find_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
|
26
|
+
find_first_or_all_by_interval(interval, :first, opt)
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.find_all_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
|
30
|
+
find_first_or_all_by_interval(interval, :all, opt)
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.find_first_or_all_by_interval(interval, first_all, opt); interval = Bio::Ucsc::Gi.wrap(interval)
|
34
|
+
zstart = interval.zero_start
|
35
|
+
zend = interval.zero_end
|
36
|
+
if opt[:partial] == true
|
37
|
+
where = <<-SQL
|
38
|
+
tName = :chrom
|
39
|
+
AND bin in (:bins)
|
40
|
+
AND ((tStart BETWEEN :zstart AND :zend)
|
41
|
+
OR (tEnd BETWEEN :zstart AND :zend)
|
42
|
+
OR (tStart <= :zstart AND tEnd >= :zend))
|
43
|
+
SQL
|
44
|
+
else
|
45
|
+
where = <<-SQL
|
46
|
+
tName = :chrom
|
47
|
+
AND bin in (:bins)
|
48
|
+
AND ((tStart BETWEEN :zstart AND :zend)
|
49
|
+
AND (tEnd BETWEEN :zstart AND :zend))
|
50
|
+
SQL
|
51
|
+
end
|
52
|
+
cond = {
|
53
|
+
:chrom => interval.chrom,
|
54
|
+
:bins => Bio::Ucsc::UcscBin.bin_all(zstart, zend),
|
55
|
+
:zstart => zstart,
|
56
|
+
:zend => zend,
|
57
|
+
}
|
58
|
+
self.find(first_all,
|
59
|
+
{ :select => "*",
|
60
|
+
:conditions => [where, cond], })
|
61
|
+
end
|
62
|
+
end
|
63
|
+
!
|
64
|
+
end # each chromosome
|
65
|
+
|
66
|
+
def self.find_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
|
67
|
+
chrom = interval.chrom[0..0].upcase + interval.chrom[1..-1]
|
68
|
+
chr_klass = self.const_get("#{chrom}_#{KLASS}")
|
69
|
+
chr_klass.__send__(:find_by_interval, interval, opt)
|
70
|
+
end
|
71
|
+
|
72
|
+
def self.find_all_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
|
73
|
+
chrom = interval.chrom[0..0].upcase + interval.chrom[1..-1]
|
74
|
+
chr_klass = self.const_get("#{chrom}_#{KLASS}")
|
75
|
+
chr_klass.__send__(:find_all_by_interval, interval, opt)
|
76
|
+
end
|
77
|
+
end # class
|
78
|
+
|
79
|
+
end # module Hg18
|
80
|
+
end # module Ucsc
|
81
|
+
end # module Bio
|
@@ -0,0 +1,81 @@
|
|
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 Rn4
|
13
|
+
|
14
|
+
class ChainGalGal3Link
|
15
|
+
KLASS = "ChainGalGal3Link"
|
16
|
+
KLASS_S = "chainGalGal3Link"
|
17
|
+
|
18
|
+
Bio::Ucsc::Rn4::CHROMS.each do |chr|
|
19
|
+
class_eval %!
|
20
|
+
class #{chr[0..0].upcase + chr[1..-1]}_#{KLASS} < DBConnection
|
21
|
+
self.table_name = "#{chr[0..0].downcase + chr[1..-1]}_#{KLASS_S}"
|
22
|
+
self.primary_key = nil
|
23
|
+
self.inheritance_column = nil
|
24
|
+
|
25
|
+
def self.find_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
|
26
|
+
find_first_or_all_by_interval(interval, :first, opt)
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.find_all_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
|
30
|
+
find_first_or_all_by_interval(interval, :all, opt)
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.find_first_or_all_by_interval(interval, first_all, opt); interval = Bio::Ucsc::Gi.wrap(interval)
|
34
|
+
zstart = interval.zero_start
|
35
|
+
zend = interval.zero_end
|
36
|
+
if opt[:partial] == true
|
37
|
+
where = <<-SQL
|
38
|
+
tName = :chrom
|
39
|
+
AND bin in (:bins)
|
40
|
+
AND ((tStart BETWEEN :zstart AND :zend)
|
41
|
+
OR (tEnd BETWEEN :zstart AND :zend)
|
42
|
+
OR (tStart <= :zstart AND tEnd >= :zend))
|
43
|
+
SQL
|
44
|
+
else
|
45
|
+
where = <<-SQL
|
46
|
+
tName = :chrom
|
47
|
+
AND bin in (:bins)
|
48
|
+
AND ((tStart BETWEEN :zstart AND :zend)
|
49
|
+
AND (tEnd BETWEEN :zstart AND :zend))
|
50
|
+
SQL
|
51
|
+
end
|
52
|
+
cond = {
|
53
|
+
:chrom => interval.chrom,
|
54
|
+
:bins => Bio::Ucsc::UcscBin.bin_all(zstart, zend),
|
55
|
+
:zstart => zstart,
|
56
|
+
:zend => zend,
|
57
|
+
}
|
58
|
+
self.find(first_all,
|
59
|
+
{ :select => "*",
|
60
|
+
:conditions => [where, cond], })
|
61
|
+
end
|
62
|
+
end
|
63
|
+
!
|
64
|
+
end # each chromosome
|
65
|
+
|
66
|
+
def self.find_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
|
67
|
+
chrom = interval.chrom[0..0].upcase + interval.chrom[1..-1]
|
68
|
+
chr_klass = self.const_get("#{chrom}_#{KLASS}")
|
69
|
+
chr_klass.__send__(:find_by_interval, interval, opt)
|
70
|
+
end
|
71
|
+
|
72
|
+
def self.find_all_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
|
73
|
+
chrom = interval.chrom[0..0].upcase + interval.chrom[1..-1]
|
74
|
+
chr_klass = self.const_get("#{chrom}_#{KLASS}")
|
75
|
+
chr_klass.__send__(:find_all_by_interval, interval, opt)
|
76
|
+
end
|
77
|
+
end # class
|
78
|
+
|
79
|
+
end # module Hg18
|
80
|
+
end # module Ucsc
|
81
|
+
end # module Bio
|
@@ -9,16 +9,13 @@
|
|
9
9
|
|
10
10
|
module Bio
|
11
11
|
module Ucsc
|
12
|
-
module
|
12
|
+
module Rn4
|
13
13
|
|
14
14
|
class ChainMm9
|
15
|
-
include DBConnector
|
16
|
-
DBConnection.database "galGal3"
|
17
|
-
|
18
15
|
KLASS = "ChainMm9"
|
19
|
-
KLASS_S =
|
16
|
+
KLASS_S = "chainMm9"
|
20
17
|
|
21
|
-
Bio::Ucsc::
|
18
|
+
Bio::Ucsc::Rn4::CHROMS.each do |chr|
|
22
19
|
class_eval %!
|
23
20
|
class #{chr[0..0].upcase + chr[1..-1]}_#{KLASS} < DBConnection
|
24
21
|
self.table_name = "#{chr[0..0].downcase + chr[1..-1]}_#{KLASS_S}"
|
@@ -0,0 +1,81 @@
|
|
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 Rn4
|
13
|
+
|
14
|
+
class ChainMm9Link
|
15
|
+
KLASS = "ChainMm9Link"
|
16
|
+
KLASS_S = "chainMm9Link"
|
17
|
+
|
18
|
+
Bio::Ucsc::Rn4::CHROMS.each do |chr|
|
19
|
+
class_eval %!
|
20
|
+
class #{chr[0..0].upcase + chr[1..-1]}_#{KLASS} < DBConnection
|
21
|
+
self.table_name = "#{chr[0..0].downcase + chr[1..-1]}_#{KLASS_S}"
|
22
|
+
self.primary_key = nil
|
23
|
+
self.inheritance_column = nil
|
24
|
+
|
25
|
+
def self.find_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
|
26
|
+
find_first_or_all_by_interval(interval, :first, opt)
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.find_all_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
|
30
|
+
find_first_or_all_by_interval(interval, :all, opt)
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.find_first_or_all_by_interval(interval, first_all, opt); interval = Bio::Ucsc::Gi.wrap(interval)
|
34
|
+
zstart = interval.zero_start
|
35
|
+
zend = interval.zero_end
|
36
|
+
if opt[:partial] == true
|
37
|
+
where = <<-SQL
|
38
|
+
tName = :chrom
|
39
|
+
AND bin in (:bins)
|
40
|
+
AND ((tStart BETWEEN :zstart AND :zend)
|
41
|
+
OR (tEnd BETWEEN :zstart AND :zend)
|
42
|
+
OR (tStart <= :zstart AND tEnd >= :zend))
|
43
|
+
SQL
|
44
|
+
else
|
45
|
+
where = <<-SQL
|
46
|
+
tName = :chrom
|
47
|
+
AND bin in (:bins)
|
48
|
+
AND ((tStart BETWEEN :zstart AND :zend)
|
49
|
+
AND (tEnd BETWEEN :zstart AND :zend))
|
50
|
+
SQL
|
51
|
+
end
|
52
|
+
cond = {
|
53
|
+
:chrom => interval.chrom,
|
54
|
+
:bins => Bio::Ucsc::UcscBin.bin_all(zstart, zend),
|
55
|
+
:zstart => zstart,
|
56
|
+
:zend => zend,
|
57
|
+
}
|
58
|
+
self.find(first_all,
|
59
|
+
{ :select => "*",
|
60
|
+
:conditions => [where, cond], })
|
61
|
+
end
|
62
|
+
end
|
63
|
+
!
|
64
|
+
end # each chromosome
|
65
|
+
|
66
|
+
def self.find_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
|
67
|
+
chrom = interval.chrom[0..0].upcase + interval.chrom[1..-1]
|
68
|
+
chr_klass = self.const_get("#{chrom}_#{KLASS}")
|
69
|
+
chr_klass.__send__(:find_by_interval, interval, opt)
|
70
|
+
end
|
71
|
+
|
72
|
+
def self.find_all_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
|
73
|
+
chrom = interval.chrom[0..0].upcase + interval.chrom[1..-1]
|
74
|
+
chr_klass = self.const_get("#{chrom}_#{KLASS}")
|
75
|
+
chr_klass.__send__(:find_all_by_interval, interval, opt)
|
76
|
+
end
|
77
|
+
end # class
|
78
|
+
|
79
|
+
end # module Hg18
|
80
|
+
end # module Ucsc
|
81
|
+
end # module Bio
|
@@ -0,0 +1,81 @@
|
|
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 Rn4
|
13
|
+
|
14
|
+
class ChainMonDom4
|
15
|
+
KLASS = "ChainMonDom4"
|
16
|
+
KLASS_S = "chainMonDom4"
|
17
|
+
|
18
|
+
Bio::Ucsc::Rn4::CHROMS.each do |chr|
|
19
|
+
class_eval %!
|
20
|
+
class #{chr[0..0].upcase + chr[1..-1]}_#{KLASS} < DBConnection
|
21
|
+
self.table_name = "#{chr[0..0].downcase + chr[1..-1]}_#{KLASS_S}"
|
22
|
+
self.primary_key = nil
|
23
|
+
self.inheritance_column = nil
|
24
|
+
|
25
|
+
def self.find_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
|
26
|
+
find_first_or_all_by_interval(interval, :first, opt)
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.find_all_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
|
30
|
+
find_first_or_all_by_interval(interval, :all, opt)
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.find_first_or_all_by_interval(interval, first_all, opt); interval = Bio::Ucsc::Gi.wrap(interval)
|
34
|
+
zstart = interval.zero_start
|
35
|
+
zend = interval.zero_end
|
36
|
+
if opt[:partial] == true
|
37
|
+
where = <<-SQL
|
38
|
+
tName = :chrom
|
39
|
+
AND bin in (:bins)
|
40
|
+
AND ((tStart BETWEEN :zstart AND :zend)
|
41
|
+
OR (tEnd BETWEEN :zstart AND :zend)
|
42
|
+
OR (tStart <= :zstart AND tEnd >= :zend))
|
43
|
+
SQL
|
44
|
+
else
|
45
|
+
where = <<-SQL
|
46
|
+
tName = :chrom
|
47
|
+
AND bin in (:bins)
|
48
|
+
AND ((tStart BETWEEN :zstart AND :zend)
|
49
|
+
AND (tEnd BETWEEN :zstart AND :zend))
|
50
|
+
SQL
|
51
|
+
end
|
52
|
+
cond = {
|
53
|
+
:chrom => interval.chrom,
|
54
|
+
:bins => Bio::Ucsc::UcscBin.bin_all(zstart, zend),
|
55
|
+
:zstart => zstart,
|
56
|
+
:zend => zend,
|
57
|
+
}
|
58
|
+
self.find(first_all,
|
59
|
+
{ :select => "*",
|
60
|
+
:conditions => [where, cond], })
|
61
|
+
end
|
62
|
+
end
|
63
|
+
!
|
64
|
+
end # each chromosome
|
65
|
+
|
66
|
+
def self.find_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
|
67
|
+
chrom = interval.chrom[0..0].upcase + interval.chrom[1..-1]
|
68
|
+
chr_klass = self.const_get("#{chrom}_#{KLASS}")
|
69
|
+
chr_klass.__send__(:find_by_interval, interval, opt)
|
70
|
+
end
|
71
|
+
|
72
|
+
def self.find_all_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
|
73
|
+
chrom = interval.chrom[0..0].upcase + interval.chrom[1..-1]
|
74
|
+
chr_klass = self.const_get("#{chrom}_#{KLASS}")
|
75
|
+
chr_klass.__send__(:find_all_by_interval, interval, opt)
|
76
|
+
end
|
77
|
+
end # class
|
78
|
+
|
79
|
+
end # module Hg18
|
80
|
+
end # module Ucsc
|
81
|
+
end # module Bio
|
@@ -0,0 +1,81 @@
|
|
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 Rn4
|
13
|
+
|
14
|
+
class ChainMonDom4Link
|
15
|
+
KLASS = "ChainMonDom4Link"
|
16
|
+
KLASS_S = "chainMonDom4Link"
|
17
|
+
|
18
|
+
Bio::Ucsc::Rn4::CHROMS.each do |chr|
|
19
|
+
class_eval %!
|
20
|
+
class #{chr[0..0].upcase + chr[1..-1]}_#{KLASS} < DBConnection
|
21
|
+
self.table_name = "#{chr[0..0].downcase + chr[1..-1]}_#{KLASS_S}"
|
22
|
+
self.primary_key = nil
|
23
|
+
self.inheritance_column = nil
|
24
|
+
|
25
|
+
def self.find_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
|
26
|
+
find_first_or_all_by_interval(interval, :first, opt)
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.find_all_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
|
30
|
+
find_first_or_all_by_interval(interval, :all, opt)
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.find_first_or_all_by_interval(interval, first_all, opt); interval = Bio::Ucsc::Gi.wrap(interval)
|
34
|
+
zstart = interval.zero_start
|
35
|
+
zend = interval.zero_end
|
36
|
+
if opt[:partial] == true
|
37
|
+
where = <<-SQL
|
38
|
+
tName = :chrom
|
39
|
+
AND bin in (:bins)
|
40
|
+
AND ((tStart BETWEEN :zstart AND :zend)
|
41
|
+
OR (tEnd BETWEEN :zstart AND :zend)
|
42
|
+
OR (tStart <= :zstart AND tEnd >= :zend))
|
43
|
+
SQL
|
44
|
+
else
|
45
|
+
where = <<-SQL
|
46
|
+
tName = :chrom
|
47
|
+
AND bin in (:bins)
|
48
|
+
AND ((tStart BETWEEN :zstart AND :zend)
|
49
|
+
AND (tEnd BETWEEN :zstart AND :zend))
|
50
|
+
SQL
|
51
|
+
end
|
52
|
+
cond = {
|
53
|
+
:chrom => interval.chrom,
|
54
|
+
:bins => Bio::Ucsc::UcscBin.bin_all(zstart, zend),
|
55
|
+
:zstart => zstart,
|
56
|
+
:zend => zend,
|
57
|
+
}
|
58
|
+
self.find(first_all,
|
59
|
+
{ :select => "*",
|
60
|
+
:conditions => [where, cond], })
|
61
|
+
end
|
62
|
+
end
|
63
|
+
!
|
64
|
+
end # each chromosome
|
65
|
+
|
66
|
+
def self.find_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
|
67
|
+
chrom = interval.chrom[0..0].upcase + interval.chrom[1..-1]
|
68
|
+
chr_klass = self.const_get("#{chrom}_#{KLASS}")
|
69
|
+
chr_klass.__send__(:find_by_interval, interval, opt)
|
70
|
+
end
|
71
|
+
|
72
|
+
def self.find_all_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
|
73
|
+
chrom = interval.chrom[0..0].upcase + interval.chrom[1..-1]
|
74
|
+
chr_klass = self.const_get("#{chrom}_#{KLASS}")
|
75
|
+
chr_klass.__send__(:find_all_by_interval, interval, opt)
|
76
|
+
end
|
77
|
+
end # class
|
78
|
+
|
79
|
+
end # module Hg18
|
80
|
+
end # module Ucsc
|
81
|
+
end # module Bio
|