bio-ucsc-api 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,30 @@
1
+ #Change Log
2
+ * **UPDATE** (v.0.5.1): Mouse mm10 database is supported.
3
+ * **BUG-FIX** (v.0.5.0): Connecting multiple databeses simultaneously now works well.
4
+ * **NEW** (v0.5.0): Support automatic definitions of table association using the "all.joiner" schema file.
5
+ * **NEW** (v0.5.0): Instances in classes of the genePred tables, which have txStart and txEnd columns, now have `#exons`, `#introns` and `#cdses` methods. These methods return arrays of `Bio::GenomicInterval` instances. The arrays are sorted using gene strands.
6
+ * **BUG-FIX** (v0.5.0): `Bio::Ucsc::File::TwoBit#inspect` now returns only short summary of the object instead of dumping a whole-genome sequence. This fixes hung-up in the irb environment.
7
+ * **UPDATE** (v0.4.0): now `<TABLE>#find_by_interval` accepts both "chr1:123-456" and Bio::GenomicInterval objects
8
+ * **BUG-FIX** (v0.4.0): By using the safe_attribute gem, newest version of ActiveRecord is supported.
9
+ * **UPDATE** (v0.4.0): `Bio::Ucsc::Reference` is moved to `Bio::Ucsc::File::Twobit` (backward compatibility is kept). `Bio::Ucsc::File::Twobit.open` and `Bio::Ucsc::File::Twobit#subseq` is are introduced.
10
+ * **UPDATE** (v0.4.0): `<DB_NAME>::DBConnection.connect` is simplified by the new `<DB_NAME>.connect` class method (backward compatibility is kept). Server parameters can be defined by using a hash being an argument of the method.
11
+ * **UPDATE** (v0.3.2): Genomic interval queries are implemented using ARel's relation objects instead of (named) scopes. Usage of the API is not changed.
12
+ * **BUG** (v0.3.1): Does not work with ActiveRecord version 3.1.0. Data retrieval methods occur the error, "(Object doesn't support #inspect)". The author is working on this bug. So far, please use version 3.0 seriese. Gemfile for gem dependencies is updated. Thanks for bug reports from Diego F. Pereira.
13
+ * **BUG-FIX** (v0.3.1): "func" fields in tables did not work. The bug was fixed.
14
+ * **BUG-FIX** (v0.3.1): PredGene-type tables without the bin index did not work. The bug was fixed.
15
+ * **NEW** (v0.3.0): Now genomic interval queries are expressed using the named scope "with_interval". 'Table#find_(all_)by_interval' is now deprecated. Sorry for an inconstant API. However, this change enable combination queries using genomic intervals and any fields.
16
+ * **NEW** (v0.3.0): `Bio::GenomicInterval#bin_all` and `Bio::GenomicInterval#bin` return the bin index for the given interval.
17
+ * **NEW** (v0.3.0): Supporting JRuby 1.6.3 or later. Appropiate Java heap size may have to be specified to invoke JRuby, especially when you use `Bio::Ucsc::Reference`. Try `jruby -J-Xmx3g your_script.rb` to keep 3G byte heap.
18
+ * **NEW** (v0.2.1): New genome assemblies are supported: [chimp] PanTro3, [orangutan] PonAbe2, [rhesus] RheMac2, [marmoset] CalJac3, [rat] Rn4, [guinea pig] CavPor3, [rabbit] OryCun2, [cat] FelCat4, [panda] AilMel1, [Dog] CanFam2, [horse] EquCab2, [pig] SusScr2, [sheep] OviAri1, [cow] BosTau4, [elephant] LoxAfr3, [opossum] MonDom5, [platypus] OrnAna1, [chicken] GalGal3, [zebra finch] TaeGut1, [lizard] AnoCar2, [X. tropicalis] XenTro2, [zebrafish] DanRer7, [tetraodon] TetNig2, [fugu] Fr2, [stickleback] GasAcu1, [medaka] OryLat2, [lamprey] PerMar1, [lancelet] BraFlo1, [sea squirt] Ci2, [sea urchin] StrPur2, [D.simulans] DroSim1, [D.sechellia] DroSec1, [D.yakuba] DroYak2, [D.electa] DroEre1, [D.ananassae] DroAna2, [D.pseudoobscura] Dp3, [D.persimilis] DroPer1, [D. virilis] DroVir2, [D.mojavensis] DroMoj2, [D.grimshawi] DroGri1, [Anopheles mosquito] AnoGam1, [honey bee] ApiMel2, [C.brenneri] CaePb3, [C.briggsae] Cb3, [C.remanei] CaeRem3, [P.pacificus] PriPac1, [sea hare] AplCal1, [yeast] SacCer2
19
+ * **NEW** (v0.2.1): Supporting Ruby 1.8.7 or later
20
+ * **NEW** Adding to human Hg19 and Hg18, the following genome assemblies are supported: [mouse] Mm9, [fruitfly] Dm3, [C. elegans] Ce6, [genome assembly independent] Go, HgFixed, Proteome, UniProt, VisiGene
21
+ * **UPDATE** (v0.2.0): Internal table class mapping algorithm are changed. Now table types are automatically detected and dynamically defined as classes. Previous versions used static class definition for all tables.
22
+ * **MODIFIED** (v0.2.0): Bio::Ucsc::[Hg18|Hg19]::ReferenceSequence are removed. Use Bio::Ucsc::Reference instead. This class is more object-oriented.
23
+ * **MODIFIED** (v0.1.0): The name of this library is now "Ruby UCSC API". The RubyGem name and the GitHub account and the library name are not changed.
24
+ * **MODIFIED** (v0.1.0): `Bio::Ucsc::[Hg18|Hg19]::Reference` is replaced by `Bio::Ucsc::[Hg18|Hg19]::ReferenceSequence`.
25
+ * **UPDATE** (v0.0.5): Almost all hg18 tables are supported.
26
+ * **UPDATE** (v0.0.5): find_by_interval and find_all_by_interval class methods accept the "partial" option. Default is true. When "partial: false" is opted, return value will be only fully-included (non-partially-included) records.
27
+ * **UPDATE** (v0.0.4): Almost all hg19 tables are supported. "filename" tables in ENCODE dataset are omitted. Each of them contains only single record of a path to the raw data file. Definitions of table relations are incomplete.
28
+ * **NEW** (v0.0.3): Supporting locally-stored '2bit' files, which can be downloaded from the UCSC site, to retrieve referential sequence. Now supporting unknown "N" nucleotide blocks, however, "mask-blocks", which are shown in lower-case in UCSC's DNA function, are not supported yet.
29
+ * **MODIFIED** (v0.0.3): For the "TABLE" class and the "column" column, `<TABLE>.find_by_column` retrieves a first record, and `<TABLE>.find_all_by_column` retrieves all the records as an Array.
30
+ * **NEW** (v0.0.3-0.0.4): Supporting tables divided into each chromosome, such as "*_RmsK" and "*_gold". Actual names of them are like "chr1_Rmsk", "chr2_Rmsk"... They can be accessed without chromosome names; but with just like "Rmsk" and "Gold".
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # bio-ucsc-api version 0.5.0
1
+ # bio-ucsc-api version 0.5.1
2
2
 
3
3
  **The Ruby UCSC API**: accessing the UCSC Genome Database using Ruby.
4
4
 
@@ -6,6 +6,12 @@ Your comments, suggestions and requests are welcome. Documentation and
6
6
  feedback are available at the UserEcho site at
7
7
  http://rubyucscapi.userecho.com/.
8
8
 
9
+ # Citation
10
+
11
+ The Ruby UCSC API: accessing the UCSC genome database using Ruby: Hiroyuki Mishima, Jan Aerts, Toshiaki Katayama, Raoul JP Bonnal and Koh-ichiro Yoshiura, *BMC Bioinformatics* **13**:240 (2012).
12
+ doi:10.1186/1471-2105-13-240
13
+ http://www.biomedcentral.com/1471-2105/13/240/
14
+
9
15
  # Install
10
16
 
11
17
  ```bash
@@ -26,9 +32,8 @@ $ gem install bio-ucsc-api
26
32
  * Current version does not support table-linked bigWIG/bigBED/BAM files.
27
33
 
28
34
  # Supported databases (genome assemblies)
29
-
30
35
  * **human** Hg19, Hg18
31
- * **mammals** chimp (PanTro3), orangutan (PonAbe2), rhesus (RheMac2), marmoset (CalJac3), mouse (Mm9), rat (Rn4), guinea pig (CavPor3), rabbit (OryCun2), cat (FelCat4), panda (AilMel1), dog (CanFam2), horse (EquCab2), pig (SusScr2), sheep (OviAri1), cow (BosTau4), elephant (LoxAfr3), opossum (MonDom5), platypus (OrnAna1)
36
+ * **mammals** chimp (PanTro3), orangutan (PonAbe2), rhesus (RheMac2), marmoset (CalJac3), mouse (Mm10, Mm9), rat (Rn4), guinea pig (CavPor3), rabbit (OryCun2), cat (FelCat4), panda (AilMel1), dog (CanFam2), horse (EquCab2), pig (SusScr2), sheep (OviAri1), cow (BosTau4), elephant (LoxAfr3), opossum (MonDom5), platypus (OrnAna1)
32
37
  * **vertebrates** chicken (GalGal3), zebra finch (TaeGut1), lizard (AnoCar2), X. tropicalis (XenTro2), zebrafish (DanRer7), tetraodon (TetNig2), fugu (Fr2), stickleback (GasAcu1), medaka (OryLat2), lamprey (PetMar1)
33
38
  * **deuterostomes** lancelet (BraFlo1), sea squirt (Ci2), sea urchin (StrPur2)
34
39
  [insects] D.melanogaster (Dm3), D.simulans (DroSim1), D.sechellia (DroSec1), D.yakuba (DroYak2), D.erecta (DroEre1), D.ananassae (DroAna2), D.pseudoobscura (Dp3), D.persimilis (DroPer1), D.virilis (DroVir2), D.mojavensis (DroMoj2), D.grimshawi (DroGri1), Anopheles mosquito (AnoGam1), honey bee (ApiMel2)
@@ -61,34 +66,7 @@ See also:
61
66
  * UCSCBin library - https://github.com/misshie/UCSCBin
62
67
 
63
68
  # Change Log
64
- * **BUG-FIX** (v.0.5.0): Connecting multiple databeses simultaneously now works well.
65
- * **NEW** (v0.5.0): Support automatic definitions of table association using the "all.joiner" schema file.
66
- * **NEW** (v0.5.0): Instances in classes of the genePred tables, which have txStart and txEnd columns, now have `#exons`, `#introns` and `#cdses` methods. These methods return arrays of `Bio::GenomicInterval` instances. The arrays are sorted using gene strands.
67
- * **BUG-FIX** (v0.5.0): `Bio::Ucsc::File::TwoBit#inspect` now returns only short summary of the object instead of dumping whole genome sequencing. This fixes hung-up in the irb environment.
68
- * **UPDATE** (v0.4.0): now `<TABLE>#find_by_interval` accepts both "chr1:123-456" and Bio::GenomicInterval objects
69
- * **BUG-FIX** (v0.4.0): By using the safe_attribute gem, newest version of ActiveRecord is supported.
70
- * **UPDATE** (v0.4.0): `Bio::Ucsc::Reference` is moved to `Bio::Ucsc::File::Twobit` (backward compatibility is kept). `Bio::Ucsc::File::Twobit.open` and `Bio::Ucsc::File::Twobit#subseq` is are introduced.
71
- * **UPDATE** (v0.4.0): `<DB_NAME>::DBConnection.connect` is simplified by the new `<DB_NAME>.connect` class method (backward compatibility is kept). Server parameters can be defined by using a hash being an argument of the method.
72
- * **UPDATE** (v0.3.2): Genomic interval queries are implemented using ARel's relation objects instead of (named) scopes. Usage of the API is not changed.
73
- * **BUG** (v0.3.1): Does not work with ActiveRecord version 3.1.0. Data retrieval methods occur the error, "(Object doesn't support #inspect)". The author is working on this bug. So far, please use version 3.0 seriese. Gemfile for gem dependencies is updated. Thanks for bug reports from Diego F. Pereira.
74
- * **BUG-FIX** (v0.3.1): "func" fields in tables did not work. The bug was fixed.
75
- * **BUG-FIX** (v0.3.1): PredGene-type tables without the bin index did not work. The bug was fixed.
76
- * **NEW** (v0.3.0): Now genomic interval queries are expressed using the named scope "with_interval". 'Table#find_(all_)by_interval' is now deprecated. Sorry for an inconstant API. However, this change enable combination queries using genomic intervals and any fields.
77
- * **NEW** (v0.3.0): `Bio::GenomicInterval#bin_all` and `Bio::GenomicInterval#bin` return the bin index for the given interval.
78
- * **NEW** (v0.3.0): Supporting JRuby 1.6.3 or later. Appropiate Java heap size may have to be specified to invoke JRuby, especially when you use `Bio::Ucsc::Reference`. Try `jruby -J-Xmx3g your_script.rb` to keep 3G byte heap.
79
- * **NEW** (v0.2.1): New genome assemblies are supported: [chimp] PanTro3, [orangutan] PonAbe2, [rhesus] RheMac2, [marmoset] CalJac3, [rat] Rn4, [guinea pig] CavPor3, [rabbit] OryCun2, [cat] FelCat4, [panda] AilMel1, [Dog] CanFam2, [horse] EquCab2, [pig] SusScr2, [sheep] OviAri1, [cow] BosTau4, [elephant] LoxAfr3, [opossum] MonDom5, [platypus] OrnAna1, [chicken] GalGal3, [zebra finch] TaeGut1, [lizard] AnoCar2, [X. tropicalis] XenTro2, [zebrafish] DanRer7, [tetraodon] TetNig2, [fugu] Fr2, [stickleback] GasAcu1, [medaka] OryLat2, [lamprey] PerMar1, [lancelet] BraFlo1, [sea squirt] Ci2, [sea urchin] StrPur2, [D.simulans] DroSim1, [D.sechellia] DroSec1, [D.yakuba] DroYak2, [D.electa] DroEre1, [D.ananassae] DroAna2, [D.pseudoobscura] Dp3, [D.persimilis] DroPer1, [D. virilis] DroVir2, [D.mojavensis] DroMoj2, [D.grimshawi] DroGri1, [Anopheles mosquito] AnoGam1, [honey bee] ApiMel2, [C.brenneri] CaePb3, [C.briggsae] Cb3, [C.remanei] CaeRem3, [P.pacificus] PriPac1, [sea hare] AplCal1, [yeast] SacCer2
80
- * **NEW** (v0.2.1): Supporting Ruby 1.8.7 or later
81
- * **NEW** Adding to human Hg19 and Hg18, the following genome assemblies are supported: [mouse] Mm9, [fruitfly] Dm3, [C. elegans] Ce6, [genome assembly independent] Go, HgFixed, Proteome, UniProt, VisiGene
82
- * **UPDATE** (v0.2.0): Internal table class mapping algorithm are changed. Now table types are automatically detected and dynamically defined as classes. Previous versions used static class definition for all tables.
83
- * **MODIFIED** (v0.2.0): Bio::Ucsc::[Hg18|Hg19]::ReferenceSequence are removed. Use Bio::Ucsc::Reference instead. This class is more object-oriented.
84
- * **MODIFIED** (v0.1.0): The name of this library is now "Ruby UCSC API". The RubyGem name and the GitHub account and the library name are not changed.
85
- * **MODIFIED** (v0.1.0): `Bio::Ucsc::[Hg18|Hg19]::Reference` is replaced by `Bio::Ucsc::[Hg18|Hg19]::ReferenceSequence`.
86
- * **UPDATE** (v0.0.5): Almost all hg18 tables are supported.
87
- * **UPDATE** (v0.0.5): find_by_interval and find_all_by_interval class methods accept the "partial" option. Default is true. When "partial: false" is opted, return value will be only fully-included (non-partially-included) records.
88
- * **UPDATE** (v0.0.4): Almost all hg19 tables are supported. "filename" tables in ENCODE dataset are omitted. Each of them contains only single record of a path to the raw data file. Definitions of table relations are incomplete.
89
- * **NEW** (v0.0.3): Supporting locally-stored '2bit' files, which can be downloaded from the UCSC site, to retrieve referential sequence. Now supporting unknown "N" nucleotide blocks, however, "mask-blocks", which are shown in lower-case in UCSC's DNA function, are not supported yet.
90
- * **MODIFIED** (v0.0.3): For the "TABLE" class and the "column" column, `<TABLE>.find_by_column` retrieves a first record, and `<TABLE>.find_all_by_column` retrieves all the records as an Array.
91
- * **NEW** (v0.0.3-0.0.4): Supporting tables divided into each chromosome, such as "*_RmsK" and "*_gold". Actual names of them are like "chr1_Rmsk", "chr2_Rmsk"... They can be accessed without chromosome names; but with just like "Rmsk" and "Gold".
69
+ See 'ChangeLog.md'.
92
70
 
93
71
  # How to Use
94
72
  ## Basics
@@ -249,9 +227,9 @@ joiner.define_association(Bio::Ucsc::Hg19::Snp131)
249
227
  # "first" is required because the snp131Seq method always returns an array.
250
228
  puts Bio::Ucsc::Hg19::Snp131.find_by_name("rs242").snp131Seq.first.file_offset
251
229
  ```
252
- # Copyright
253
- **Copyright**: (c) 2011-2012 MISHIMA, Hiroyuki (hmishima at nagasaki-u.ac.jp / Twitter: @mishima_eng (in English) and @mishimahryk (in Japanese)
254
-
255
- **Copyright**: (c) 2010 Jan Aerts
256
230
 
231
+ # Copyright
232
+ **Copyright**: (c) 2011-2012 MISHIMA, Hiroyuki (hmishima at nagasaki-u.ac.jp / Twitter: @mishima_eng (in English) and @mishimahryk (in Japanese)
233
+ **Copyright**: (c) 2010 Jan Aerts
257
234
  **License**: Ruby license (Ruby's / GPLv2 dual). See COPYING and COPYING.ja for further details..
235
+
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.0
1
+ 0.5.1
@@ -5,19 +5,21 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "bio-ucsc-api"
8
- s.version = "0.5.0"
8
+ s.version = "0.5.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Hiroyuki Mishima", "Jan Aerts"]
12
- s.date = "2012-08-23"
12
+ s.date = "2012-09-27"
13
13
  s.description = "Ruby UCSC API: accessing the UCSC Genome Database using Ruby"
14
14
  s.email = "missy@be.to"
15
15
  s.extra_rdoc_files = [
16
+ "ChangeLog.md",
16
17
  "README.md"
17
18
  ]
18
19
  s.files = [
19
20
  "COPYING",
20
21
  "COPYING.ja",
22
+ "ChangeLog.md",
21
23
  "Gemfile",
22
24
  "Gemfile.lock",
23
25
  "README.md",
@@ -294,6 +296,10 @@ Gem::Specification.new do |s|
294
296
  "lib/bio-ucsc/hgfixed.rb",
295
297
  "lib/bio-ucsc/loxafr3.rb",
296
298
  "lib/bio-ucsc/mm10.rb",
299
+ "lib/bio-ucsc/mm10/est.rb",
300
+ "lib/bio-ucsc/mm10/gbstatus.rb",
301
+ "lib/bio-ucsc/mm10/intronest.rb",
302
+ "lib/bio-ucsc/mm10/mrna.rb",
297
303
  "lib/bio-ucsc/mm9.rb",
298
304
  "lib/bio-ucsc/mm9/chainbraflo1.rb",
299
305
  "lib/bio-ucsc/mm9/chainbraflo1link.rb",
@@ -17,7 +17,7 @@ require "#{base}/gi.rb"
17
17
 
18
18
  module Bio
19
19
  module Ucsc
20
- VERSION = "0.4.0"
20
+ VERSION = "0.5.1"
21
21
  base = "#{::File.dirname(__FILE__)}/bio-ucsc"
22
22
 
23
23
  # mammmals #####################################
@@ -7,6 +7,7 @@ module Bio
7
7
  module Hg19
8
8
  class Description < DBConnection
9
9
  self.table_name = "description"
10
+ self.inheritance_column = nil
10
11
  end
11
12
  end
12
13
  end
@@ -30,6 +30,7 @@ ChrX ChrY)
30
30
 
31
31
  class DBConnection < ActiveRecord::Base
32
32
  include SafeAttributes
33
+ self.inheritance_column = 'dummy_not_to_use'
33
34
 
34
35
  @@db_adapter ||= 'mysql'
35
36
  @@db_host ||= 'genome-mysql.cse.ucsc.edu'
@@ -57,7 +58,10 @@ ChrX ChrY)
57
58
  end
58
59
  end # class DBConnection
59
60
 
60
- # base = "#{::File.dirname(__FILE__)}/mm10"
61
+ base = "#{::File.dirname(__FILE__)}/mm10"
62
+ autoload :Est, "#{base}/est"
63
+ autoload :IntronEst, "#{base}/intronest"
64
+ autoload :Mrna, "#{base}/mrna"
61
65
  end
62
66
  end
63
67
  end
@@ -0,0 +1,81 @@
1
+ # Copyright::
2
+ # Copyright (C) 2012 MISHIMA, Hiroyuki <missy at be.to / hmishima at nagasaki-u.ac.jp>
3
+ # License:: The Ruby licence (Ryby's / GPLv2 dual)
4
+ #
5
+ # 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 Mm10
13
+
14
+ class Est
15
+ KLASS = "Est"
16
+ KLASS_S = "est"
17
+
18
+ Bio::Ucsc::Mm10::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,15 @@
1
+ #
2
+ # the "type" colomn exists
3
+ #
4
+
5
+ module Bio
6
+ module Ucsc
7
+ module Mm10
8
+ class GbStatus < DBConnection
9
+ self.table_name = "gbStatus"
10
+ self.inheritance_column = nil
11
+ end
12
+ end
13
+ end
14
+ end
15
+
@@ -0,0 +1,81 @@
1
+ # Copyright::
2
+ # Copyright (C) 2012 MISHIMA, Hiroyuki <missy at be.to / hmishima at nagasaki-u.ac.jp>
3
+ # License:: The Ruby licence (Ryby's / GPLv2 dual)
4
+ #
5
+ # this table is actually separated
6
+ # into "chr1_*", "chr2_*", etc. This class dynamically
7
+ # define *::Chr1_*, *::Chr2_*, etc.
8
+
9
+
10
+ module Bio
11
+ module Ucsc
12
+ module Mm10
13
+
14
+ class IntronEst
15
+ KLASS = "IntronEst"
16
+ KLASS_S = "intronEst"
17
+
18
+ Bio::Ucsc::Mm9::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 Mm10
80
+ end # module Ucsc
81
+ end # module Bio
@@ -0,0 +1,80 @@
1
+ # Copyright::
2
+ # Copyright (C) 2012 MISHIMA, Hiroyuki <missy at be.to / hmishima at nagasaki-u.ac.jp>
3
+ # License:: The Ruby licence (Ryby's / GPLv2 dual)
4
+ #
5
+ # this table is actually separated
6
+ # into "chr1_*", "chr2_*", etc. This class dynamically
7
+ # define *::Chr1_*, *::Chr2_*, etc.
8
+
9
+ module Bio
10
+ module Ucsc
11
+ module Mm10
12
+
13
+ class Mrna
14
+ KLASS = "Mrna"
15
+ KLASS_S = "mrna"
16
+
17
+ Bio::Ucsc::Mm10::CHROMS.each do |chr|
18
+ class_eval %!
19
+ class #{chr[0..0].upcase + chr[1..-1]}_#{KLASS} < DBConnection
20
+ self.table_name = "#{chr[0..0].downcase + chr[1..-1]}_#{KLASS_S}"
21
+ self.primary_key = nil
22
+ self.inheritance_column = nil
23
+
24
+ def self.find_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
25
+ find_first_or_all_by_interval(interval, :first, opt)
26
+ end
27
+
28
+ def self.find_all_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
29
+ find_first_or_all_by_interval(interval, :all, opt)
30
+ end
31
+
32
+ def self.find_first_or_all_by_interval(interval, first_all, opt); interval = Bio::Ucsc::Gi.wrap(interval)
33
+ zstart = interval.zero_start
34
+ zend = interval.zero_end
35
+ if opt[:partial] == true
36
+ where = <<-SQL
37
+ tName = :chrom
38
+ AND bin in (:bins)
39
+ AND ((tStart BETWEEN :zstart AND :zend)
40
+ OR (tEnd BETWEEN :zstart AND :zend)
41
+ OR (tStart <= :zstart AND tEnd >= :zend))
42
+ SQL
43
+ else
44
+ where = <<-SQL
45
+ tName = :chrom
46
+ AND bin in (:bins)
47
+ AND ((tStart BETWEEN :zstart AND :zend)
48
+ AND (tEnd BETWEEN :zstart AND :zend))
49
+ SQL
50
+ end
51
+ cond = {
52
+ :chrom => interval.chrom,
53
+ :bins => Bio::Ucsc::UcscBin.bin_all(zstart, zend),
54
+ :zstart => zstart,
55
+ :zend => zend,
56
+ }
57
+ self.find(first_all,
58
+ { :select => "*",
59
+ :conditions => [where, cond], })
60
+ end
61
+ end
62
+ !
63
+ end # each chromosome
64
+
65
+ def self.find_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
66
+ chrom = interval.chrom[0..0].upcase + interval.chrom[1..-1]
67
+ chr_klass = self.const_get("#{chrom}_#{KLASS}")
68
+ chr_klass.__send__(:find_by_interval, interval, opt)
69
+ end
70
+
71
+ def self.find_all_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
72
+ chrom = interval.chrom[0..0].upcase + interval.chrom[1..-1]
73
+ chr_klass = self.const_get("#{chrom}_#{KLASS}")
74
+ chr_klass.__send__(:find_all_by_interval, interval, opt)
75
+ end
76
+ end # class
77
+
78
+ end # module Mm10
79
+ end # module Ucsc
80
+ end # module Bio
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bio-ucsc-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-08-23 00:00:00.000000000 Z
13
+ date: 2012-09-27 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activerecord
17
- requirement: &189972880 !ruby/object:Gem::Requirement
17
+ requirement: &158480880 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 3.0.7
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *189972880
25
+ version_requirements: *158480880
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: activesupport
28
- requirement: &189972180 !ruby/object:Gem::Requirement
28
+ requirement: &158480020 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: 3.0.7
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *189972180
36
+ version_requirements: *158480020
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: mysql
39
- requirement: &189971280 !ruby/object:Gem::Requirement
39
+ requirement: &158479400 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ~>
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: 2.8.1
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *189971280
47
+ version_requirements: *158479400
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: bio-genomic-interval
50
- requirement: &189970380 !ruby/object:Gem::Requirement
50
+ requirement: &158478820 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ! '>='
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: 0.1.2
56
56
  type: :runtime
57
57
  prerelease: false
58
- version_requirements: *189970380
58
+ version_requirements: *158478820
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: safe_attributes
61
- requirement: &189969640 !ruby/object:Gem::Requirement
61
+ requirement: &158494120 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ! '>='
@@ -66,10 +66,10 @@ dependencies:
66
66
  version: 1.0.8
67
67
  type: :runtime
68
68
  prerelease: false
69
- version_requirements: *189969640
69
+ version_requirements: *158494120
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: rake
72
- requirement: &189968780 !ruby/object:Gem::Requirement
72
+ requirement: &158493200 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ~>
@@ -77,10 +77,10 @@ dependencies:
77
77
  version: 0.9.2.2
78
78
  type: :development
79
79
  prerelease: false
80
- version_requirements: *189968780
80
+ version_requirements: *158493200
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: rspec
83
- requirement: &189968000 !ruby/object:Gem::Requirement
83
+ requirement: &158492580 !ruby/object:Gem::Requirement
84
84
  none: false
85
85
  requirements:
86
86
  - - ~>
@@ -88,10 +88,10 @@ dependencies:
88
88
  version: 2.9.0
89
89
  type: :development
90
90
  prerelease: false
91
- version_requirements: *189968000
91
+ version_requirements: *158492580
92
92
  - !ruby/object:Gem::Dependency
93
93
  name: bundler
94
- requirement: &189967380 !ruby/object:Gem::Requirement
94
+ requirement: &158491920 !ruby/object:Gem::Requirement
95
95
  none: false
96
96
  requirements:
97
97
  - - ~>
@@ -99,10 +99,10 @@ dependencies:
99
99
  version: 1.1.0
100
100
  type: :development
101
101
  prerelease: false
102
- version_requirements: *189967380
102
+ version_requirements: *158491920
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: jeweler
105
- requirement: &189966500 !ruby/object:Gem::Requirement
105
+ requirement: &158491160 !ruby/object:Gem::Requirement
106
106
  none: false
107
107
  requirements:
108
108
  - - ~>
@@ -110,10 +110,10 @@ dependencies:
110
110
  version: 1.8.3
111
111
  type: :development
112
112
  prerelease: false
113
- version_requirements: *189966500
113
+ version_requirements: *158491160
114
114
  - !ruby/object:Gem::Dependency
115
115
  name: bio
116
- requirement: &189965880 !ruby/object:Gem::Requirement
116
+ requirement: &158490320 !ruby/object:Gem::Requirement
117
117
  none: false
118
118
  requirements:
119
119
  - - ! '>='
@@ -121,10 +121,10 @@ dependencies:
121
121
  version: 1.4.1
122
122
  type: :development
123
123
  prerelease: false
124
- version_requirements: *189965880
124
+ version_requirements: *158490320
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: rdoc
127
- requirement: &189979540 !ruby/object:Gem::Requirement
127
+ requirement: &158488760 !ruby/object:Gem::Requirement
128
128
  none: false
129
129
  requirements:
130
130
  - - ! '>='
@@ -132,16 +132,18 @@ dependencies:
132
132
  version: 3.9.1
133
133
  type: :development
134
134
  prerelease: false
135
- version_requirements: *189979540
135
+ version_requirements: *158488760
136
136
  description: ! 'Ruby UCSC API: accessing the UCSC Genome Database using Ruby'
137
137
  email: missy@be.to
138
138
  executables: []
139
139
  extensions: []
140
140
  extra_rdoc_files:
141
+ - ChangeLog.md
141
142
  - README.md
142
143
  files:
143
144
  - COPYING
144
145
  - COPYING.ja
146
+ - ChangeLog.md
145
147
  - Gemfile
146
148
  - Gemfile.lock
147
149
  - README.md
@@ -418,6 +420,10 @@ files:
418
420
  - lib/bio-ucsc/hgfixed.rb
419
421
  - lib/bio-ucsc/loxafr3.rb
420
422
  - lib/bio-ucsc/mm10.rb
423
+ - lib/bio-ucsc/mm10/est.rb
424
+ - lib/bio-ucsc/mm10/gbstatus.rb
425
+ - lib/bio-ucsc/mm10/intronest.rb
426
+ - lib/bio-ucsc/mm10/mrna.rb
421
427
  - lib/bio-ucsc/mm9.rb
422
428
  - lib/bio-ucsc/mm9/chainbraflo1.rb
423
429
  - lib/bio-ucsc/mm9/chainbraflo1link.rb
@@ -569,7 +575,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
569
575
  version: '0'
570
576
  segments:
571
577
  - 0
572
- hash: -176600740614188306
578
+ hash: 4141800298986362982
573
579
  required_rubygems_version: !ruby/object:Gem::Requirement
574
580
  none: false
575
581
  requirements: