doc/Tutorial.rd.html in bio-1.4.0 vs doc/Tutorial.rd.html in bio-1.4.1
- old
+ new
@@ -9,32 +9,35 @@
</head>
<body>
<h1><a name="label-0" id="label-0">BioRuby Tutorial</a></h1><!-- RDLabel: "BioRuby Tutorial" -->
<ul>
<li>Copyright (C) 2001-2003 KATAYAMA Toshiaki <k .at. bioruby.org></li>
-<li>Copyright (C) 2005-2009 Pjotr Prins, Naohisa Goto and others</li>
+<li>Copyright (C) 2005-2010 Pjotr Prins, Naohisa Goto and others</li>
</ul>
-<p>This document was last modified: 2009/12/27
+<p>This document was last modified: 2010/01/08
Current editor: Pjotr Prins <p .at. bioruby.org></p>
<p>The latest version resides in the GIT source code repository: ./doc/<a href="http://github.com/pjotrp/bioruby/raw/documentation/doc/Tutorial.rd">Tutorial.rd</a>.</p>
<h2><a name="label-1" id="label-1">Introduction</a></h2><!-- RDLabel: "Introduction" -->
<p>This is a tutorial for using Bioruby. A basic knowledge of Ruby is required.
If you want to know more about the programming langauge Ruby we recommend the
latest Ruby book <a href="http://www.pragprog.com/titles/ruby">Programming Ruby</a>
-by Dave Thomas and Andy Hunt - some of it is online
-<a href="http://www.rubycentral.com/pickaxe/">here</a>.</p>
+by Dave Thomas and Andy Hunt - the first edition is online
+<a href="http://www.ruby-doc.org/docs/ProgrammingRuby/">here</a>.</p>
<p>For BioRuby you need to install Ruby and the BioRuby package on your computer</p>
<p>You can check whether Ruby is installed on your computer and what
version it has with the</p>
<pre>% ruby -v</pre>
<p>command. Showing something like:</p>
<pre>ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]</pre>
<p>If you see no such thing you'll have to install Ruby using your installation
manager. For more information see the
<a href="http://www.ruby-lang.org/en/">Ruby</a> website.</p>
-<p>Once Ruby is works download and install Bioruby using the links on the
-<a href="http://bioruby.org/">Bioruby</a> website.</p>
+<p>With Ruby download and install Bioruby using the links on the
+<a href="http://bioruby.org/">Bioruby</a> website. The recommended installation is via
+Ruby gems:</p>
+<pre>gem install bio</pre>
+<p>See also the Bioruby <a href="http://bioruby.open-bio.org/wiki/Installation">wiki</a>.</p>
<p>A lot of BioRuby's documentation exists in the source code and unit tests. To
really dive in you will need the latest source code tree. The embedded rdoc
documentation can be viewed online at
<a href="http://bioruby.org/rdoc/">bioruby's rdoc</a>. But first lets start!</p>
<h2><a name="label-2" id="label-2">Trying Bioruby</a></h2><!-- RDLabel: "Trying Bioruby" -->
@@ -944,11 +947,64 @@
in bioruby.org. (The server internally get data from GenomeNet.
Because the KEGG/GENES database and AAindex database are not available
from other BioFetch servers, we used bioruby.org server with
Bio::Fetch.query method.)</p>
<h2><a name="label-22" id="label-22">BioSQL</a></h2><!-- RDLabel: "BioSQL" -->
-<p>to be written...</p>
+<p>BioSQL is a well known schema to store and retrive biological sequences using a RDBMS like PostgreSQL or MySQL; note that SQLite is not supported.
+First of all, you must install a database engine or have access to a remote one. Then create the schema and populate with the taxonomy. You can follow the <a href="http://code.open-bio.org/svnweb/index.cgi/biosql/view/biosql-schema/trunk/INSTALL">Official Guide</a> .
+Next step is to install these gems:</p>
+<ul>
+<li>ActiveRecord</li>
+<li>CompositePrimaryKeys (Rails doesn't handle by default composite primary keys)</li>
+<li>The layer to comunicate with you preferred RDBMS (postgresql, mysql, jdbcmysql in case you are running JRuby )</li>
+</ul>
+<p>You can find ActiveRecord's models in /bioruby/lib/bio/io/biosql</p>
+<p>When you have your database up and running, you can connect to it in this way:</p>
+<pre>#!/usr/bin/env ruby
+
+require 'bio'
+
+connection = Bio::SQL.establish_connection({'development'=>{'hostname'=>"YourHostname",
+ 'database'=>"CoolBioSeqDB",
+ 'adapter'=>"jdbcmysql",
+ 'username'=>"YourUser",
+ 'password'=>"YouPassword"
+ }
+ },
+ 'development')
+
+#The first parameter is the hash contaning the description of the configuration similar to database.yml in Rails application, you can declare different environment. The second parameter is the environment to use: 'development', 'test', 'production'.
+
+#To store a sequence into the database you simply need a biosequence object.
+biosql_database = Bio::SQL::Biodatabase.find(:first)
+ff = Bio::GenBank.open("gbvrl1.seq")
+
+ff.each_entry do |gb|
+ Bio::SQL::Sequence.new(:biosequence=>gb.to_biosequence, :biodatabase=>biosql_database
+end
+
+#You can list all the entries into every database
+Bio::SQL.list_entries
+
+#list databases:
+Bio::SQL.list_databases
+
+#retriving a generic accession
+bioseq = Bio::SQL.fetch_accession("YouAccession")
+
+#If you use biosequence objects, you will find all its method mapped to BioSQL sequences. But you can also access to the models directly:
+
+#get the raw sequence associated with you accession
+bioseq.entry.biosequence
+
+#get the length of your sequence, this is the explicit form of bioseq.length
+bioseq.entry.biosequence.length
+
+#convert the sequence in GenBank format
+bioseq.to_biosequence.output(:genbank)</pre>
+<p>BioSQL' <a href="http://www.biosql.org/wiki/Schema_Overview">schema</a> is not so intuitive at the beginning, spend some time on understanding it, in the end if you know a little bit of rails everything will go smootly. You can find information to Annotation <a href="http://www.biosql.org/wiki/Annotation_Mapping">here</a>
+ToDo: add exemaples from George. I remember he did some cool post on BioSQL and Rails.</p>
<h1><a name="label-23" id="label-23">PhyloXML</a></h1><!-- RDLabel: "PhyloXML" -->
<p>PhyloXML is an XML language for saving, analyzing and exchanging data of
annotated phylogenetic trees. PhyloXML parser in BioRuby is implemented in
Bio::PhyloXML::Parser and writer in Bio::PhyloXML::Writer.
More information at www.phyloxml.org</p>
@@ -1085,38 +1141,34 @@
print ",#{go}"
end
end</pre>
<p>Prints each mosq. accession/uniq identifier and the GO terms from the Drosphila
homologues.</p>
-<h2><a name="label-38" id="label-38">Comparing BioProjects</a></h2><!-- RDLabel: "Comparing BioProjects" -->
-<p>For a quick functional comparison of BioRuby, BioPerl, BioPython and Bioconductor (R) see <a href="http://sciruby.codeforpeople.com/sr.cgi/BioProjects"><URL:http://sciruby.codeforpeople.com/sr.cgi/BioProjects></a></p>
-<h2><a name="label-39" id="label-39">Using BioRuby with R</a></h2><!-- RDLabel: "Using BioRuby with R" -->
-<p>Using Ruby with R Pjotr wrote a section on SciRuby. See <a href="http://sciruby.codeforpeople.com/sr.cgi/RubyWithRlang"><URL:http://sciruby.codeforpeople.com/sr.cgi/RubyWithRlang></a></p>
-<h2><a name="label-40" id="label-40">Using BioPerl or BioPython from Ruby</a></h2><!-- RDLabel: "Using BioPerl or BioPython from Ruby" -->
+<h2><a name="label-38" id="label-38">Using BioPerl or BioPython from Ruby</a></h2><!-- RDLabel: "Using BioPerl or BioPython from Ruby" -->
<p>At the moment there is no easy way of accessing BioPerl from Ruby. The best way, perhaps, is to create a Perl server that gets accessed through XML/RPC or SOAP.</p>
-<h2><a name="label-41" id="label-41">Installing required external library</a></h2><!-- RDLabel: "Installing required external library" -->
+<h2><a name="label-39" id="label-39">Installing required external library</a></h2><!-- RDLabel: "Installing required external library" -->
<p>At this point for using BioRuby no additional libraries are needed, except if
you are using Bio::PhyloXML module. Then you have to install libxml-ruby.</p>
<p>This may change, so keep an eye on the Bioruby website. Also when
a package is missing BioRuby should show an informative message.</p>
<p>At this point installing third party Ruby packages can be a bit
painful, as the gem standard for packages evolved late and some still
force you to copy things by hand. Therefore read the README's
carefully that come with each package.</p>
-<h3><a name="label-42" id="label-42">Installing libxml-ruby</a></h3><!-- RDLabel: "Installing libxml-ruby" -->
+<h3><a name="label-40" id="label-40">Installing libxml-ruby</a></h3><!-- RDLabel: "Installing libxml-ruby" -->
<p>The simplest way is to use gem packaging system.</p>
<pre>gem install -r libxml-ruby</pre>
<p>If you get `require': no such file to load - mkmf (LoadError) error then do</p>
<pre>sudo apt-get install ruby-dev</pre>
<p>If you have other problems with installation, then see <a href="http://libxml.rubyforge.org/install.xml"><URL:http://libxml.rubyforge.org/install.xml></a> </p>
-<h2><a name="label-43" id="label-43">Trouble shooting</a></h2><!-- RDLabel: "Trouble shooting" -->
+<h2><a name="label-41" id="label-41">Trouble shooting</a></h2><!-- RDLabel: "Trouble shooting" -->
<ul>
<li>Error: in `require': no such file to load -- bio (LoadError)</li>
</ul>
<p>Ruby fails to find the BioRuby libraries - add it to the RUBYLIB path, or pass
it to the interpeter. For example:</p>
<pre>ruby -I$BIORUBYPATH/lib yourprogram.rb</pre>
-<h2><a name="label-44" id="label-44">Modifying this page</a></h2><!-- RDLabel: "Modifying this page" -->
+<h2><a name="label-42" id="label-42">Modifying this page</a></h2><!-- RDLabel: "Modifying this page" -->
<p>IMPORTANT NOTICE: This page is maintained in the BioRuby source code
repository. Please edit the file there otherwise changes may get
lost. See <!-- Reference, RDLabel "BioRuby Developer Information" doesn't exist --><em class="label-not-found">BioRuby Developer Information</em><!-- Reference end --> for repository and mailing list
access.</p>