bio 1.5.2 → 1.6.0.pre.20181210
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +12 -11
- data/ChangeLog +14 -3106
- data/{gemfiles/Gemfile.travis-ruby2.2 → Gemfile} +0 -1
- data/KNOWN_ISSUES.rdoc +0 -5
- data/README.rdoc +11 -18
- data/RELEASE_NOTES.rdoc +34 -291
- data/Rakefile +13 -9
- data/appveyor.yml +21 -0
- data/bioruby.gemspec +7 -78
- data/bioruby.gemspec.erb +8 -27
- data/doc/ChangeLog-1.5.0 +2919 -0
- data/doc/RELEASE_NOTES-1.5.0.rdoc +285 -0
- data/doc/Tutorial.rd +6 -108
- data/doc/Tutorial.rd.html +19 -98
- data/gemfiles/Gemfile.travis-jruby1.8 +3 -5
- data/gemfiles/Gemfile.travis-jruby1.9 +0 -3
- data/gemfiles/Gemfile.travis-rbx +0 -1
- data/gemfiles/Gemfile.travis-ruby1.8 +4 -4
- data/gemfiles/Gemfile.travis-ruby1.9 +0 -1
- data/gemfiles/prepare-gemspec.rb +4 -0
- data/lib/bio.rb +0 -10
- data/lib/bio/data/codontable.rb +99 -3
- data/lib/bio/io/togows.rb +5 -5
- data/lib/bio/version.rb +6 -8
- data/sample/test_restriction_enzyme_long.rb +1 -1
- data/test/unit/bio/data/test_codontable.rb +3 -0
- metadata +11 -77
- data/bin/bioruby +0 -47
- data/bin/br_biofetch.rb +0 -71
- data/bin/br_bioflat.rb +0 -293
- data/bin/br_biogetseq.rb +0 -45
- data/bin/br_pmfetch.rb +0 -422
- data/lib/bio/db/biosql/biosql_to_biosequence.rb +0 -78
- data/lib/bio/db/biosql/sequence.rb +0 -444
- data/lib/bio/db/phyloxml/phyloxml.xsd +0 -582
- data/lib/bio/db/phyloxml/phyloxml_elements.rb +0 -1197
- data/lib/bio/db/phyloxml/phyloxml_parser.rb +0 -1001
- data/lib/bio/db/phyloxml/phyloxml_writer.rb +0 -227
- data/lib/bio/io/biosql/ar-biosql.rb +0 -257
- data/lib/bio/io/biosql/biosql.rb +0 -39
- data/lib/bio/io/biosql/config/database.yml +0 -21
- data/lib/bio/io/sql.rb +0 -79
- data/lib/bio/shell.rb +0 -44
- data/lib/bio/shell/core.rb +0 -578
- data/lib/bio/shell/demo.rb +0 -146
- data/lib/bio/shell/interface.rb +0 -217
- data/lib/bio/shell/irb.rb +0 -94
- data/lib/bio/shell/object.rb +0 -71
- data/lib/bio/shell/plugin/blast.rb +0 -42
- data/lib/bio/shell/plugin/codon.rb +0 -218
- data/lib/bio/shell/plugin/das.rb +0 -58
- data/lib/bio/shell/plugin/emboss.rb +0 -23
- data/lib/bio/shell/plugin/entry.rb +0 -137
- data/lib/bio/shell/plugin/flatfile.rb +0 -101
- data/lib/bio/shell/plugin/midi.rb +0 -430
- data/lib/bio/shell/plugin/ncbirest.rb +0 -68
- data/lib/bio/shell/plugin/obda.rb +0 -45
- data/lib/bio/shell/plugin/psort.rb +0 -56
- data/lib/bio/shell/plugin/seq.rb +0 -248
- data/lib/bio/shell/plugin/togows.rb +0 -40
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/bioruby_generator.rb +0 -29
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/_classes.rhtml +0 -4
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/_log.rhtml +0 -27
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/_methods.rhtml +0 -11
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/_modules.rhtml +0 -4
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/_variables.rhtml +0 -7
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/bioruby-bg.gif +0 -0
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/bioruby-gem.png +0 -0
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/bioruby-link.gif +0 -0
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/bioruby.css +0 -368
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/bioruby.rhtml +0 -47
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/bioruby_controller.rb +0 -144
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/bioruby_helper.rb +0 -47
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/commands.rhtml +0 -8
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/history.rhtml +0 -10
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/index.rhtml +0 -26
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/spinner.gif +0 -0
- data/lib/bio/shell/script.rb +0 -25
- data/lib/bio/shell/setup.rb +0 -108
- data/lib/bio/shell/web.rb +0 -102
- data/sample/test_phyloxml_big.rb +0 -205
- data/test/data/phyloxml/apaf.xml +0 -666
- data/test/data/phyloxml/bcl_2.xml +0 -2097
- data/test/data/phyloxml/made_up.xml +0 -144
- data/test/data/phyloxml/ncbi_taxonomy_mollusca_short.xml +0 -65
- data/test/data/phyloxml/phyloxml_examples.xml +0 -415
- data/test/unit/bio/db/biosql/tc_biosql.rb +0 -114
- data/test/unit/bio/db/biosql/ts_suite_biosql.rb +0 -8
- data/test/unit/bio/db/test_phyloxml.rb +0 -821
- data/test/unit/bio/db/test_phyloxml_writer.rb +0 -334
- data/test/unit/bio/shell/plugin/test_seq.rb +0 -187
- data/test/unit/bio/test_shell.rb +0 -20
@@ -1,227 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# = bio/db/phyloxml_writer.rb - PhyloXML writer
|
3
|
-
#
|
4
|
-
# Copyright:: Copyright (C) 2009
|
5
|
-
# Diana Jaunzeikare <latvianlinuxgirl@gmail.com>
|
6
|
-
# License:: The Ruby License
|
7
|
-
#
|
8
|
-
#
|
9
|
-
# == Description
|
10
|
-
#
|
11
|
-
# This file containts writer for PhyloXML.
|
12
|
-
#
|
13
|
-
# == Requirements
|
14
|
-
#
|
15
|
-
# Libxml2 XML parser is required. Install libxml-ruby bindings from
|
16
|
-
# http://libxml.rubyforge.org or
|
17
|
-
#
|
18
|
-
# gem install -r libxml-ruby
|
19
|
-
#
|
20
|
-
# == References
|
21
|
-
#
|
22
|
-
# * http://www.phyloxml.org
|
23
|
-
#
|
24
|
-
# * https://www.nescent.org/wg_phyloinformatics/PhyloSoC:PhyloXML_support_in_BioRuby
|
25
|
-
|
26
|
-
require 'libxml'
|
27
|
-
require 'bio/db/phyloxml/phyloxml_elements'
|
28
|
-
|
29
|
-
module Bio
|
30
|
-
|
31
|
-
module PhyloXML
|
32
|
-
|
33
|
-
# == Description
|
34
|
-
#
|
35
|
-
# Bio::PhyloXML::Writer is for writing phyloXML (version 1.10) format files.
|
36
|
-
#
|
37
|
-
# == Requirements
|
38
|
-
#
|
39
|
-
# Libxml2 XML parser is required. Install libxml-ruby bindings from
|
40
|
-
# http://libxml.rubyforge.org or
|
41
|
-
#
|
42
|
-
# gem install -r libxml-ruby
|
43
|
-
#
|
44
|
-
# == Usage
|
45
|
-
#
|
46
|
-
# require 'bio'
|
47
|
-
#
|
48
|
-
# # Create new phyloxml parser
|
49
|
-
# phyloxml = Bio::PhyloXML::Parser.open('example.xml')
|
50
|
-
#
|
51
|
-
# # Read in some trees from file
|
52
|
-
# tree1 = phyloxml.next_tree
|
53
|
-
# tree2 = phyloxml.next_tree
|
54
|
-
#
|
55
|
-
# # Create new phyloxml writer
|
56
|
-
# writer = Bio::PhyloXML::Writer.new('tree.xml')
|
57
|
-
#
|
58
|
-
# # Write tree to the file tree.xml
|
59
|
-
# writer.write(tree1)
|
60
|
-
#
|
61
|
-
# # Add another tree to the file
|
62
|
-
# writer.write(tree2)
|
63
|
-
#
|
64
|
-
# == References
|
65
|
-
#
|
66
|
-
# http://www.phyloxml.org/documentation/version_100/phyloxml.xsd.html
|
67
|
-
|
68
|
-
class Writer
|
69
|
-
|
70
|
-
include LibXML
|
71
|
-
|
72
|
-
SCHEMA_LOCATION = 'http://www.phyloxml.org http://www.phyloxml.org/1.10/phyloxml.xsd'
|
73
|
-
|
74
|
-
attr_accessor :write_branch_length_as_subelement
|
75
|
-
|
76
|
-
#
|
77
|
-
# Create new Writer object. As parameters provide filename of xml file
|
78
|
-
# you wish to create. Optional parameter is whether to indent or no.
|
79
|
-
# Default is true. By default branch_length is written as subelement of
|
80
|
-
# clade element.
|
81
|
-
#
|
82
|
-
def initialize(filename, indent=true)
|
83
|
-
@write_branch_length_as_subelement = true #default value
|
84
|
-
@filename = filename
|
85
|
-
@indent = indent
|
86
|
-
|
87
|
-
@doc = XML::Document.new()
|
88
|
-
@doc.root = XML::Node.new('phyloxml')
|
89
|
-
@root = @doc.root
|
90
|
-
@root['xmlns:xsi'] = 'http://www.w3.org/2001/XMLSchema-instance'
|
91
|
-
@root['xsi:schemaLocation'] = SCHEMA_LOCATION
|
92
|
-
@root['xmlns'] = 'http://www.phyloxml.org'
|
93
|
-
|
94
|
-
#@todo save encoding to be UTF-8. (However it is the default one).
|
95
|
-
#it gives error NameError: uninitialized constant LibXML::XML::Encoding
|
96
|
-
#@doc.encoding = XML::Encoding::UTF_8
|
97
|
-
|
98
|
-
@doc.save(@filename, :indent => true)
|
99
|
-
end
|
100
|
-
|
101
|
-
#
|
102
|
-
# Write a tree to a file in phyloxml format.
|
103
|
-
#
|
104
|
-
# require 'Bio'
|
105
|
-
# writer = Bio::PhyloXML::Writer.new
|
106
|
-
# writer.write(tree)
|
107
|
-
#
|
108
|
-
def write(tree)
|
109
|
-
@root << phylogeny = XML::Node.new('phylogeny')
|
110
|
-
|
111
|
-
PhyloXML::Writer.generate_xml(phylogeny, tree, [
|
112
|
-
[:attr, 'rooted'],
|
113
|
-
[:simple, 'name', tree.name],
|
114
|
-
[:complex, 'id', tree.phylogeny_id],
|
115
|
-
[:simple, 'description', tree.description],
|
116
|
-
[:simple, 'date', tree.date],
|
117
|
-
[:objarr, 'confidence', 'confidences']])
|
118
|
-
|
119
|
-
root_clade = tree.root.to_xml(nil, @write_branch_length_as_subelement)
|
120
|
-
|
121
|
-
phylogeny << root_clade
|
122
|
-
|
123
|
-
tree.children(tree.root).each do |node|
|
124
|
-
root_clade << node_to_xml(tree, node, tree.root)
|
125
|
-
end
|
126
|
-
|
127
|
-
Bio::PhyloXML::Writer::generate_xml(phylogeny, tree, [
|
128
|
-
[:objarr, 'clade_relation', 'clade_relations'],
|
129
|
-
[:objarr, 'sequence_relation', 'sequence_relations'],
|
130
|
-
[:objarr, 'property', 'properties']] )
|
131
|
-
|
132
|
-
@doc.save(@filename, :indent => @indent)
|
133
|
-
end #writer#write
|
134
|
-
|
135
|
-
|
136
|
-
#
|
137
|
-
# PhyloXML Schema allows to save data in different xml format after all
|
138
|
-
# phylogeny elements. This method is to write these additional data.
|
139
|
-
#
|
140
|
-
# parser = PhyloXML::Parser.open('phyloxml_examples.xml')
|
141
|
-
# writer = PhyloXML::Writer.new('new.xml')
|
142
|
-
#
|
143
|
-
# parser.each do |tree|
|
144
|
-
# writer.write(tree)
|
145
|
-
# end
|
146
|
-
#
|
147
|
-
# # When all the trees are read in by the parser, whats left is saved at
|
148
|
-
# # PhyloXML::Parser#other
|
149
|
-
# writer.write(parser.other)
|
150
|
-
#
|
151
|
-
|
152
|
-
def write_other(other_arr)
|
153
|
-
other_arr.each do |other_obj|
|
154
|
-
@root << other_obj.to_xml
|
155
|
-
end
|
156
|
-
@doc.save(@filename, :indent => @indent)
|
157
|
-
end
|
158
|
-
|
159
|
-
#class method
|
160
|
-
|
161
|
-
#
|
162
|
-
# Used by to_xml methods of PhyloXML element classes. Generally not to be
|
163
|
-
# invoked directly.
|
164
|
-
#
|
165
|
-
def self.generate_xml(root, elem, subelement_array)
|
166
|
-
#example usage: generate_xml(node, self, [[ :complex,'accession', ], [:simple, 'name', @name], [:simple, 'location', @location]])
|
167
|
-
subelement_array.each do |subelem|
|
168
|
-
if subelem[0] == :simple
|
169
|
-
root << XML::Node.new(subelem[1], subelem[2].to_s) if subelem[2] != nil and not subelem[2].to_s.empty?
|
170
|
-
|
171
|
-
elsif subelem[0] == :complex
|
172
|
-
root << subelem[2].send("to_xml") if subelem[2] != nil
|
173
|
-
|
174
|
-
elsif subelem[0] == :pattern
|
175
|
-
#seq, self, [[:pattern, 'symbol', @symbol, "\S{1,10}"]
|
176
|
-
if subelem[2] != nil
|
177
|
-
if subelem[2] =~ subelem[3]
|
178
|
-
root << XML::Node.new(subelem[1], subelem[2])
|
179
|
-
else
|
180
|
-
raise "#{subelem[2]} is not a valid value of #{subelem[1]}. It should follow pattern #{subelem[3]}"
|
181
|
-
end
|
182
|
-
end
|
183
|
-
|
184
|
-
elsif subelem[0] == :objarr
|
185
|
-
#[:objarr, 'annotation', 'annotations']])
|
186
|
-
obj_arr = elem.send(subelem[2])
|
187
|
-
obj_arr.each do |arr_elem|
|
188
|
-
root << arr_elem.to_xml
|
189
|
-
end
|
190
|
-
|
191
|
-
elsif subelem[0] == :simplearr
|
192
|
-
# [:simplearr, 'common_name', @common_names]
|
193
|
-
subelem[2].each do |elem_val|
|
194
|
-
root << XML::Node.new(subelem[1], elem_val)
|
195
|
-
end
|
196
|
-
elsif subelem[0] == :attr
|
197
|
-
#[:attr, 'rooted']
|
198
|
-
obj = elem.send(subelem[1])
|
199
|
-
if obj != nil
|
200
|
-
root[subelem[1]] = obj.to_s
|
201
|
-
end
|
202
|
-
else
|
203
|
-
raise "Not supported type of element by method generate_xml."
|
204
|
-
end
|
205
|
-
end
|
206
|
-
return root
|
207
|
-
end
|
208
|
-
|
209
|
-
private
|
210
|
-
|
211
|
-
def node_to_xml(tree, node, parent)
|
212
|
-
edge = tree.get_edge(parent, node)
|
213
|
-
branch_length = edge.distance
|
214
|
-
|
215
|
-
clade = node.to_xml(branch_length, @write_branch_length_as_subelement)
|
216
|
-
|
217
|
-
tree.children(node).each do |new_node|
|
218
|
-
clade << node_to_xml(tree, new_node, node)
|
219
|
-
end
|
220
|
-
|
221
|
-
return clade
|
222
|
-
end
|
223
|
-
|
224
|
-
end
|
225
|
-
|
226
|
-
end
|
227
|
-
end
|
@@ -1,257 +0,0 @@
|
|
1
|
-
module Bio
|
2
|
-
class SQL
|
3
|
-
class Biodatabase < DummyBase
|
4
|
-
has_many :bioentries, :class_name =>"Bioentry", :foreign_key => "biodatabase_id"
|
5
|
-
validates_uniqueness_of :name
|
6
|
-
end
|
7
|
-
class BioentryDbxref < DummyBase
|
8
|
-
#delete set_sequence_name nil
|
9
|
-
set_primary_key nil #bioentry_id,dbxref_id
|
10
|
-
belongs_to :bioentry, :class_name => "Bioentry"
|
11
|
-
belongs_to :dbxref, :class_name => "Dbxref"
|
12
|
-
end
|
13
|
-
|
14
|
-
class BioentryPath < DummyBase
|
15
|
-
set_primary_key nil
|
16
|
-
#delete set_sequence_name nil
|
17
|
-
belongs_to :term, :class_name => "Term"
|
18
|
-
#da sistemare per poter procedere.
|
19
|
-
belongs_to :object_bioentry, :class_name=>"Bioentry"
|
20
|
-
belongs_to :subject_bioentry, :class_name=>"Bioentry"
|
21
|
-
end #BioentryPath
|
22
|
-
|
23
|
-
class BioentryQualifierValue < DummyBase
|
24
|
-
#NOTE: added rank to primary_keys, now it's finished.
|
25
|
-
set_primary_keys :bioentry_id, :term_id, :rank
|
26
|
-
belongs_to :bioentry, :class_name => "Bioentry"
|
27
|
-
belongs_to :term, :class_name => "Term"
|
28
|
-
end #BioentryQualifierValue
|
29
|
-
|
30
|
-
class Bioentry < DummyBase
|
31
|
-
belongs_to :biodatabase, :class_name => "Biodatabase"
|
32
|
-
belongs_to :taxon, :class_name => "Taxon"
|
33
|
-
has_one :biosequence
|
34
|
-
#, :class_name => "Biosequence", :foreign_key => "bioentry_id"
|
35
|
-
has_many :comments, :class_name =>"Comment", :order =>'rank'
|
36
|
-
has_many :seqfeatures, :class_name => "Seqfeature", :order=>'rank'
|
37
|
-
has_many :bioentry_references, :class_name=>"BioentryReference" #, :foreign_key => "bioentry_id"
|
38
|
-
has_many :bioentry_dbxrefs, :class_name => "BioentryDbxref"
|
39
|
-
has_many :object_bioentry_relationships, :class_name=>"BioentryRelationship", :foreign_key=>"object_bioentry_id" #non mi convince molto credo non funzioni nel modo corretto
|
40
|
-
has_many :subject_bioentry_relationships, :class_name=>"BioentryRelationship", :foreign_key=>"subject_bioentry_id" #non mi convince molto credo non funzioni nel modo corretto
|
41
|
-
has_many :object_bioentry_paths, :class_name=>"BioentryPath", :foreign_key=>"object_bioentry_id" #non mi convince molto credo non funzioni nel modo corretto
|
42
|
-
has_many :subject_bioentry_paths, :class_name=>"BioentryPath", :foreign_key=>"subject_bioentry_id" #non mi convince molto credo non funzioni nel modo corretto
|
43
|
-
|
44
|
-
has_many :cdsfeatures, :class_name=>"Seqfeature", :foreign_key =>"bioentry_id", :conditions=>["term.name='CDS'"], :include=>"type_term"
|
45
|
-
has_many :references, :through=>:bioentry_references, :class_name => "Reference"
|
46
|
-
has_many :terms, :through=>:bioentry_qualifier_values, :class_name => "Term"
|
47
|
-
#NOTE: added order_by for multiple hit and manage ranks correctly
|
48
|
-
has_many :bioentry_qualifier_values, :order=>"bioentry_id,term_id,rank", :class_name => "BioentryQualifierValue"
|
49
|
-
|
50
|
-
#per la creazione richiesti:
|
51
|
-
#name, accession, version
|
52
|
-
# validates_uniqueness_of :accession, :scope=>[:biodatabase_id]
|
53
|
-
# validates_uniqueness_of :name, :scope=>[:biodatabase_id]
|
54
|
-
# validates_uniqueness_of :identifier, :scope=>[:biodatabase_id]
|
55
|
-
|
56
|
-
end
|
57
|
-
class BioentryReference < DummyBase
|
58
|
-
set_primary_keys :bioentry_id, :reference_id, :rank
|
59
|
-
belongs_to :bioentry, :class_name => "Bioentry"
|
60
|
-
belongs_to :reference , :class_name => "Reference"
|
61
|
-
end
|
62
|
-
class BioentryRelationship < DummyBase
|
63
|
-
#delete set_primary_key "bioentry_relationship_id"
|
64
|
-
set_sequence_name "bieontry_relationship_pk_seq"
|
65
|
-
belongs_to :object_bioentry, :class_name => "Bioentry"
|
66
|
-
belongs_to :subject_bioentry, :class_name => "Bioentry"
|
67
|
-
belongs_to :term
|
68
|
-
end
|
69
|
-
class Biosequence < DummyBase
|
70
|
-
set_primary_keys :bioentry_id, :version
|
71
|
-
#delete set_sequence_name "biosequence_pk_seq"
|
72
|
-
belongs_to :bioentry, :foreign_key=>"bioentry_id"
|
73
|
-
#has_one :bioentry
|
74
|
-
#, :class_name => "Bioentry"
|
75
|
-
end
|
76
|
-
class Comment < DummyBase
|
77
|
-
belongs_to :bioentry, :class_name => "Bioentry"
|
78
|
-
end
|
79
|
-
class DbxrefQualifierValue < DummyBase
|
80
|
-
#think to use composite primary key
|
81
|
-
set_primary_key nil #dbxref_id, term_id, rank
|
82
|
-
#delete set_sequence_name nil
|
83
|
-
belongs_to :dbxref, :class_name => "Dbxref"
|
84
|
-
belongs_to :term, :class_name => "Term"
|
85
|
-
end
|
86
|
-
class Dbxref < DummyBase
|
87
|
-
#set_sequence_name "dbxref_pk_seq"
|
88
|
-
has_many :dbxref_qualifier_values, :class_name => "DbxrefQualifierValue"
|
89
|
-
has_many :locations, :class_name => "Location"
|
90
|
-
has_many :references, :class_name=>"Reference"
|
91
|
-
has_many :term_dbxrefs, :class_name => "TermDbxref"
|
92
|
-
has_many :bioentry_dbxrefs, :class_name => "BioentryDbxref"
|
93
|
-
#TODO: check is with bioentry there is an has_and_belongs_to_many relationship has specified in schema overview.
|
94
|
-
end
|
95
|
-
class LocationQualifierValue < DummyBase
|
96
|
-
set_primary_key nil #location_id, term_id
|
97
|
-
#delete set_sequence_name nil
|
98
|
-
belongs_to :location, :class_name => "Location"
|
99
|
-
belongs_to :term, :class_name => "Term"
|
100
|
-
end
|
101
|
-
class Location < DummyBase
|
102
|
-
#set_sequence_name "location_pk_seq"
|
103
|
-
belongs_to :seqfeature, :class_name => "Seqfeature"
|
104
|
-
belongs_to :dbxref, :class_name => "Dbxref"
|
105
|
-
belongs_to :term, :class_name => "Term"
|
106
|
-
has_many :location_qualifier_values, :class_name => "LocationQualifierValue"
|
107
|
-
|
108
|
-
def to_s
|
109
|
-
if strand==-1
|
110
|
-
str="complement("+start_pos.to_s+".."+end_pos.to_s+")"
|
111
|
-
else
|
112
|
-
str=start_pos.to_s+".."+end_pos.to_s
|
113
|
-
end
|
114
|
-
return str
|
115
|
-
end
|
116
|
-
|
117
|
-
def sequence
|
118
|
-
seq=""
|
119
|
-
unless self.seqfeature.bioentry.biosequence.seq.nil?
|
120
|
-
seq=Bio::Sequence::NA.new(self.seqfeature.bioentry.biosequence.seq[start_pos-1..end_pos-1])
|
121
|
-
seq.reverse_complement! if strand==-1
|
122
|
-
end
|
123
|
-
return seq
|
124
|
-
end
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
end
|
129
|
-
class Ontology < DummyBase
|
130
|
-
has_many :terms, :class_name => "Term"
|
131
|
-
has_many :term_paths, :class_name => "TermPath"
|
132
|
-
has_many :term_relationships, :class_name => "TermRelationship"
|
133
|
-
end
|
134
|
-
class Reference < DummyBase
|
135
|
-
belongs_to :dbxref, :class_name => "Dbxref"
|
136
|
-
has_many :bioentry_references, :class_name=>"BioentryReference"
|
137
|
-
has_many :bioentries, :through=>:bioentry_references
|
138
|
-
end
|
139
|
-
class SeqfeatureDbxref < DummyBase
|
140
|
-
set_primary_keys :seqfeature_id, :dbxref_id
|
141
|
-
#delete set_sequence_name nil
|
142
|
-
belongs_to :seqfeature, :class_name => "Seqfeature", :foreign_key => "seqfeature_id"
|
143
|
-
belongs_to :dbxref, :class_name => "Dbxref", :foreign_key => "dbxref_id"
|
144
|
-
end
|
145
|
-
class SeqfeaturePath < DummyBase
|
146
|
-
set_primary_keys :object_seqfeature_id, :subject_seqfeature_id, :term_id
|
147
|
-
set_sequence_name nil
|
148
|
-
belongs_to :object_seqfeature, :class_name => "Seqfeature", :foreign_key => "object_seqfeature_id"
|
149
|
-
belongs_to :subject_seqfeature, :class_name => "Seqfeature", :foreign_key => "subject_seqfeature_id"
|
150
|
-
belongs_to :term, :class_name => "Term"
|
151
|
-
end
|
152
|
-
class SeqfeatureQualifierValue < DummyBase
|
153
|
-
set_primary_keys :seqfeature_id, :term_id, :rank
|
154
|
-
set_sequence_name nil
|
155
|
-
belongs_to :seqfeature
|
156
|
-
belongs_to :term, :class_name => "Term"
|
157
|
-
end
|
158
|
-
class Seqfeature <DummyBase
|
159
|
-
set_sequence_name "seqfeature_pk_seq"
|
160
|
-
belongs_to :bioentry
|
161
|
-
#, :class_name => "Bioentry"
|
162
|
-
belongs_to :type_term, :class_name => "Term", :foreign_key => "type_term_id"
|
163
|
-
belongs_to :source_term, :class_name => "Term", :foreign_key =>"source_term_id"
|
164
|
-
has_many :seqfeature_dbxrefs, :class_name => "SeqfeatureDbxref", :foreign_key => "seqfeature_id"
|
165
|
-
has_many :seqfeature_qualifier_values, :order=>'rank', :foreign_key => "seqfeature_id"
|
166
|
-
#, :class_name => "SeqfeatureQualifierValue"
|
167
|
-
has_many :locations, :class_name => "Location", :order=>'rank'
|
168
|
-
has_many :object_seqfeature_paths, :class_name => "SeqfeaturePath", :foreign_key => "object_seqfeature_id"
|
169
|
-
has_many :subject_seqfeature_paths, :class_name => "SeqfeaturePath", :foreign_key => "subject_seqfeature_id"
|
170
|
-
has_many :object_seqfeature_relationships, :class_name => "SeqfeatureRelationship", :foreign_key => "object_seqfeature_id"
|
171
|
-
has_many :subject_seqfeature_relationships, :class_name => "SeqfeatureRelationship", :foreign_key => "subject_seqfeature_id"
|
172
|
-
|
173
|
-
#get the subsequence described by the locations objects
|
174
|
-
def sequence
|
175
|
-
return self.locations.inject(Bio::Sequence::NA.new("")){|seq, location| seq<<location.sequence}
|
176
|
-
end
|
177
|
-
|
178
|
-
#translate the subsequences represented by the feature and its locations
|
179
|
-
#not considering the qualifiers
|
180
|
-
#Return a Bio::Sequence::AA object
|
181
|
-
def translate(*args)
|
182
|
-
self.sequence.translate(*args)
|
183
|
-
end
|
184
|
-
end
|
185
|
-
class SeqfeatureRelationship <DummyBase
|
186
|
-
set_sequence_name "seqfeatue_relationship_pk_seq"
|
187
|
-
belongs_to :term, :class_name => "Term"
|
188
|
-
belongs_to :object_seqfeature, :class_name => "Seqfeature"
|
189
|
-
belongs_to :subject_seqfeature, :class_name => "Seqfeature"
|
190
|
-
end
|
191
|
-
class TaxonName < DummyBase
|
192
|
-
set_primary_keys :taxon_id, :name, :name_class
|
193
|
-
belongs_to :taxon, :class_name => "Taxon"
|
194
|
-
end
|
195
|
-
class Taxon < DummyBase
|
196
|
-
set_sequence_name "taxon_pk_seq"
|
197
|
-
has_many :taxon_names, :class_name => "TaxonName"
|
198
|
-
has_one :taxon_scientific_name, :class_name => "TaxonName", :conditions=>"name_class = 'scientific name'"
|
199
|
-
has_one :taxon_genbank_common_name, :class_name => "TaxonName", :conditions=>"name_class = 'genbank common name'"
|
200
|
-
has_one :bioentry, :class_name => "Bioentry"
|
201
|
-
end
|
202
|
-
class TermDbxref < DummyBase
|
203
|
-
set_primary_key nil #term_id, dbxref_id
|
204
|
-
#delete set_sequence_name nil
|
205
|
-
belongs_to :term, :class_name => "Term"
|
206
|
-
belongs_to :dbxref, :class_name => "Dbxref"
|
207
|
-
end
|
208
|
-
class TermPath < DummyBase
|
209
|
-
set_sequence_name "term_path_pk_seq"
|
210
|
-
belongs_to :ontology, :class_name => "Ontology"
|
211
|
-
belongs_to :subject_term, :class_name => "Term"
|
212
|
-
belongs_to :object_term, :class_name => "Term"
|
213
|
-
belongs_to :predicate_term, :class_name => "Term"
|
214
|
-
end
|
215
|
-
class Term < DummyBase
|
216
|
-
belongs_to :ontology, :class_name => "Ontology"
|
217
|
-
has_many :seqfeature_qualifier_values, :class_name => "SeqfeatureQualifierValue"
|
218
|
-
has_many :dbxref_qualifier_values, :class_name => "DbxrefQualifierValue"
|
219
|
-
has_many :bioentry_qualifer_values, :class_name => "BioentryQualifierValue"
|
220
|
-
has_many :bioentries, :through=>:bioentry_qualifier_values
|
221
|
-
has_many :locations, :class_name => "Location"
|
222
|
-
has_many :seqfeature_relationships, :class_name => "SeqfeatureRelationship"
|
223
|
-
has_many :term_dbxrefs, :class_name => "TermDbxref"
|
224
|
-
has_many :term_relationship_terms, :class_name => "TermRelationshipTerm"
|
225
|
-
has_many :term_synonyms, :class_name => "TermSynonym"
|
226
|
-
has_many :location_qualifier_values, :class_name => "LocationQualifierValue"
|
227
|
-
has_many :seqfeature_types, :class_name => "Seqfeature", :foreign_key => "type_term_id"
|
228
|
-
has_many :seqfeature_sources, :class_name => "Seqfeature", :foreign_key => "source_term_id"
|
229
|
-
has_many :term_path_subjects, :class_name => "TermPath", :foreign_key => "subject_term_id"
|
230
|
-
has_many :term_path_predicates, :class_name => "TermPath", :foreign_key => "predicate_term_id"
|
231
|
-
has_many :term_path_objects, :class_name => "TermPath", :foreign_key => "object_term_id"
|
232
|
-
has_many :term_relationship_subjects, :class_name => "TermRelationship", :foreign_key =>"subject_term_id"
|
233
|
-
has_many :term_relationship_predicates, :class_name => "TermRelationship", :foreign_key =>"predicate_term_id"
|
234
|
-
has_many :term_relationship_objects, :class_name => "TermRelationship", :foreign_key =>"object_term_id"
|
235
|
-
has_many :seqfeature_paths, :class_name => "SeqfeaturePath"
|
236
|
-
end
|
237
|
-
class TermRelationship < DummyBase
|
238
|
-
set_sequence_name "term_relationship_pk_seq"
|
239
|
-
belongs_to :ontology, :class_name => "Ontology"
|
240
|
-
belongs_to :subject_term, :class_name => "Term"
|
241
|
-
belongs_to :predicate_term, :class_name => "Term"
|
242
|
-
belongs_to :object_term, :class_name => "Term"
|
243
|
-
has_one :term_relationship_term, :class_name => "TermRelationshipTerm"
|
244
|
-
end
|
245
|
-
class TermRelationshipTerm < DummyBase
|
246
|
-
#delete set_sequence_name nil
|
247
|
-
set_primary_key :term_relationship_id
|
248
|
-
belongs_to :term_relationship, :class_name => "TermRelationship"
|
249
|
-
belongs_to :term, :class_name => "Term"
|
250
|
-
end
|
251
|
-
class TermSynonym < DummyBase
|
252
|
-
#delete set_sequence_name nil
|
253
|
-
set_primary_key nil
|
254
|
-
belongs_to :term, :class_name => "Term"
|
255
|
-
end
|
256
|
-
end #SQL
|
257
|
-
end #Bio
|