rbbt-entities 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rbbt/entity.rb +37 -13
- data/lib/rbbt/entity/gene.rb +65 -11
- data/lib/rbbt/entity/genomic_mutation.rb +10 -13
- data/lib/rbbt/entity/genotype.rb +17 -21
- data/lib/rbbt/entity/mutated_isoform.rb +22 -6
- data/lib/rbbt/entity/pmid.rb +18 -3
- data/lib/rbbt/entity/protein.rb +8 -9
- data/lib/rbbt/entity/transcript.rb +5 -3
- data/test/rbbt/entity/test_protein.rb +6 -0
- metadata +5 -7
data/lib/rbbt/entity.rb
CHANGED
@@ -2,8 +2,11 @@ require 'rbbt/annotations'
|
|
2
2
|
|
3
3
|
module Entity
|
4
4
|
class << self
|
5
|
-
attr_accessor :formats
|
5
|
+
attr_accessor :formats, :entity_property_cache, :entity_list_cache
|
6
6
|
end
|
7
|
+
|
8
|
+
self.entity_property_cache = "cache/entity_property"
|
9
|
+
self.entity_list_cache = "cache/entity_list"
|
7
10
|
self.formats = {}
|
8
11
|
|
9
12
|
def self.extended(base)
|
@@ -11,15 +14,24 @@ module Entity
|
|
11
14
|
|
12
15
|
Entity.formats[base.to_s] = base
|
13
16
|
base.module_eval do
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
17
|
+
if not methods.include? "prev_entity_extended"
|
18
|
+
class << self
|
19
|
+
attr_accessor :template, :list_template, :action_template, :list_action_template
|
20
|
+
alias prev_entity_extended extended
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.extended(data)
|
24
|
+
prev_entity_extended(data)
|
25
|
+
|
26
|
+
if Array === data and
|
27
|
+
not AnnotatedArray === data and
|
28
|
+
not (Annotated === data.compact.first and (data.annotation_types - data.compact.first.annotation_types).any?)
|
18
29
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
30
|
+
data.extend AnnotatedArray
|
31
|
+
end
|
32
|
+
|
33
|
+
data
|
34
|
+
end
|
23
35
|
end
|
24
36
|
|
25
37
|
def self.format=(formats)
|
@@ -31,10 +43,16 @@ module Entity
|
|
31
43
|
|
32
44
|
def clean_annotations
|
33
45
|
case
|
34
|
-
when
|
35
|
-
self
|
46
|
+
when self.nil?
|
47
|
+
self
|
36
48
|
when String === self
|
37
49
|
"" << self
|
50
|
+
when self.respond_to?(:annotated_array_clean_collect)
|
51
|
+
self.annotated_array_clean_collect{|e| e.respond_to?(:clean_annotations)? e.clean_annotations : e}
|
52
|
+
when Array === self
|
53
|
+
self.collect{|e| e.respond_to?(:clean_annotations)? e.clean_annotations : e}
|
54
|
+
else
|
55
|
+
raise "Unknown casuistic in clean_annotations for object: #{self.inspect}"
|
38
56
|
end
|
39
57
|
end
|
40
58
|
|
@@ -55,7 +73,7 @@ module Entity
|
|
55
73
|
end
|
56
74
|
}
|
57
75
|
end
|
58
|
-
end
|
76
|
+
end
|
59
77
|
end
|
60
78
|
|
61
79
|
def property(name, &block)
|
@@ -112,13 +130,19 @@ module Entity
|
|
112
130
|
UNPERSISTED_PREFIX = "entity_unpersisted_property_"
|
113
131
|
def persist(method_name, type = nil, options = {})
|
114
132
|
type = :memory if type.nil?
|
133
|
+
options = Misc.add_defaults options, :dir => Entity.entity_property_cache
|
115
134
|
|
116
135
|
self.module_eval do
|
117
136
|
orig_name = UNPERSISTED_PREFIX + method_name.to_s
|
118
137
|
alias_method orig_name, method_name unless instance_methods.include? orig_name
|
119
138
|
|
120
139
|
define_method method_name do |*args|
|
121
|
-
|
140
|
+
persist_name = __method__.to_s << ":" << self.id
|
141
|
+
|
142
|
+
persist_options = options
|
143
|
+
persist_options = persist_options.merge(:other => {:args => args}) if args.any?
|
144
|
+
|
145
|
+
Persist.persist(persist_name, type, persist_options) do
|
122
146
|
self.send(orig_name, *args)
|
123
147
|
end
|
124
148
|
end
|
data/lib/rbbt/entity/gene.rb
CHANGED
@@ -47,17 +47,15 @@ module Gene
|
|
47
47
|
end
|
48
48
|
persist :ortholog
|
49
49
|
|
50
|
-
property :to
|
50
|
+
property :to => :array2single do |new_format|
|
51
51
|
return self if format == new_format
|
52
52
|
Gene.setup(Translation.job(:tsv_translate, "", :organism => organism, :genes => self, :format => new_format).exec.values_at(*self), new_format, organism)
|
53
53
|
end
|
54
|
-
persist :to!
|
55
54
|
|
56
|
-
property :
|
55
|
+
property :__to => :array2single do |new_format|
|
57
56
|
return self if format == new_format
|
58
57
|
to!(new_format).collect!{|v| Array === v ? v.first : v}
|
59
58
|
end
|
60
|
-
persist :to
|
61
59
|
|
62
60
|
property :strand => :array2single do
|
63
61
|
Organism.gene_positions(organism).tsv(:fields => ["Strand"], :type => :single, :persist => true).values_at *self
|
@@ -67,12 +65,10 @@ module Gene
|
|
67
65
|
property :ensembl => :array2single do
|
68
66
|
to "Ensembl Gene ID"
|
69
67
|
end
|
70
|
-
persist :ensembl
|
71
68
|
|
72
69
|
property :entrez => :array2single do
|
73
70
|
to "Entrez Gene ID"
|
74
71
|
end
|
75
|
-
persist :entrez
|
76
72
|
|
77
73
|
property :uniprot => :array2single do
|
78
74
|
to "UniProt/SwissProt Accession"
|
@@ -94,9 +90,9 @@ module Gene
|
|
94
90
|
end
|
95
91
|
persist :go_bp_terms
|
96
92
|
|
97
|
-
property :long_name => :
|
98
|
-
|
99
|
-
gene.nil? ? nil : gene.description.flatten.first
|
93
|
+
property :long_name => :array2single do
|
94
|
+
entre = self.entrez
|
95
|
+
gene = Entrez.get_gene(entrez).values_at(*entrez).collect{|gene| gene.nil? ? nil : gene.description.flatten.first}
|
100
96
|
end
|
101
97
|
persist :long_name
|
102
98
|
|
@@ -180,7 +176,7 @@ module Gene
|
|
180
176
|
property :matador_drugs => :array2single do
|
181
177
|
@@matador ||= Matador.protein_drug.tsv(:persist => false).tap{|o| o.unnamed = true}
|
182
178
|
|
183
|
-
ensg = self.
|
179
|
+
ensg = self.to("Ensembl Gene ID")
|
184
180
|
|
185
181
|
transcripts = Gene.ensg2enst(organism, ensg)
|
186
182
|
|
@@ -239,12 +235,70 @@ module Gene
|
|
239
235
|
clean_organism = self.organism.sub(/\/.*/,'') + '/jun2011'
|
240
236
|
names.organism = clean_organism
|
241
237
|
ranges = names.chromosome.zip(name.range).collect do |chromosome, range|
|
238
|
+
next if range.nil?
|
242
239
|
[chromosome, range.begin, range.end] * ":"
|
243
240
|
end
|
244
241
|
Sequence.job(:somatic_snvs_at_genomic_ranges, File.join("Gene", (names.compact.sort * ", ")[0..80]), :organism => clean_organism, :ranges => ranges).fork.join.load.values_at *ranges
|
245
242
|
end
|
246
243
|
persist :somatic_snvs
|
247
244
|
|
248
|
-
end
|
249
245
|
|
246
|
+
property :ihop_interactions => :single do
|
247
|
+
uniprot = self.uniprot
|
248
|
+
url = "http://ws.bioinfo.cnio.es/iHOP/cgi-bin/getSymbolInteractions?ncbiTaxId=9606&reference=#{uniprot}&namespace=UNIPROT__AC"
|
249
|
+
doc = Nokogiri::XML(Open.read(url))
|
250
|
+
sentences = doc.css("iHOPsentence")
|
251
|
+
sentences
|
252
|
+
end
|
253
|
+
|
254
|
+
property :tagged_ihop_interactions => :single do
|
255
|
+
interactors = []
|
256
|
+
ihop_interactions.each do |sentence|
|
257
|
+
sentence.css('iHOPatom').collect{|atom|
|
258
|
+
atom.css('evidence');
|
259
|
+
}.compact.flatten.each do |evidence|
|
260
|
+
symbol = evidence.attr('symbol')
|
261
|
+
taxid = evidence.attr('ncbiTaxId')
|
262
|
+
|
263
|
+
if Organism.entrez_taxids(self.organism).list.include? taxid
|
264
|
+
interactors << symbol
|
265
|
+
end
|
266
|
+
end
|
267
|
+
end
|
268
|
+
|
269
|
+
Gene.setup(interactors, "Associated Gene Name", self.organism).organism
|
270
|
+
|
271
|
+
interactors_ensembl = interactors.ensembl
|
272
|
+
|
273
|
+
interactors2ensembl = {}
|
274
|
+
interactors.collect{|i| i}.zip(interactors_ensembl.collect{|i| i}).each do |o,e|
|
275
|
+
interactors2ensembl[o] = e
|
276
|
+
end
|
277
|
+
|
278
|
+
ihop_interactions.collect do |sentence|
|
279
|
+
sentence.css('iHOPatom').each{|atom|
|
280
|
+
evidences = atom.css('evidence')
|
281
|
+
symbol = evidences.collect do |evidence|
|
282
|
+
symbol = evidence.attr('symbol')
|
283
|
+
taxid = evidence.attr('ncbiTaxId')
|
284
|
+
|
285
|
+
if Organism.entrez_taxids(self.organism).list.include? taxid
|
286
|
+
symbol
|
287
|
+
else
|
288
|
+
nil
|
289
|
+
end
|
290
|
+
end.compact.first
|
291
|
+
|
292
|
+
evidences.remove
|
293
|
+
|
294
|
+
if interactors2ensembl.include? symbol and not interactors2ensembl[symbol].nil?
|
295
|
+
atom.children.remove
|
296
|
+
interactor = interactors2ensembl[symbol]
|
297
|
+
atom.replace interactor.respond_to?(:link)? interactor.link : interactor.name
|
298
|
+
end
|
299
|
+
}
|
300
|
+
sentence.to_s
|
301
|
+
end
|
302
|
+
end
|
303
|
+
end
|
250
304
|
|
@@ -142,7 +142,7 @@ module GenomicMutation
|
|
142
142
|
property :mutated_isoforms => :array2single do
|
143
143
|
res = Sequence.job(:mutated_isoforms_for_genomic_mutations, jobname, :watson => watson, :organism => organism, :mutations => self.clean_annotations).run.values_at *self
|
144
144
|
res.each{|list| list.organism = organism unless list.nil?}
|
145
|
-
res[0].annotate res if res[0].respond_to? :annotate
|
145
|
+
res.compact[0].annotate res if res.compact[0].respond_to? :annotate
|
146
146
|
res
|
147
147
|
end
|
148
148
|
persist :mutated_isoforms
|
@@ -158,22 +158,18 @@ module GenomicMutation
|
|
158
158
|
persist :in_exon_junction?
|
159
159
|
|
160
160
|
property :over_gene? => :array2single do |gene|
|
161
|
-
|
162
|
-
range = gene.range
|
163
|
-
chromosome = gene.chromosome
|
164
|
-
else
|
165
|
-
range = Gene.setup(gene.dup, "Ensembl Gene ID", organism).range
|
166
|
-
chromosome = Gene.setup(gene.dup, "Ensembl Gene ID", organism).chromosome
|
167
|
-
end
|
161
|
+
gene = Gene.setup(gene.dup, "Ensembl Gene ID", organism) unless Gene === gene
|
168
162
|
|
169
|
-
|
163
|
+
gene_range = gene.range
|
164
|
+
gene_chromosome = gene.chromosome
|
165
|
+
|
166
|
+
if gene_range.nil?
|
170
167
|
[false] * self.length
|
171
168
|
else
|
172
|
-
chromosome.zip(position).collect{|chr,pos| chr ==
|
169
|
+
chromosome.zip(position).collect{|chr,pos| chr == gene_chromosome and gene_range.include? pos}
|
173
170
|
end
|
174
|
-
|
175
|
-
#genes.clean_annotations.collect{|list| list.include? gene}
|
176
171
|
end
|
172
|
+
persist :over_gene?
|
177
173
|
|
178
174
|
property :affected_exons => :array2single do
|
179
175
|
Sequence.job(:exons_at_genomic_positions, jobname, :organism => organism, :positions => self.clean_annotations).run.values_at *self
|
@@ -181,9 +177,10 @@ module GenomicMutation
|
|
181
177
|
persist :affected_exons
|
182
178
|
|
183
179
|
property :damaging? => :array2single do |*args|
|
180
|
+
damaged_mutated_isoforms = mutated_isoforms.compact.flatten.select{|mi| mi.damaged?(*args)}
|
184
181
|
exon_junctions.zip(mutated_isoforms).collect do |exs, mis|
|
185
182
|
(Array === exs and exs.any?) or
|
186
|
-
(Array === mis and mis
|
183
|
+
(Array === mis and (damaged_mutated_isoforms & mis).any?)
|
187
184
|
end
|
188
185
|
end
|
189
186
|
persist :damaging?
|
data/lib/rbbt/entity/genotype.rb
CHANGED
@@ -20,6 +20,7 @@ module Genotype
|
|
20
20
|
|
21
21
|
module Cohort
|
22
22
|
extend Workflow
|
23
|
+
extend Entity
|
23
24
|
|
24
25
|
if self.respond_to? :extended
|
25
26
|
class << self
|
@@ -30,26 +31,6 @@ module Genotype
|
|
30
31
|
def self.extended(cohort)
|
31
32
|
prev_genotype_cohort_extended(cohort) if self.respond_to? :prev_genotype_cohort_extended
|
32
33
|
|
33
|
-
class << cohort
|
34
|
-
attr_accessor :metagenotype
|
35
|
-
|
36
|
-
def jobname
|
37
|
-
if @jobname.nil?
|
38
|
-
@jobname ||= "Meta-genotype: " + self.collect{|g| g.jobname} * ", "
|
39
|
-
@jobname[100..-1] = " (etc; #{self.length} genotypes)" if @jobname.length > 100
|
40
|
-
end
|
41
|
-
@jobname
|
42
|
-
end
|
43
|
-
|
44
|
-
def metagenotype
|
45
|
-
if @metagenotype.nil?
|
46
|
-
@metagenotype = GenomicMutation.setup(self.dup.flatten, jobname, self[0].organism, self[0].orig_watson)
|
47
|
-
@metagenotype.extend Genotype unless Genotype === @metagenotype
|
48
|
-
end
|
49
|
-
@metagenotype
|
50
|
-
end
|
51
|
-
end unless cohort.respond_to? :metagenotype
|
52
|
-
|
53
34
|
cohort.each do |genotype| genotype.extend Genotype unless Genotype === genotype end
|
54
35
|
|
55
36
|
cohort.helper :metagenotype do
|
@@ -68,6 +49,19 @@ module Genotype
|
|
68
49
|
new.extend Cohort
|
69
50
|
end
|
70
51
|
|
52
|
+
def jobname
|
53
|
+
if @jobname.nil?
|
54
|
+
@jobname ||= "Meta-genotype: " + self.collect{|g| g.jobname} * ", "
|
55
|
+
@jobname[100..-1] = " (etc; #{self.length} genotypes)" if @jobname.length > 100
|
56
|
+
end
|
57
|
+
@jobname
|
58
|
+
end
|
59
|
+
|
60
|
+
def metagenotype
|
61
|
+
GenomicMutation.setup(self.dup.flatten, jobname, self[0].organism, self[0].orig_watson).extend Genotype
|
62
|
+
end
|
63
|
+
|
64
|
+
|
71
65
|
returns "Ensembl Gene ID"
|
72
66
|
task :all_affected_genes => :array do
|
73
67
|
set_info :organism, metagenotype.organism
|
@@ -145,9 +139,11 @@ module Genotype
|
|
145
139
|
task :truncated => :array do
|
146
140
|
set_info :organism, genotype.organism
|
147
141
|
truncated_isoforms = MutatedIsoform.setup(genotype.mutated_isoforms.flatten.compact, "Hsa/jun2011").select{|isoform_mutation| isoform_mutation.truncated }
|
142
|
+
|
148
143
|
proteins = truncated_isoforms.protein
|
149
144
|
genes = proteins.gene
|
150
|
-
genes.to("Ensembl Gene ID").uniq
|
145
|
+
genes = genes.to("Ensembl Gene ID").uniq
|
146
|
+
genes.respond_to?(:clean_annotations)? genes.clean_annotations : genes
|
151
147
|
end
|
152
148
|
|
153
149
|
returns "Ensembl Gene ID"
|
@@ -8,6 +8,8 @@ require 'rbbt/sources/uniprot'
|
|
8
8
|
require 'rbbt/entity/gene'
|
9
9
|
require 'nokogiri'
|
10
10
|
|
11
|
+
Workflow.require_workflow 'structure'
|
12
|
+
|
11
13
|
module MutatedIsoform
|
12
14
|
extend Entity
|
13
15
|
self.annotation :organism
|
@@ -51,11 +53,13 @@ module MutatedIsoform
|
|
51
53
|
|
52
54
|
property :marked_svg => :single2array do
|
53
55
|
svg = Open.read(protein.ensembl_protein_image_url)
|
56
|
+
|
54
57
|
seq_len = protein.sequence_length
|
55
58
|
position = self.position
|
56
59
|
|
57
60
|
|
58
61
|
doc = Nokogiri::XML(svg)
|
62
|
+
return nil unless doc.css('svg')
|
59
63
|
width = doc.css('svg').first.attr('width').to_f
|
60
64
|
height = doc.css('svg').first.attr('height').to_f
|
61
65
|
start = doc.css('rect.ac').first.attr('x').to_f
|
@@ -95,7 +99,9 @@ module MutatedIsoform
|
|
95
99
|
|
96
100
|
property :truncated => :array2single do
|
97
101
|
begin
|
98
|
-
|
102
|
+
proteins = self.protein.compact.flatten
|
103
|
+
protein2sequence_length = Misc.process_to_hash(proteins){|list| proteins.sequence_length}
|
104
|
+
|
99
105
|
self.collect do |isoform_mutation|
|
100
106
|
|
101
107
|
next if isoform_mutation.consequence != "FRAMESHIFT" and isoform_mutation.consequence != "NONSENSE"
|
@@ -196,12 +202,10 @@ module MutatedIsoform
|
|
196
202
|
uniprot_change
|
197
203
|
end.compact
|
198
204
|
|
199
|
-
#return TSV.setup({}, :key_field => "Mutated Isoform", :fields => ["Func. Impact"], :type => :list) if list.empty?
|
200
205
|
return [nil] * self.length if list.empty?
|
201
206
|
|
202
207
|
tsv = MutationAssessor.chunked_predict(list.sort_by{|p| p * "_"})
|
203
208
|
|
204
|
-
#return TSV.setup({}, :key_field => "Mutated Isoform", :fields => ["Func. Impact"], :type => :list) if tsv.nil? or tsv.empty?
|
205
209
|
return [nil] * self.length if tsv.empty?
|
206
210
|
|
207
211
|
new = TSV.setup({}, :key_field => "Mutated Isoform", :fields => ["Func. Impact"], :type => :list)
|
@@ -209,8 +213,13 @@ module MutatedIsoform
|
|
209
213
|
tsv.each do |key, values|
|
210
214
|
uniprot, change = key.split(" ")
|
211
215
|
uniprot_change = [uniprot.upcase, change.upcase]
|
212
|
-
|
213
|
-
|
216
|
+
|
217
|
+
if correspondance.include? uniprot_change
|
218
|
+
correspondance[uniprot_change].each do |mutation|
|
219
|
+
new[mutation] = values["Func. Impact"]
|
220
|
+
end
|
221
|
+
else
|
222
|
+
Log.medium "Correspondace value missing: #{uniprot_change.inspect}"
|
214
223
|
end
|
215
224
|
end
|
216
225
|
|
@@ -230,7 +239,14 @@ module MutatedIsoform
|
|
230
239
|
property :pdbs => :single do
|
231
240
|
uniprot = self.transcript.protein.uniprot
|
232
241
|
next if uniprot.nil?
|
233
|
-
|
242
|
+
UniProt.pdbs_covering_aa_position(uniprot, self.position)
|
234
243
|
end
|
235
244
|
persist :pdbs
|
245
|
+
|
246
|
+
property :pdbs_and_positions => :single do
|
247
|
+
pdbs.collect do |pdb, info|
|
248
|
+
[pdb, Structure.job(:sequence_position_in_pdb, "Protein: #{ self }", :sequence => protein.sequence, :organism => organism, :position => position, :pdb => pdb).run]
|
249
|
+
end
|
250
|
+
end
|
236
251
|
end
|
252
|
+
|
data/lib/rbbt/entity/pmid.rb
CHANGED
@@ -1,25 +1,40 @@
|
|
1
1
|
require 'rbbt/entity'
|
2
|
+
require 'rbbt/entity/document'
|
2
3
|
require 'rbbt/sources/pubmed'
|
3
4
|
|
4
5
|
module PMID
|
5
6
|
extend Entity
|
7
|
+
include Document
|
6
8
|
|
7
9
|
self.format = "PMID"
|
8
10
|
|
9
11
|
property :article => :array2single do
|
10
12
|
PubMed.get_article(self).values_at(*self)
|
11
13
|
end
|
12
|
-
|
14
|
+
|
15
|
+
property :abstract => :array2single do
|
16
|
+
article.collect{|a| a.nil? ? nil : a.abstract}
|
17
|
+
end
|
18
|
+
persist :abstract
|
13
19
|
|
14
20
|
property :title => :array2single do
|
15
21
|
article.collect{|a| a.nil? ? nil : a.title}
|
16
22
|
end
|
17
23
|
persist :title
|
18
24
|
|
19
|
-
property :
|
25
|
+
property :journal => :array2single do
|
26
|
+
article.collect{|a| a.nil? ? nil : a.journal}
|
27
|
+
end
|
28
|
+
persist :journal
|
29
|
+
|
30
|
+
property :year => :array2single do
|
31
|
+
article.collect{|a| a.nil? ? nil : a.year}
|
32
|
+
end
|
33
|
+
persist :year
|
34
|
+
|
35
|
+
property :_get_text => :array2single do
|
20
36
|
article.collect{|a| a.nil? ? nil : a.text}
|
21
37
|
end
|
22
|
-
persist :text
|
23
38
|
|
24
39
|
property :pubmed_url => :single2array do
|
25
40
|
"<a class='pmid' href='http://www.ncbi.nlm.nih.gov/pubmed/#{self}'>#{ self }</a>"
|
data/lib/rbbt/entity/protein.rb
CHANGED
@@ -36,17 +36,17 @@ module Protein
|
|
36
36
|
property :uniprot => :array2single do
|
37
37
|
to "UniProt/SwissProt Accession"
|
38
38
|
end
|
39
|
-
persist :uniprot
|
40
39
|
|
41
40
|
property :ensembl => :array2single do
|
42
41
|
to "Ensembl Protein ID"
|
43
42
|
end
|
44
|
-
persist :ensembl
|
45
43
|
|
46
44
|
property :transcript => :array2single do
|
47
|
-
ensembl.collect{|ensp|
|
45
|
+
res = ensembl.collect{|ensp|
|
48
46
|
Protein.ensp2enst(organism, ensp)
|
49
47
|
}
|
48
|
+
Transcript.setup(res, "Ensembl Transcript ID", self.organism) if defined? Transcript
|
49
|
+
res
|
50
50
|
end
|
51
51
|
persist :transcript
|
52
52
|
|
@@ -56,22 +56,20 @@ module Protein
|
|
56
56
|
end
|
57
57
|
persist :ensembl_protein_image_url
|
58
58
|
|
59
|
-
property :to
|
59
|
+
property :to => :array2single do |new_format|
|
60
60
|
return self if format == new_format
|
61
|
-
Protein.setup(Translation.job(:
|
61
|
+
Protein.setup(Translation.job(:tsv_translate_protein, "", :organism => organism, :proteins => self, :format => new_format).exec.values_at(*self), new_format, organism)
|
62
62
|
end
|
63
|
-
persist :to!
|
64
63
|
|
65
|
-
property :
|
64
|
+
property :__to => :array2single do |new_format|
|
66
65
|
return self if format == new_format
|
67
66
|
to!(new_format).collect!{|v| v.nil? ? nil : v.first}
|
68
67
|
end
|
69
|
-
persist :to
|
70
68
|
|
71
69
|
property :gene => :array do
|
72
70
|
Gene.setup(to("Ensembl Protein ID").clean_annotations, "Ensembl Protein ID", organism)
|
73
71
|
end
|
74
|
-
persist :gene
|
72
|
+
persist :gene #, :yaml, :file => '/tmp/testes'
|
75
73
|
|
76
74
|
property :pfam => :array2single do
|
77
75
|
index = Organism.gene_pfam(organism).tsv :flat, :persist => true
|
@@ -90,5 +88,6 @@ module Protein
|
|
90
88
|
sequence.collect{|seq| seq.nil? ? nil : seq.length}
|
91
89
|
end
|
92
90
|
persist :sequence_length
|
91
|
+
|
93
92
|
end
|
94
93
|
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'rbbt/entity'
|
2
|
-
require 'rbbt/entity/gene'
|
3
2
|
|
4
3
|
module Transcript
|
5
4
|
extend Entity
|
@@ -17,7 +16,8 @@ module Transcript
|
|
17
16
|
else
|
18
17
|
@@enst2ensg[organism][transcript]
|
19
18
|
end
|
20
|
-
Gene.setup(res, "Ensembl Gene ID", organism)
|
19
|
+
Gene.setup(res, "Ensembl Gene ID", organism) if defined? Gene
|
20
|
+
res
|
21
21
|
end
|
22
22
|
|
23
23
|
def self.enst2ensp(organism, transcript)
|
@@ -34,7 +34,9 @@ module Transcript
|
|
34
34
|
|
35
35
|
property :to! => :array2single do |new_format|
|
36
36
|
return self if format == new_format
|
37
|
-
|
37
|
+
res = Translation.job(:tsv_translate_probe, "", :organism => organism, :probes => self, :format => new_format).exec.values_at(*self)
|
38
|
+
Gene.setup(res, "Ensembl Gene ID", organism) if defined? Gene
|
39
|
+
res
|
38
40
|
end
|
39
41
|
|
40
42
|
property :to => :array2single do |new_format|
|
@@ -4,6 +4,7 @@ require 'test/unit'
|
|
4
4
|
require 'rbbt/util/tmpfile'
|
5
5
|
require 'test/unit'
|
6
6
|
require 'rbbt/entity/protein'
|
7
|
+
require 'rbbt/entity/mutated_isoform'
|
7
8
|
|
8
9
|
class TestProtein < Test::Unit::TestCase
|
9
10
|
PROTEIN = Protein.setup("ENSP00000275493", "Hsa/jun2011")
|
@@ -22,6 +23,11 @@ class TestProtein < Test::Unit::TestCase
|
|
22
23
|
assert_equal "EGFR", PROTEIN.gene.to("Associated Gene Name")
|
23
24
|
end
|
24
25
|
|
26
|
+
def test_protein
|
27
|
+
ddd MutatedIsoform.setup(["ENSP00000322422:K168FrameShift"], "Hsa/may2009").info
|
28
|
+
ddd MutatedIsoform.setup(["ENSP00000322422:K168FrameShift"], "Hsa/may2009").protein
|
29
|
+
end
|
30
|
+
|
25
31
|
end
|
26
32
|
|
27
33
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbbt-entities
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 1.1.
|
9
|
+
- 1
|
10
|
+
version: 1.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Miguel Vazquez
|
@@ -15,8 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-01-
|
19
|
-
default_executable:
|
18
|
+
date: 2012-01-31 00:00:00 Z
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
21
|
name: rbbt-util
|
@@ -86,7 +85,6 @@ files:
|
|
86
85
|
- test/rbbt/entity/test_mutated_isoform.rb
|
87
86
|
- test/rbbt/entity/test_protein.rb
|
88
87
|
- test/rbbt/test_entity.rb
|
89
|
-
has_rdoc: true
|
90
88
|
homepage: http://github.com/mikisvaz/rbbt-util
|
91
89
|
licenses: []
|
92
90
|
|
@@ -116,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
116
114
|
requirements: []
|
117
115
|
|
118
116
|
rubyforge_project:
|
119
|
-
rubygems_version: 1.
|
117
|
+
rubygems_version: 1.8.12
|
120
118
|
signing_key:
|
121
119
|
specification_version: 3
|
122
120
|
summary: Entities for the Ruby Bioinformatics Toolkit (rbbt)
|