bio 1.3.0 → 1.3.1

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.
Files changed (75) hide show
  1. data/COPYING +56 -0
  2. data/COPYING.ja +51 -0
  3. data/ChangeLog +540 -0
  4. data/GPL +340 -0
  5. data/LEGAL +141 -0
  6. data/LGPL +504 -0
  7. data/README.rdoc +4 -2
  8. data/Rakefile +2 -2
  9. data/bioruby.gemspec +17 -29
  10. data/doc/Tutorial.rd +118 -90
  11. data/doc/Tutorial.rd.html +124 -87
  12. data/lib/bio/appl/blast.rb +2 -2
  13. data/lib/bio/appl/blast/format0.rb +1 -1
  14. data/lib/bio/appl/fasta.rb +5 -12
  15. data/lib/bio/appl/fasta/format10.rb +96 -6
  16. data/lib/bio/appl/gcg/msf.rb +11 -14
  17. data/lib/bio/appl/pts1.rb +0 -4
  18. data/lib/bio/appl/sim4/report.rb +50 -17
  19. data/lib/bio/db/biosql/biosql_to_biosequence.rb +10 -0
  20. data/lib/bio/db/biosql/sequence.rb +234 -298
  21. data/lib/bio/db/embl/embl.rb +0 -3
  22. data/lib/bio/db/genbank/common.rb +3 -1
  23. data/lib/bio/io/biosql/ar-biosql.rb +257 -0
  24. data/lib/bio/io/biosql/biosql.rb +39 -0
  25. data/lib/bio/io/biosql/config/database.yml +5 -4
  26. data/lib/bio/io/ncbirest.rb +12 -5
  27. data/lib/bio/io/pubmed.rb +5 -1
  28. data/lib/bio/io/sql.rb +43 -150
  29. data/lib/bio/sequence/compat.rb +5 -1
  30. data/lib/bio/util/restriction_enzyme/range/sequence_range/calculated_cuts.rb +6 -4
  31. data/lib/bio/version.rb +1 -1
  32. data/test/data/gcg/pileup-aa.msf +67 -0
  33. data/test/data/sim4/complement-A4.sim4 +43 -0
  34. data/test/data/sim4/simple-A4.sim4 +25 -0
  35. data/test/data/sim4/simple2-A4.sim4 +25 -0
  36. data/test/functional/bio/io/test_pubmed.rb +129 -0
  37. data/test/unit/bio/appl/bl2seq/test_report.rb +5 -5
  38. data/test/unit/bio/appl/gcg/test_msf.rb +154 -0
  39. data/test/unit/bio/appl/hmmer/test_report.rb +2 -2
  40. data/test/unit/bio/appl/sim4/test_report.rb +869 -0
  41. data/test/unit/bio/appl/test_blast.rb +1 -1
  42. data/test/unit/bio/db/biosql/tc_biosql.rb +110 -0
  43. data/test/unit/bio/db/biosql/ts_suite_biosql.rb +8 -0
  44. data/test/unit/bio/test_feature.rb +18 -17
  45. data/test/unit/bio/test_reference.rb +18 -18
  46. data/test/unit/bio/test_sequence.rb +1 -1
  47. metadata +18 -30
  48. data/lib/bio/io/biosql/biodatabase.rb +0 -64
  49. data/lib/bio/io/biosql/bioentry.rb +0 -29
  50. data/lib/bio/io/biosql/bioentry_dbxref.rb +0 -11
  51. data/lib/bio/io/biosql/bioentry_path.rb +0 -12
  52. data/lib/bio/io/biosql/bioentry_qualifier_value.rb +0 -10
  53. data/lib/bio/io/biosql/bioentry_reference.rb +0 -10
  54. data/lib/bio/io/biosql/bioentry_relationship.rb +0 -10
  55. data/lib/bio/io/biosql/biosequence.rb +0 -11
  56. data/lib/bio/io/biosql/comment.rb +0 -7
  57. data/lib/bio/io/biosql/dbxref.rb +0 -13
  58. data/lib/bio/io/biosql/dbxref_qualifier_value.rb +0 -12
  59. data/lib/bio/io/biosql/location.rb +0 -32
  60. data/lib/bio/io/biosql/location_qualifier_value.rb +0 -11
  61. data/lib/bio/io/biosql/ontology.rb +0 -10
  62. data/lib/bio/io/biosql/reference.rb +0 -9
  63. data/lib/bio/io/biosql/seqfeature.rb +0 -32
  64. data/lib/bio/io/biosql/seqfeature_dbxref.rb +0 -11
  65. data/lib/bio/io/biosql/seqfeature_path.rb +0 -11
  66. data/lib/bio/io/biosql/seqfeature_qualifier_value.rb +0 -20
  67. data/lib/bio/io/biosql/seqfeature_relationship.rb +0 -11
  68. data/lib/bio/io/biosql/taxon.rb +0 -12
  69. data/lib/bio/io/biosql/taxon_name.rb +0 -9
  70. data/lib/bio/io/biosql/term.rb +0 -27
  71. data/lib/bio/io/biosql/term_dbxref.rb +0 -11
  72. data/lib/bio/io/biosql/term_path.rb +0 -12
  73. data/lib/bio/io/biosql/term_relationship.rb +0 -13
  74. data/lib/bio/io/biosql/term_relationship_term.rb +0 -11
  75. data/lib/bio/io/biosql/term_synonym.rb +0 -10
@@ -1,11 +0,0 @@
1
- module Bio
2
- class SQL
3
- class BioentryDbxref < DummyBase
4
- #delete set_sequence_name nil
5
- set_primary_key nil #bioentry_id,dbxref_id
6
- belongs_to :bioentry, :class_name => "Bioentry"
7
- belongs_to :dbxref, :class_name => "Dbxref"
8
- end
9
- end #SQL
10
- end #Bio
11
-
@@ -1,12 +0,0 @@
1
- module Bio
2
- class SQL
3
- class BioentryPath < DummyBase
4
- set_primary_key nil
5
- #delete set_sequence_name nil
6
- belongs_to :term, :class_name => "Term"
7
- #da sistemare per poter procedere.
8
- belongs_to :object_bioentry, :class_name=>"Bioentry"
9
- belongs_to :subject_bioentry, :class_name=>"Bioentry"
10
- end #BioentryPath
11
- end #SQL
12
- end #Bio
@@ -1,10 +0,0 @@
1
- module Bio
2
- class SQL
3
- class BioentryQualifierValue < DummyBase
4
- #NOTE: added rank to primary_keys, now it's finished.
5
- set_primary_keys :bioentry_id, :term_id, :rank
6
- belongs_to :bioentry, :class_name => "Bioentry"
7
- belongs_to :term, :class_name => "Term"
8
- end #BioentryQualifierValue
9
- end #SQL
10
- end #Bio
@@ -1,10 +0,0 @@
1
- module Bio
2
- class SQL
3
- class BioentryReference < DummyBase
4
- set_primary_keys :bioentry_id, :reference_id, :rank
5
- belongs_to :bioentry, :class_name => "Bioentry"
6
- belongs_to :reference , :class_name => "Reference"
7
- end
8
- end #SQL
9
- end #Bio
10
-
@@ -1,10 +0,0 @@
1
- module Bio
2
- class SQL
3
- class BioentryRelationship < DummyBase
4
- #delete set_primary_key "bioentry_relationship_id"
5
- set_sequence_name "bieontry_relationship_pk_seq"
6
- belongs_to :object_bioentry, :class_name => "Bioentry"
7
- belongs_to :subject_bioentry, :class_name => "Bioentry"
8
- end
9
- end #SQL
10
- end #Bio
@@ -1,11 +0,0 @@
1
- module Bio
2
- class SQL
3
- class Biosequence < DummyBase
4
- set_primary_key "bioentry_id"
5
- #delete set_sequence_name "biosequence_pk_seq"
6
- belongs_to :bioentry, :foreign_key=>"bioentry_id"
7
- #has_one :bioentry
8
- #, :class_name => "Bioentry"
9
- end
10
- end #SQL
11
- end #Bio
@@ -1,7 +0,0 @@
1
- module Bio
2
- class SQL
3
- class Comment < DummyBase
4
- belongs_to :bioentry, :class_name => "Bioentry"
5
- end
6
- end #SQL
7
- end #Bio
@@ -1,13 +0,0 @@
1
- module Bio
2
- class SQL
3
- class Dbxref < DummyBase
4
- #set_sequence_name "dbxref_pk_seq"
5
- has_many :dbxref_qualifier_values, :class_name => "DbxrefQualifierValue"
6
- has_many :locations, :class_name => "Location"
7
- has_many :references, :class_name=>"Reference"
8
- has_many :term_dbxrefs, :class_name => "TermDbxref"
9
- has_many :bioentry_dbxrefs, :class_name => "BioentryDbxref"
10
- #TODO: check is with bioentry there is an has_and_belongs_to_many relationship has specified in schema overview.
11
- end
12
- end #SQL
13
- end #Bio
@@ -1,12 +0,0 @@
1
- module Bio
2
- class SQL
3
- class DbxrefQualifierValue < DummyBase
4
- #think to use composite primary key
5
- set_primary_key nil #dbxref_id, term_id, rank
6
- #delete set_sequence_name nil
7
- belongs_to :dbxref, :class_name => "Dbxref"
8
- belongs_to :term, :class_name => "Term"
9
- end
10
- end #SQL
11
- end #Bio
12
-
@@ -1,32 +0,0 @@
1
- module Bio
2
- class SQL
3
- class Location < DummyBase
4
- #set_sequence_name "location_pk_seq"
5
- belongs_to :seqfeature, :class_name => "Seqfeature"
6
- belongs_to :dbxref, :class_name => "Dbxref"
7
- belongs_to :term, :class_name => "Term"
8
- has_many :location_qualifier_values, :class_name => "LocationQualifierValue"
9
-
10
- def to_s
11
- if strand==-1
12
- str="complement("+start_pos.to_s+".."+end_pos.to_s+")"
13
- else
14
- str=start_pos.to_s+".."+end_pos.to_s
15
- end
16
- return str
17
- end
18
-
19
- def sequence
20
- seq=""
21
- unless self.seqfeature.bioentry.biosequence.seq.nil?
22
- seq=Bio::Sequence::NA.new(self.seqfeature.bioentry.biosequence.seq[start_pos-1..end_pos-1])
23
- seq.reverse_complement! if strand==-1
24
- end
25
- return seq
26
- end
27
-
28
-
29
-
30
- end
31
- end #SQL
32
- end #Bio
@@ -1,11 +0,0 @@
1
- module Bio
2
- class SQL
3
- class LocationQualifierValue < DummyBase
4
- set_primary_key nil #location_id, term_id
5
- #delete set_sequence_name nil
6
- belongs_to :location, :class_name => "Location"
7
- belongs_to :term, :class_name => "Term"
8
- end
9
- end #SQL
10
- end #Bio
11
-
@@ -1,10 +0,0 @@
1
-
2
- module Bio
3
- class SQL
4
- class Ontology < DummyBase
5
- has_many :terms, :class_name => "Term"
6
- has_many :term_paths, :class_name => "TermPath"
7
- has_many :term_relationships, :class_name => "TermRelationship"
8
- end
9
- end #SQL
10
- end #Bio
@@ -1,9 +0,0 @@
1
-
2
- module Bio
3
- class SQL
4
- class Reference < DummyBase
5
- belongs_to :dbxref, :class_name => "Dbxref"
6
- has_many :bioentry_references, :class_name=>"BioentryRefernce"
7
- end
8
- end #SQL
9
- end #Bio
@@ -1,32 +0,0 @@
1
-
2
- module Bio
3
- class SQL
4
- class Seqfeature <DummyBase
5
- set_sequence_name "seqfeature_pk_seq"
6
- belongs_to :bioentry
7
- #, :class_name => "Bioentry"
8
- belongs_to :type_term, :class_name => "Term", :foreign_key => "type_term_id"
9
- belongs_to :source_term, :class_name => "Term", :foreign_key =>"source_term_id"
10
- has_many :seqfeature_dbxrefs, :class_name => "SeqfeatureDbxref", :foreign_key => "seqfeature_id"
11
- has_many :seqfeature_qualifier_values, :order=>'rank', :foreign_key => "seqfeature_id"
12
- #, :class_name => "SeqfeatureQualifierValue"
13
- has_many :locations, :class_name => "Location", :order=>'rank'
14
- has_many :object_seqfeature_paths, :class_name => "SeqfeaturePath", :foreign_key => "object_seqfeature_id"
15
- has_many :subject_seqfeature_paths, :class_name => "SeqfeaturePath", :foreign_key => "subject_seqfeature_id"
16
- has_many :object_seqfeature_relationships, :class_name => "SeqfeatureRelationship", :foreign_key => "object_seqfeature_id"
17
- has_many :subject_seqfeature_relationships, :class_name => "SeqfeatureRelationship", :foreign_key => "subject_seqfeature_id"
18
-
19
- #get the subsequence described by the locations objects
20
- def sequence
21
- return self.locations.inject(Bio::Sequence::NA.new("")){|seq, location| seq<<location.sequence}
22
- end
23
-
24
- #translate the subsequences represented by the feature and its locations
25
- #not considering the qualifiers
26
- #Return a Bio::Sequence::AA object
27
- def translate(*args)
28
- self.sequence.translate(*args)
29
- end
30
- end
31
- end #SQL
32
- end #Bio
@@ -1,11 +0,0 @@
1
-
2
- module Bio
3
- class SQL
4
- class SeqfeatureDbxref < DummyBase
5
- set_primary_keys :seqfeature_id, :dbxref_id
6
- #delete set_sequence_name nil
7
- belongs_to :seqfeature, :class_name => "Seqfeature", :foreign_key => "seqfeature_id"
8
- belongs_to :dbxref, :class_name => "Dbxref", :foreign_key => "dbxref_id"
9
- end
10
- end #SQL
11
- end #Bio
@@ -1,11 +0,0 @@
1
- module Bio
2
- class SQL
3
- class SeqfeaturePath < DummyBase
4
- set_primary_keys :object_seqfeature_id, :subject_seqfeature_id, :term_id
5
- set_sequence_name nil
6
- belongs_to :object_seqfeature, :class_name => "Seqfeature", :foreign_key => "object_seqfeature_id"
7
- belongs_to :subject_seqfeature, :class_name => "Seqfeature", :foreign_key => "subject_seqfeature_id"
8
- belongs_to :term, :class_name => "Term"
9
- end
10
- end #SQL
11
- end #Bio
@@ -1,20 +0,0 @@
1
-
2
- module Bio
3
- class SQL
4
- class SeqfeatureQualifierValue < DummyBase
5
- set_primary_keys :seqfeature_id, :term_id, :rank
6
- set_sequence_name nil
7
- belongs_to :seqfeature
8
- belongs_to :term, :class_name => "Term"
9
-
10
- def self.find_cluster(query)
11
- term_note= Term.find_by_name('note')
12
- find(:all, :conditions =>["value like ? and term_id = ?", "cl:#{query}", term_note])
13
- end
14
- def self.find_cluster_info(query)
15
- term_note= Term.find_by_name('note')
16
- find(:all, :conditions =>["value like ? and term_id = ?", "cli:#{query}", term_note])
17
- end
18
- end
19
- end #SQL
20
- end #Bio
@@ -1,11 +0,0 @@
1
-
2
- module Bio
3
- class SQL
4
- class SeqfeatureRelationship <DummyBase
5
- set_sequence_name "seqfeatue_relationship_pk_seq"
6
- belongs_to :term, :class_name => "Term"
7
- belongs_to :object_seqfeature, :class_name => "Seqfeature"
8
- belongs_to :subject_seqfeature, :class_name => "Seqfeature"
9
- end
10
- end #SQL
11
- end #Bio
@@ -1,12 +0,0 @@
1
-
2
- module Bio
3
- class SQL
4
- class Taxon < DummyBase
5
- set_sequence_name "taxon_pk_seq"
6
- has_many :taxon_names, :class_name => "TaxonName"
7
- has_one :taxon_scientific_name, :class_name => "TaxonName", :conditions=>"name_class = 'scientific name'"
8
- has_one :taxon_genbank_common_name, :class_name => "TaxonName", :conditions=>"name_class = 'genbank common name'"
9
- has_one :bioentry, :class_name => "Bioentry"
10
- end
11
- end #SQL
12
- end #Bio
@@ -1,9 +0,0 @@
1
-
2
- module Bio
3
- class SQL
4
- class TaxonName < DummyBase
5
- set_primary_keys :taxon_id, :name, :name_class
6
- belongs_to :taxon, :class_name => "Taxon"
7
- end
8
- end #SQL
9
- end #Bio
@@ -1,27 +0,0 @@
1
-
2
- module Bio
3
- class SQL
4
- class Term < DummyBase
5
- belongs_to :ontology, :class_name => "Ontology"
6
- has_many :seqfeature_qualifier_values, :class_name => "SeqfeatureQualifierValue"
7
- has_many :dbxref_qualifier_values, :class_name => "DbxrefQualifierValue"
8
- has_many :bioentry_qualifer_values, :class_name => "BioentryQualifierValue"
9
- has_many :bioentries, :through=>:bioentry_qualifier_values
10
- has_many :locations, :class_name => "Location"
11
- has_many :seqfeature_relationships, :class_name => "SeqfeatureRelationship"
12
- has_many :term_dbxrefs, :class_name => "TermDbxref"
13
- has_many :term_relationship_terms, :class_name => "TermRelationshipTerm"
14
- has_many :term_synonyms, :class_name => "TermSynonym"
15
- has_many :location_qualifier_values, :class_name => "LocationQualifierValue"
16
- has_many :seqfeature_types, :class_name => "Seqfeature", :foreign_key => "type_term_id"
17
- has_many :seqfeature_sources, :class_name => "Seqfeature", :foreign_key => "source_term_id"
18
- has_many :term_path_subjects, :class_name => "TermPath", :foreign_key => "subject_term_id"
19
- has_many :term_path_predicates, :class_name => "TermPath", :foreign_key => "predicate_term_id"
20
- has_many :term_path_objects, :class_name => "TermPath", :foreign_key => "object_term_id"
21
- has_many :term_relationship_subjects, :class_name => "TermRelationship", :foreign_key =>"subject_term_id"
22
- has_many :term_relationship_predicates, :class_name => "TermRelationship", :foreign_key =>"predicate_term_id"
23
- has_many :term_relationship_objects, :class_name => "TermRelationship", :foreign_key =>"object_term_id"
24
- has_many :seqfeature_paths, :class_name => "SeqfeaturePath"
25
- end
26
- end #SQL
27
- end #Bio
@@ -1,11 +0,0 @@
1
-
2
- module Bio
3
- class SQL
4
- class TermDbxref < DummyBase
5
- set_primary_key nil #term_id, dbxref_id
6
- #delete set_sequence_name nil
7
- belongs_to :term, :class_name => "Term"
8
- belongs_to :dbxref, :class_name => "Dbxref"
9
- end
10
- end #SQL
11
- end #Bio
@@ -1,12 +0,0 @@
1
-
2
- module Bio
3
- class SQL
4
- class TermPath < DummyBase
5
- set_sequence_name "term_path_pk_seq"
6
- belongs_to :ontology, :class_name => "Ontology"
7
- belongs_to :subject_term, :class_name => "Term"
8
- belongs_to :object_term, :class_name => "Term"
9
- belongs_to :predicate_term, :class_name => "Term"
10
- end
11
- end #SQL
12
- end #Bio
@@ -1,13 +0,0 @@
1
-
2
- module Bio
3
- class SQL
4
- class TermRelationship < DummyBase
5
- set_sequence_name "term_relationship_pk_seq"
6
- belongs_to :ontology, :class_name => "Ontology"
7
- belongs_to :subject_term, :class_name => "Term"
8
- belongs_to :predicate_term, :class_name => "Term"
9
- belongs_to :object_term, :class_name => "Term"
10
- has_one :term_relationship_term, :class_name => "TermRelationshipTerm"
11
- end
12
- end #SQL
13
- end #Bio
@@ -1,11 +0,0 @@
1
-
2
- module Bio
3
- class SQL
4
- class TermRelationshipTerm < DummyBase
5
- #delete set_sequence_name nil
6
- set_primary_key :term_relationship_id
7
- belongs_to :term_relationship, :class_name => "TermRelationship"
8
- belongs_to :term, :class_name => "Term"
9
- end
10
- end #SQL
11
- end #Bio
@@ -1,10 +0,0 @@
1
-
2
- module Bio
3
- class SQL
4
- class TermSynonym < DummyBase
5
- #delete set_sequence_name nil
6
- set_primary_key nil
7
- belongs_to :term, :class_name => "Term"
8
- end
9
- end #SQL
10
- end #Bio