ensembl 0.0.7 → 0.0.9

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 16d2860f71a33c2c465b0fccf217377d71d583d9
4
- data.tar.gz: bb8022c713d11e6fcc6c5baed00676bb3d9edd93
3
+ metadata.gz: 9184473a4f510dc3c745429272faf91ece792c13
4
+ data.tar.gz: b2cf56a525faae69a4ef6d1555e1fcdd193738af
5
5
  SHA512:
6
- metadata.gz: cdf044fbd9e8c20534d035448afc3b2ee272ed229ebdca887e66f982f17881039b91e3ea8cc1186993893c45a130a9900f48e019046143807bf8d39dd47b3d95
7
- data.tar.gz: 8f0aba8e3951d048296d4baab25e65e82d3c4244918856bd5890e43c9be2262d191a37b5e7c0d42e6ddc32659983ea34b28167a957021b04158d73b58e26bb1f
6
+ metadata.gz: 116db18ee8d13e996dbe637dbfee8e50a3a0bc6fa8774c5097bc9b4543650e87dcd0d31df25355323e15698760bdc337f7841da1b945e23cc4fa09ea2ff364e2
7
+ data.tar.gz: 9e6f98c89c2c3018b930478144b2e17207ae166fed90b0425aab18b0ddec924c2153177e26880e9efdba67ebe5acd6df16607193c1e6b93e996f8ade840d45e6
@@ -7,12 +7,16 @@ module Ensembl
7
7
  end
8
8
  end
9
9
 
10
+ # ConnectionPool implemented from:
11
+ # http://www.lucasallan.com/2014/05/26/fixing-concurrency-issues-with-active-record-in-a-rack-application.html
10
12
  class Connection < ActiveRecord::Base
11
- self.extend TableNameOverrides
13
+ self.extend Ensembl::TableNameOverrides
14
+ self.extend Ensembl::ConnectionPool
12
15
 
13
16
  self.abstract_class = true
14
17
 
15
18
  self.establish_connection :core
19
+
16
20
  end
17
21
 
18
22
  class ModelBase < Connection
@@ -2,8 +2,13 @@ require 'active_record'
2
2
 
3
3
  module Ensembl
4
4
  module Variation
5
+
6
+ # ConnectionPool implemented from:
7
+ # http://www.lucasallan.com/2014/05/26/fixing-concurrency-issues-with-active-record-in-a-rack-application.html
5
8
  class Connection < ActiveRecord::Base
6
- self.extend TableNameOverrides
9
+
10
+ self.extend Ensembl::TableNameOverrides
11
+ self.extend Ensembl::ConnectionPool
7
12
 
8
13
  self.abstract_class = true
9
14
 
@@ -234,15 +239,17 @@ module Ensembl
234
239
  belongs_to :study
235
240
  belongs_to :seq_region, class_name: 'Ensembl::Core::SeqRegion'
236
241
 
242
+ has_one :variation, primary_key: 'object_id', foreign_key: 'name'
243
+
237
244
  has_many :phenotype_feature_attribs
238
245
  has_many :attrib_types, through: :phenotype_feature_attribs
239
246
 
240
247
  scope :significant, -> { where(is_significant: true )}
241
248
  scope :with_studies, -> { where.not(study_id:nil)}
242
249
 
243
- def variation
244
- Variation.find_by name: object_id
245
- end
250
+ # def variation
251
+ # Variation.find_by name: object_id
252
+ # end
246
253
 
247
254
  def risk_allele
248
255
  pf=phenotype_feature_attribs.risk_alleles.first
@@ -489,7 +496,7 @@ module Ensembl
489
496
  end
490
497
 
491
498
  def all_phenotype_features
492
- object_ids = synonyms
499
+ object_ids = synonym_names
493
500
  object_ids<<name
494
501
  PhenotypeFeature.eager_load(:phenotype).where(object_id: object_ids, type: 'Variation')
495
502
  end
@@ -1,3 +1,3 @@
1
1
  module Ensembl
2
- VERSION = '0.0.7'
2
+ VERSION = '0.0.9'
3
3
  end
data/lib/ensembl.rb CHANGED
@@ -19,18 +19,17 @@ module Ensembl
19
19
  end
20
20
  end
21
21
 
22
- # module AttributeLike
23
- # def a_like(attribute, string, search_type=:between)
24
- # at=self.arel_table
25
- # if search_type == :ends_with
26
- # where(at[attribute].matches("%#{string}"))
27
- # elsif search_type == :starts_with
28
- # where(at[attribute].matches("#{string}%"))
29
- # else
30
- # where(at[attribute].matches("%#{string}%"))
31
- # end
32
- # end
33
- # end
22
+ # ConnectionPool implemented from:
23
+ # http://www.lucasallan.com/2014/05/26/fixing-concurrency-issues-with-active-record-in-a-rack-application.html
24
+ module ConnectionPool
25
+ singleton_class.send(:alias_method, :original_connection, :connection)
26
+
27
+ def self.connection
28
+ ActiveRecord::Base.connection_pool.with_connection do |conn|
29
+ conn
30
+ end
31
+ end
32
+ end
34
33
  end
35
34
 
36
35
  require File.dirname(__FILE__) + '/ensembl/helpers/like_search.rb'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ensembl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kristjan Metsalu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-12 00:00:00.000000000 Z
11
+ date: 2014-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mysql2