[BioRuby] BioSQL development
Julian Nordt
ju at ncoffee.de
Sun Aug 22 08:50:07 UTC 2010
Hi Rob,
I tried to use the BioSQL part of Bioruby for a webapplication based on
rails. With the idea of giving users the capability to upload genomes to
the application. However the mapping between BioSQL <-> GFF3 is(?)/were
not figured out completly, which was one of the reasons why I changed my
implementation to CHADO scheme.
In regard to your question I did use BioSQL in the following way:
def openBioConnection
Bio::SQL.establish_connection(:adapter => "mysql",
:host => "localhost",
:username => "xxx",
:password => "xxx",
:database => "biosql_development")
end
def get_sequence(bio_entry_id)
openBioConnection()
if !bio_entry_id.blank?
return Bio::SQL::Biosequence.find_by_bioentry_id(bio_entry_id)
end
end
def setSeqFeatName(id,name)
seq_feat = Bio::SQL::Seqfeature.find_by_seqfeature_id(id)
Bio::SQL::Seqfeature.update(seq_feat.id, :display_name => name)
end
(! This does not mean that it is the correct way or intended way of usage
as I'm new to ruby/bioruby !)
I had to make some small modifications to
bio-1.4.0\lib\bio\io\biosql\ar-biosql.rb and biosql.rb, unfortunately I do
not remember where exactly. Mostlikely some changes in regard to the
connection adapter and some changes to tablenames or similiar stuff.
As you can see in ar-biosql.rb all the "classes" for the biosql orm are
already defined, so one does not have to define the classes himself.
Hope this helps,
Julian Nordt
On Sun, 22 Aug 2010 08:22:18 +0200, Rob Syme <rob.syme at gmail.com> wrote:
> Is there a particular person who has taken charge of the BioSQL part of
> Bioruby?
> I just want confirmation that I'm not using it in completely the wrong
> way.
>
> Are the classes designed so that you generate models for an app (a rails
> app, for example) that inherit from the Bio::SQL::whatever? eg:
>
> $ rails g model Biodatabase name:string authority:string description:text
>
> and then in app/model/biodatabase.rb you change:
> class Biodatabase < ActiveRecord::Base
> end
>
> into:
> class Biodatabase < Bio::SQL::Biodatabase # which inherits
> ActiveRecord::Base
> end
>
> If I get a handle on this, I'd be happy to write it up for
> http://bioruby.open-bio.org/wiki/Tutorial#BioSQL
>
> Thanks for all the work by the dev team. Much appreciated - I use bioruby
> almost every day.
> -r
>
> Rob Syme
> _______________________________________________
> BioRuby Project - http://www.bioruby.org/
> BioRuby mailing list
> BioRuby at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioruby
>
--
Using Opera's revolutionary email client: http://www.opera.com/mail/
More information about the BioRuby
mailing list