[BioRuby-cvs] bioruby/lib/bio/io/biosql ontology.rb, NONE, 1.1.2.1 reference.rb, NONE, 1.1.2.1 term_path.rb, NONE, 1.1.2.1 bioentry_dbxref.rb, NONE, 1.1.2.1 biodatabase.rb, NONE, 1.1.2.1 seqfeature.rb, NONE, 1.1.2.1 term_relationship.rb, NONE, 1.1.2.1 location.rb, NONE, 1.1.2.1 seqfeature_path.rb, NONE, 1.1.2.1 bioentry_relationship.rb, NONE, 1.1.2.1 dbxref_qualifier_value.rb, NONE, 1.1.2.1 dbxref.rb, NONE, 1.1.2.1 term_relationship_term.rb, NONE, 1.1.2.1 bioentry_reference.rb, NONE, 1.1.2.1 taxon_name.rb, NONE, 1.1.2.1 bioentry_path.rb, NONE, 1.1.2.1 biosequence.rb, NONE, 1.1.2.1 term.rb, NONE, 1.1.2.1 term_dbxref.rb, NONE, 1.1.2.1 seqfeature_qualifier_value.rb, NONE, 1.1.2.1 bioentry_qualifier_value.rb, NONE, 1.1.2.1 seqfeature_dbxref.rb, NONE, 1.1.2.1 location_qualifier_value.rb, NONE, 1.1.2.1 seqfeature_relationship.rb, NONE, 1.1.2.1 bioentry.rb, NONE, 1.1.2.1 taxon.rb, NONE, 1.1.2.1 comment.rb, NONE, 1.1.2.1 term_synonym.rb, NONE, 1.1.2.1

Raoul Jean Pierre Bonnal helios at dev.open-bio.org
Tue Mar 25 15:47:07 UTC 2008


Update of /home/repository/bioruby/bioruby/lib/bio/io/biosql
In directory dev.open-bio.org:/tmp/cvs-serv13290/lib/bio/io/biosql

Added Files:
      Tag: BRANCH-biohackathon2008
	ontology.rb reference.rb term_path.rb bioentry_dbxref.rb 
	biodatabase.rb seqfeature.rb term_relationship.rb location.rb 
	seqfeature_path.rb bioentry_relationship.rb 
	dbxref_qualifier_value.rb dbxref.rb term_relationship_term.rb 
	bioentry_reference.rb taxon_name.rb bioentry_path.rb 
	biosequence.rb term.rb term_dbxref.rb 
	seqfeature_qualifier_value.rb bioentry_qualifier_value.rb 
	seqfeature_dbxref.rb location_qualifier_value.rb 
	seqfeature_relationship.rb bioentry.rb taxon.rb comment.rb 
	term_synonym.rb 
Log Message:
BioSQL release "MIFI". biosql->biosequence, biosequence->biosql. Supported formats: Embl, Genbank; support sql stransactions creating new sequences on biosql; does not support references and comments for genbank and embl. Fasta->biosequence->biosql dosn't work.

--- NEW FILE: location.rb ---
module Bio
  class SQL 
    class Location < DummyBase
      #set_sequence_name "location_pk_seq"
      belongs_to :seqfeature
      belongs_to :dbxref
      belongs_to :term
      has_many :location_qualifier_values
      
      def to_s
        if strand==-1
          str="complement("+start_pos.to_s+".."+end_pos.to_s+")"
        else
          str=start_pos.to_s+".."+end_pos.to_s
        end
        return str    
      end 
      
    end
  end #SQL
end #Bio

--- NEW FILE: bioentry_reference.rb ---
module Bio
    class SQL
			class BioentryReference < DummyBase
				set_primary_key :bioentry_reference_id
				belongs_to :bioentry
				belongs_to :reference 
			end		
		end #SQL
end #Bio		


--- NEW FILE: bioentry_qualifier_value.rb ---
module Bio
  class SQL
    class BioentryQualifierValue < DummyBase
      #NOTE: added rank to primary_keys, now it's finished.
      set_primary_keys :bioentry_id, :term_id, :rank
      belongs_to :bioentry
      belongs_to :term
    end #BioentryQualifierValue
  end #SQL
end #Bio

--- NEW FILE: biosequence.rb ---
module Bio
    class SQL
			class Biosequence < DummyBase
				set_primary_key "bioentry_id"
#delete				set_sequence_name "biosequence_pk_seq"
				belongs_to :bioentry
			end
		end #SQL
end #Bio		   

--- NEW FILE: term.rb ---

 module Bio
    class SQL 
			    class Term < DummyBase
			      set_sequence_name "term_pk_seq"
			      belongs_to :ontology
			      has_many :seqfeature_qualifier_values, :class_name => "SeqfeatureQualifierValue"
			      has_many :dbxref_qualifier_values, :class_name => "DbxrefQualifierValue"
            has_many :bioentry_qualifer_values, :class_name => "BioentryQualifierValue"
            has_many :bioentries, :through=>:bioentry_qualifier_values
			      has_many :locations, :class_name => "Location"
			      has_many :seqfeature_relationships, :class_name => "SeqfeatureRelationship"
			      has_many :term_dbxrefs, :class_name => "TermDbxref"
			      has_many :term_relationship_terms, :class_name => "TermRelationshipTerm"
			      has_many :term_synonyms, :class_name => "TermSynonym"
			      has_many :location_qualifier_values, :class_name => "LocationQualifierValue"
			      has_many :seqfeature_types, :class_name => "Seqfeature", :foreign_key => "type_term_id"			      
			      has_many :seqfeature_sources, :class_name => "Seqfeature", :foreign_key => "source_term_id"			      
			      has_many :term_path_subjects, :class_name => "TermPath", :foreign_key => "subject_term_id"
			      has_many :term_path_predicates, :class_name => "TermPath", :foreign_key => "predicate_term_id"
			      has_many :term_path_objects, :class_name => "TermPath", :foreign_key => "object_term_id"			      
			      has_many :term_relationship_subjects, :class_name => "TermRelationship", :foreign_key =>"subject_term_id"
			      has_many :term_relationship_predicates, :class_name => "TermRelationship", :foreign_key =>"predicate_term_id"
			      has_many :term_relationship_objects, :class_name => "TermRelationship", :foreign_key =>"object_term_id"
			      
			    end		
		end #SQL
end #Bio

--- NEW FILE: bioentry_relationship.rb ---
module Bio
    class SQL
			class BioentryRelationship < DummyBase
#delete				set_primary_key "bioentry_relationship_id"
				set_sequence_name "bieontry_relationship_pk_seq"
				belongs_to :object_bioentry, :class_name => "Bioentry"
				belongs_to :subject_bioentry, :class_name => "Bioentry"
			end
		end #SQL
end #Bio		    

--- NEW FILE: dbxref.rb ---
 module Bio
    class SQL
			class Dbxref < DummyBase
#delete				set_primary_key "dbxref_id"
			      set_sequence_name "dbxref_pk_seq"
			      has_many :dbxref_qualifier_values, :class_name => "DbxrefQualifierValue"
			      has_many :locations, :class_name => "Location"
			      has_many :references, :class_name=>"Reference"
			      has_many :term_dbxrefs, :class_name => "TermDbxref"
			      has_many :bioentry_dbxrefs, :class_name => "BioentryDbxref"
            #TODO: check is with bioentry there is an has_and_belongs_to_many relationship has specified in schema overview.
			    end
    		end #SQL
end #Bio		

--- NEW FILE: bioentry_path.rb ---
module Bio
    class SQL
			class BioentryPath < DummyBase
				set_primary_key nil
#delete				set_sequence_name nil
				belongs_to :term
				#da sistemare per poter procedere.
				belongs_to :object_bioentry, :class_name=>"Bioentry"
				belongs_to :subject_bioentry, :class_name=>"Bioentry"
			end #BioentryPath
		end #SQL
end #Bio

--- NEW FILE: term_dbxref.rb ---

 module Bio
    class SQL 
			    class TermDbxref < DummyBase
			      set_primary_key nil #term_id, dbxref_id
#delete			      set_sequence_name nil
			      belongs_to :term
			      belongs_to :dbxref
			    end		
		end #SQL
end #Bio

--- NEW FILE: dbxref_qualifier_value.rb ---
 module Bio
    class SQL
			class DbxrefQualifierValue < DummyBase
				#think to use composite primary key
			      set_primary_key nil #dbxref_id, term_id, rank
#delete			      set_sequence_name nil
			      belongs_to :dbxref
			      belongs_to :term
			    end		
		end #SQL
end #Bio		


--- NEW FILE: seqfeature_dbxref.rb ---

 module Bio
    class SQL 
		    class SeqfeatureDbxref < DummyBase
		      set_primary_key nil #seqfeature_id, dbxref_id
#delete		      set_sequence_name nil
		      belongs_to :seqfeature
		      belongs_to :dbxref
		    end		
		end #SQL
end #Bio

--- NEW FILE: term_relationship_term.rb ---

 module Bio
    class SQL 
			    class TermRelationshipTerm < DummyBase
#delete			      set_sequence_name nil
			      set_primary_key :term_relationship_id
			      belongs_to :term_relationship
			      belongs_to :term
			    end		
		end #SQL
end #Bio

--- NEW FILE: location_qualifier_value.rb ---
 module Bio
    class SQL 
			class LocationQualifierValue <  DummyBase
			      set_primary_key nil #location_id, term_id
#delete			      set_sequence_name nil
			      belongs_to :location
			      belongs_to :term
			    end		
		end #SQL
end #Bio


--- NEW FILE: taxon_name.rb ---

 module Bio
    class SQL 
			    class TaxonName < DummyBase
			      set_primary_keys :taxon_id, :name, :name_class
			      belongs_to :taxon            
			    end		
		end #SQL
end #Bio

--- NEW FILE: seqfeature_relationship.rb ---

 module Bio
    class SQL 
			    class SeqfeatureRelationship <DummyBase
			      set_sequence_name "seqfeatue_relationship_pk_seq"
			      belongs_to :term
			      belongs_to :object_seqfeature, :class_name => "Seqfeature"
			      belongs_to :subject_seqfeature, :class_name => "Seqfeature"
			    end		
		end #SQL
end #Bio

--- NEW FILE: term_path.rb ---

 module Bio
    class SQL 
			    class TermPath < DummyBase
			      set_sequence_name "term_path_pk_seq"
			      belongs_to :ontology
			      belongs_to :subject_term, :class_name => "Term"
			      belongs_to :object_term, :class_name => "Term"
			      belongs_to :predicate_term, :class_name => "Term"
			    end		
		end #SQL
end #Bio

--- NEW FILE: ontology.rb ---

 module Bio
    class SQL 
		    class Ontology < DummyBase
#delete		    	set_primary_key "ontology_id"
		      set_sequence_name "ontology_pk_seq"
		      has_many :terms
		      has_many :term_paths
		      has_many :term_relationships
		    end		
		end #SQL
end #Bio

--- NEW FILE: term_synonym.rb ---

 module Bio
    class SQL 
			    class TermSynonym < DummyBase
#delete			      set_sequence_name nil
			      set_primary_key nil
			      belongs_to :term
			    end		
		end #SQL
end #Bio

--- NEW FILE: seqfeature_qualifier_value.rb ---

module Bio
  class SQL 
    class SeqfeatureQualifierValue < DummyBase
      set_primary_keys :seqfeature_id, :term_id, :rank
      set_sequence_name nil
      belongs_to :seqfeature
      belongs_to :term
    end		
  end #SQL
end #Bio

--- NEW FILE: bioentry.rb ---
module Bio
    class SQL
			class Bioentry < DummyBase
#				set_sequence_name "bioentry_pk_seq"
				belongs_to :biodatabase
				belongs_to :taxon
				has_one :biosequence
				has_many :comments, :class_name =>"Comment", :order =>'rank'
				has_many :seqfeatures, :order=>'rank'
				has_many :bioentry_references, :class_name=>"BioentryReference" #, :foreign_key => "bioentry_id"
				has_many :bioentry_dbxrefs
				has_many :object_bioentry_relationships, :class_name=>"BioentryRelationship", :foreign_key=>"object_bioentry_id" #non mi convince molto credo non funzioni nel modo corretto
				has_many :subject_bioentry_relationships, :class_name=>"BioentryRelationship", :foreign_key=>"subject_bioentry_id" #non mi convince molto credo non funzioni nel modo corretto

				has_many :cdsfeatures, :class_name=>"Seqfeature", :foreign_key =>"bioentry_id", :conditions=>["terms.name='CDS'"], :include=>"typeterm"
        
        has_many :terms, :through=>:bioentry_qualifier_values
        #NOTE: added order_by for multiple hit and manage ranks correctly
        has_many :bioentry_qualifier_values, :order=>"bioentry_id,term_id,rank"
        
				#per la creazione richiesti:
				#name, accession, version
#				validates_uniqueness_of :accession, :scope=>[:biodatabase_id]
#				validates_uniqueness_of :name, :scope=>[:biodatabase_id] 
			#	validates_uniqueness_of :identifier, :scope=>[:biodatabase_id]
				
			end
		end #SQL
end #Bio	

--- NEW FILE: reference.rb ---

 module Bio
    class SQL 
		    class Reference < DummyBase  
		      belongs_to :dbxref
		      has_many :bioentry_references, :class_name=>"BioentryRefernce"
		    end		
		end #SQL
end #Bio

--- NEW FILE: seqfeature.rb ---

module Bio
  class SQL 
    class Seqfeature <DummyBase  
      set_sequence_name "seqfeature_pk_seq"
      belongs_to :bioentry
      belongs_to :type_term, :class_name => "Term", :foreign_key => "type_term_id"
      belongs_to :source_term, :class_name => "Term", :foreign_key =>"source_term_id"
      has_many :seqfeature_dbxrefs
      has_many :dbxrefs
      has_many :seqfeature_qualifier_values, :order=>'rank'
      has_many :locations, :order=>'rank'
      has_many :object_seqfeature_paths, :class_name => "SeqfeaturePath", :foreign_key => "object_seqfeature_id"
      has_many :subject_seqfeature_paths, :class_name => "SeqfeaturePath", :foreign_key => "subject_seqfeature_id"
      has_many :object_seqfeature_relationships, :class_name => "SeqfeatureRelationship", :foreign_key => "object_seqfeature_id"
      has_many :subject_seqfeature_relationships, :class_name => "SeqfeatureRelationship", :foreign_key => "subject_seqfeature_id"
    end		
  end #SQL
end #Bio

--- NEW FILE: comment.rb ---
 module Bio
    class SQL
			class Comment < DummyBase
#delete				set_primary_key "comment_id"
			      set_sequence_name "comment_pk_seq"
			      belongs_to :bioentry
			end
		end #SQL
end #Bio		   

--- NEW FILE: seqfeature_path.rb ---
 module Bio
    class SQL 
			   class SeqfeaturePath < DummyBase
			      set_primary_key nil 
			      set_sequence_name nil
			      belongs_to :object_seqfeature, :class_name => "Seqfeature"
			      belongs_to :subject_seqfeature, :class_name => "Seqfeature"
			    end		
		end #SQL
end #Bio

--- NEW FILE: bioentry_dbxref.rb ---
module Bio
		class SQL
			class BioentryDbxref < DummyBase
#delete				set_sequence_name nil
				set_primary_key nil #bioentry_id,dbxref_id
				belongs_to :bioentry
				belongs_to :dbxref
			end
    		end #SQL
end #Bio	


--- NEW FILE: term_relationship.rb ---

 module Bio
    class SQL 
			    class TermRelationship < DummyBase
			      set_sequence_name "term_relationship_pk_seq"
			      belongs_to :ontology
			      belongs_to :subject_term, :class_name => "Term"
			      belongs_to :predicate_term, :class_name => "Term"
			      belongs_to :object_term, :class_name => "Term"
			      has_one :term_relationship_term
			    end		
		end #SQL
end #Bio

--- NEW FILE: taxon.rb ---

 module Bio
    class SQL 
			    class Taxon < DummyBase
			      set_sequence_name "taxon_pk_seq"
			      has_many :taxon_names, :class_name => "TaxonName"
            has_one :taxon_scientific_name, :class_name => "TaxonName", :conditions=>"name_class = 'scientific name'"
			      has_one :bioentry
			    end		
		end #SQL
end #Bio

--- NEW FILE: biodatabase.rb ---
module Bio
		class SQL
			class Biodatabase < DummyBase
#delete				set_primary_key "biodatabase_id"
 				set_sequence_name "biodatabase_pk_seq"
				has_many :bioentries, :class_name =>"Bioentry", :foreign_key => "biodatabase_id"
				validates_uniqueness_of :name
			end
		end #SQL
end #Bio	






More information about the bioruby-cvs mailing list