bio-ucsc-api 0.5.2 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
@@ -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 ChainPetMar1
|
15
|
-
include DBConnector
|
16
|
-
DBConnection.database "galGal3"
|
17
|
-
|
18
|
-
KLASS = "ChainPetMar1"
|
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 ChainPetMar1Link
|
15
|
-
include DBConnector
|
16
|
-
DBConnection.database "galGal3"
|
17
|
-
|
18
|
-
KLASS = "ChainPetMar1Link"
|
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 ChainRn4Link
|
15
|
-
include DBConnector
|
16
|
-
DBConnection.database "galGal3"
|
17
|
-
|
18
|
-
KLASS = "ChainRn4Link"
|
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 ChainTaeGut1
|
15
|
-
include DBConnector
|
16
|
-
DBConnection.database "galGal3"
|
17
|
-
|
18
|
-
KLASS = "ChainTaeGut1"
|
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 ChainTaeGut1Link
|
15
|
-
include DBConnector
|
16
|
-
DBConnection.database "galGal3"
|
17
|
-
|
18
|
-
KLASS = "ChainTaeGut1Link"
|
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 ChainXenTro2
|
15
|
-
include DBConnector
|
16
|
-
DBConnection.database "galGal3"
|
17
|
-
|
18
|
-
KLASS = "ChainXenTro2"
|
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
|