exodb 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/exodb.rb +2 -0
- data/lib/exodb/datamodel/locationfield.rb +16 -2
- data/lib/exodb/datamodel/reference.rb +17 -18
- data/lib/exodb/datamodel/region.rb +33 -6
- data/lib/exodb/datamodel/source.rb +0 -1
- data/lib/exodb/datamodel/variant.rb +2 -6
- data/lib/exodb/exception.rb +4 -0
- data/lib/exodb/usermanage.rb +3 -3
- data/lib/exodb/utils.rb +1 -0
- data/lib/exodb/utils/upload_generef.rb +2 -2
- data/lib/exodb/utils/upload_var.rb +10 -0
- data/lib/exodb/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f59876f64775ac85fda8bbb7db9a06e253ab39b8
|
4
|
+
data.tar.gz: 978e13f8048b2cabea0cfe4fc96a9da6e42b97fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ceca94da8429c39dee7e1baa9d96f5a88f8860cbf1c185ee2439845d0c93d3a63605bc4d2e6bc7c33c3e1d5c0c424e1d37a1f7557ce8a96baa303ca692a78f55
|
7
|
+
data.tar.gz: 1d20bb30b30b1aea8a612abd255c02f985a2b6fdcc6dd38431f387c2fc3335e56fd5261b38adefb58655d064cb6fef074e11d725af871768269b4bef2b44e9ee
|
data/lib/exodb.rb
CHANGED
@@ -11,12 +11,14 @@
|
|
11
11
|
|
12
12
|
module Exodb
|
13
13
|
|
14
|
-
module
|
14
|
+
module GenomeLocationField
|
15
15
|
|
16
16
|
extend ActiveSupport::Concern
|
17
17
|
|
18
18
|
included do
|
19
19
|
field :location, type: Hash #{chromosome: '', start: x, stop: x}
|
20
|
+
field :strand, type: String
|
21
|
+
|
20
22
|
index({location: 1}, background: true)
|
21
23
|
end
|
22
24
|
|
@@ -73,7 +75,19 @@ module Exodb
|
|
73
75
|
self[:location]['stop']
|
74
76
|
end
|
75
77
|
|
76
|
-
|
78
|
+
# get the start position of gene rely on the genome
|
79
|
+
#
|
80
|
+
# @return [Integer] start position of gene
|
81
|
+
def begin
|
82
|
+
self[:strand] == '+' ? self[:location]['start'] : self[:location]['stop']
|
83
|
+
end
|
84
|
+
|
85
|
+
# get the start position of gene rely on the genome
|
86
|
+
#
|
87
|
+
# @return [Integer] start position of gene
|
88
|
+
def end
|
89
|
+
self[:strand] == '+' ? self[:location]['stop'] : self[:location]['start']
|
90
|
+
end
|
77
91
|
|
78
92
|
# get the chromosome
|
79
93
|
#
|
@@ -28,14 +28,14 @@ module Exodb
|
|
28
28
|
PATTERN = /(?<gene>[A-Z0-9]+)-?(?<position>[0-9,]*|[is]?)(?<to>[A-Z=]*)/
|
29
29
|
SILENTSIGN = '='
|
30
30
|
|
31
|
-
include Exodb::
|
31
|
+
include Exodb::GenomeLocationField
|
32
32
|
|
33
33
|
field :reference, type: String
|
34
34
|
field :alternate, type: String
|
35
35
|
|
36
36
|
end
|
37
37
|
|
38
|
-
class
|
38
|
+
class Occurrent
|
39
39
|
|
40
40
|
include Mongoid::Document
|
41
41
|
|
@@ -50,19 +50,18 @@ module Exodb
|
|
50
50
|
|
51
51
|
class Generef < Reference
|
52
52
|
|
53
|
-
include Exodb::
|
53
|
+
include Exodb::GenomeLocationField
|
54
54
|
|
55
55
|
field :sequence, type: String
|
56
56
|
field :chrrefseq, type: String # refseq id of chromomose
|
57
|
-
field :strand, type: String
|
58
57
|
field :psuedo, type: Boolean
|
59
58
|
field :genomeref, type: String
|
60
59
|
|
61
60
|
index({sequence: 'text'}, background: true)
|
62
61
|
|
63
62
|
has_many :genes
|
64
|
-
embeds_many :
|
65
|
-
embeds_many :
|
63
|
+
embeds_many :isoforms
|
64
|
+
embeds_many :occurrents
|
66
65
|
|
67
66
|
validates_format_of :chrrefseq, with: /\A(urn:miriam:refseq)/
|
68
67
|
|
@@ -114,7 +113,7 @@ module Exodb
|
|
114
113
|
|
115
114
|
# Download incident data from TCGA
|
116
115
|
#
|
117
|
-
def
|
116
|
+
def dl_occurrent!
|
118
117
|
|
119
118
|
if self.get_xref('urn:miriam:hgnc.symbol')
|
120
119
|
|
@@ -124,7 +123,7 @@ module Exodb
|
|
124
123
|
f.each_line {|line| cancerstudies.push(line.chomp.split("\t")[0])}
|
125
124
|
}
|
126
125
|
|
127
|
-
|
126
|
+
occurrents = {}
|
128
127
|
totalcase = {}
|
129
128
|
|
130
129
|
cancerstudies.each do |study|
|
@@ -137,7 +136,7 @@ module Exodb
|
|
137
136
|
end
|
138
137
|
end
|
139
138
|
|
140
|
-
|
139
|
+
occurrents[study] = {} if !occurrents.has_key?(study)
|
141
140
|
|
142
141
|
open("http://www.cbioportal.org/public-portal/webservice.do?cmd=getMutationData&genetic_profile_id=#{study}_mutations&gene_list=#{self.get_xref('urn:miriam:hgnc.symbol').id}") do |f|
|
143
142
|
f.each_line do |line|
|
@@ -145,8 +144,8 @@ module Exodb
|
|
145
144
|
|
146
145
|
if dat[5] == 'Missense_Mutation'
|
147
146
|
|
148
|
-
|
149
|
-
|
147
|
+
occurrents[study][dat[7].split(/(\d+)/)[1]] = [] if !occurrents[study].has_key?(dat[7].split(/(\d+)/)[1])
|
148
|
+
occurrents[study][dat[7].split(/(\d+)/)[1]].push(dat[2])
|
150
149
|
|
151
150
|
end
|
152
151
|
|
@@ -156,11 +155,11 @@ module Exodb
|
|
156
155
|
end
|
157
156
|
end
|
158
157
|
|
159
|
-
self.
|
158
|
+
self.occurrents.clear if self.occurrents
|
160
159
|
|
161
|
-
|
160
|
+
occurrents.each_pair do |cancertype, v|
|
162
161
|
v.each_pair do |position, occur|
|
163
|
-
self.
|
162
|
+
self.occurrents << Occurrent.new({cancertype: cancertype, position: position, occur: occur.uniq.sort, casenumber: totalcase[cancertype]})
|
164
163
|
end
|
165
164
|
end
|
166
165
|
|
@@ -181,7 +180,7 @@ module Exodb
|
|
181
180
|
def longest_splice()
|
182
181
|
length = 0
|
183
182
|
longest = nil
|
184
|
-
self.
|
183
|
+
self.isoforms.each do |e|
|
185
184
|
|
186
185
|
if e.prot_len > length
|
187
186
|
length = e.prot_len
|
@@ -197,7 +196,7 @@ module Exodb
|
|
197
196
|
#
|
198
197
|
# @return [Boolean] true if has any splices
|
199
198
|
def has_splices?
|
200
|
-
return self.
|
199
|
+
return self.isoforms.exists?
|
201
200
|
end
|
202
201
|
|
203
202
|
# Check if Generef has sequence
|
@@ -231,7 +230,7 @@ module Exodb
|
|
231
230
|
|
232
231
|
end
|
233
232
|
|
234
|
-
class
|
233
|
+
class Isoform
|
235
234
|
|
236
235
|
include Mongoid::Document
|
237
236
|
|
@@ -375,7 +374,7 @@ module Exodb
|
|
375
374
|
|
376
375
|
seqlen = self.get_cds_seq(pos).length
|
377
376
|
if seqlen != 0
|
378
|
-
return [(seqlen - 1) / 3, (seqlen - 1) % 3]
|
377
|
+
return [((seqlen - 1) / 3) + 1, ((seqlen - 1) % 3) + 1]
|
379
378
|
else
|
380
379
|
return []
|
381
380
|
end
|
@@ -22,29 +22,56 @@ module Exodb
|
|
22
22
|
class Gene < Region
|
23
23
|
|
24
24
|
include Mongoid::Versioning
|
25
|
-
include Exodb::
|
25
|
+
include Exodb::GenomeLocationField
|
26
26
|
|
27
27
|
field :symbol, type: String
|
28
28
|
field :loh, type: Boolean
|
29
29
|
|
30
|
-
embeds_many :
|
30
|
+
embeds_many :changes
|
31
31
|
belongs_to :generef
|
32
32
|
belongs_to :cell
|
33
33
|
|
34
34
|
index({'symbol' => 1, 'aacids.position' => 1}, background: true)
|
35
35
|
end
|
36
36
|
|
37
|
-
class
|
37
|
+
class Change
|
38
38
|
|
39
|
-
|
39
|
+
include Mongoid::Document
|
40
|
+
include Mongoid::Timestamps
|
41
|
+
|
42
|
+
embedded_in :gene
|
43
|
+
has_many :variants
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
class Onexon < Change
|
48
|
+
|
49
|
+
field :aaposition, type: Integer # position referenced to the first codon from the longest splice variant
|
40
50
|
field :refcodon, type: String
|
41
51
|
field :refaa, type: String
|
42
52
|
field :altcodon, type: Hash
|
43
53
|
field :inhcodon, type: Hash
|
44
54
|
field :isoform, type: Array
|
45
55
|
|
46
|
-
|
47
|
-
|
56
|
+
end
|
57
|
+
|
58
|
+
class Aa < Onexon
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
class Lossgain < Onexon
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
class Offexon < Change
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
class Splice < Offexon
|
71
|
+
|
72
|
+
end
|
73
|
+
|
74
|
+
class Utr < Offexon
|
48
75
|
|
49
76
|
end
|
50
77
|
|
@@ -17,7 +17,7 @@ module Exodb
|
|
17
17
|
include Mongoid::Versioning
|
18
18
|
include Mongoid::Timestamps
|
19
19
|
|
20
|
-
include Exodb::
|
20
|
+
include Exodb::GenomeLocationField
|
21
21
|
|
22
22
|
#max_versions 5
|
23
23
|
|
@@ -74,11 +74,7 @@ module Exodb
|
|
74
74
|
|
75
75
|
end
|
76
76
|
|
77
|
-
class
|
78
|
-
|
79
|
-
end
|
80
|
-
|
81
|
-
class Indel < Variant
|
77
|
+
class Indel < Variant #
|
82
78
|
|
83
79
|
end
|
84
80
|
|
data/lib/exodb/exception.rb
CHANGED
data/lib/exodb/usermanage.rb
CHANGED
@@ -68,16 +68,16 @@ module Exodb
|
|
68
68
|
# @param [String] database that user created
|
69
69
|
def create_rwuser(username)
|
70
70
|
|
71
|
-
create_user(username, Mongoid.session.options[:database], "readWrite")
|
71
|
+
create_user(username, Mongoid.session(:default).options[:database], "readWrite")
|
72
72
|
|
73
73
|
end
|
74
74
|
|
75
75
|
# To create a read-only user
|
76
76
|
#
|
77
77
|
# @param (see #create_rwuser)
|
78
|
-
def
|
78
|
+
def create_rouser(username)
|
79
79
|
|
80
|
-
create_user(username, Mongoid.session.options[:database], "read")
|
80
|
+
create_user(username, Mongoid.session(:default).options[:database], "read")
|
81
81
|
|
82
82
|
end
|
83
83
|
|
data/lib/exodb/utils.rb
CHANGED
@@ -140,13 +140,13 @@ module Exodb
|
|
140
140
|
|
141
141
|
v[:childs].each do |child|
|
142
142
|
|
143
|
-
rna =
|
143
|
+
rna = Isoform.new()
|
144
144
|
data = genes[child]
|
145
145
|
rna.xrefs = data[:xrefs]
|
146
146
|
rna.exon = data[:exon].sort
|
147
147
|
rna.cds = data[:cds].sort
|
148
148
|
|
149
|
-
gene.
|
149
|
+
gene.isoforms.push(rna)
|
150
150
|
|
151
151
|
end
|
152
152
|
|
data/lib/exodb/version.rb
CHANGED