<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Biorelated &#187; ruby</title>
	<atom:link href="http://biorelated.com/category/ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://biorelated.com</link>
	<description>[bioinformatics,biology,ruby,rails].each do &#124;b&#124; puts b.blog end</description>
	<lastBuildDate>Thu, 17 Dec 2009 14:02:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='biorelated.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://0.gravatar.com/blavatar/41054b22bbe7debbf1d63972772e21fa?s=96&#038;d=http://s2.wp.com/i/buttonw-com.png</url>
		<title>Biorelated &#187; ruby</title>
		<link>http://biorelated.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://biorelated.com/osd.xml" title="Biorelated" />
	<atom:link rel='hub' href='http://biorelated.com/?pushpress=hub'/>
		<item>
		<title>Standalone BLAST with Ruby revisited</title>
		<link>http://biorelated.com/2009/12/15/standalone-blast-with-ruby-revisited/</link>
		<comments>http://biorelated.com/2009/12/15/standalone-blast-with-ruby-revisited/#comments</comments>
		<pubDate>Tue, 15 Dec 2009 09:32:19 +0000</pubDate>
		<dc:creator>biorelated</dc:creator>
				<category><![CDATA[bioinformatics]]></category>
		<category><![CDATA[blast]]></category>
		<category><![CDATA[databases]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[tutorials]]></category>

		<guid isPermaLink="false">http://biorelated.wordpress.com/?p=211</guid>
		<description><![CDATA[Earlier  I showed a very simple way to perform a BLAST  using Ruby. Today I would like to revisit that topic for two reasons. The &#8220;using ruby with blast&#8221; search term seems to be very common and actually one of the ways that people reach my blog. The original post was not very through. BLAST [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=biorelated.com&amp;blog=1167040&amp;post=211&amp;subd=biorelated&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Earlier  I showed a very simple way to<a href="http://biorelated.wordpress.com/2007/10/03/standalone-blast-with-ruby-part-1/" target="_blank"> perform a BLAST  using Ruby</a>. Today I would like to revisit that topic for two reasons.</p>
<ol>
<li>The &#8220;using ruby with blast&#8221; search term seems to be very common and actually one of the ways that people reach my blog.</li>
<li>The original post was not very through.</li>
</ol>
<p>BLAST aka Basic Local Alignment Tool is used to search a sequence (either DNA or protein) against a database of other sequences (either all nucleotide or all protein) in order to identify similar sequences. BLAST has many different flavors and can  search DNA against DNA or protein against protein and also can translate a nucleotide query and search it against a protein database  and vice versa. It can also compute a “profile” for the query sequence and use that for further searches as well as search the query against a database of profiles.</p>
<p>The BLAST tool is fundamental to molecular biologists and bioinformaticians. There are excellent books and tutorials on how to and when to use BLAST, so i will assume all you need is to automated your work and parse the results. The actual algorithm is implemented in C and freely  available from the NCBI website.The first thing  to do is to download the appropriate binaries for your platform. <a title="installing blast" href="http://bioinfolab.unl.edu/emlab/documents/blast_readme/README.bls.html" target="_blank">Instructions for setting up and installing BLAST</a></p>
<p>Once installed on your system  the primary method of interaction is using the command line. Use formatdb to create blast databases and blastall to search for sequence homology for a given sequence against a given blast database.</p>
<p>In Ruby, there are two ways you can call the BLAST program. First using the <a href="http://bioruby.org/" target="_blank">Bioruby library</a> and second by writing your own ruby wrapper for the BLAST command line parameters and execution. Most often, one executes BLAST from the command line and then process the results file which is in either one of the many BLAST output formats. Bioruby is excellent  at parsing the results file. Using Bioruby with BLAST is  very straightforward:</p>
<pre><span style="color:#969696;">#blasting the bioruby way
</span>  <span style="color:#969696;">#query_file: a list of query sequences in fasta format
</span>  <span style="color:#969696;">#database_path: a path to the actual BLAST formatted database
</span>  <span style="color:#969696;">#program: The BLAST program to call, either of blastp,blastn,tblastn e.t.c.
</span>    <span style="color:#0000e6;">def</span> bio_blast(program, database_path,query_file)
        factory = <span style="color:#000000;">Bio</span>::<span style="color:#000000;">Blast</span>.local(program,database_path)

        ff = <span style="color:#000000;">Bio</span>::<span style="color:#000000;">FlatFile</span>.open(<span style="color:#000000;">Bio</span>::<span style="color:#000000;">FastaFormat</span>, query_file)
        ff.each <span style="color:#0000e6;">do</span> |entry|
           report = factory.query(entry) <span style="color:#969696;"># report will be a Blast::Report object
</span>          <span style="color:#969696;"># iterate trough the hits
</span>          report.each <span style="color:#0000e6;">do</span> |hit|
<div id="_mcePaste">            puts hit.bit_score        # bit score (*)</div>
<div id="_mcePaste">            puts hit.query_seq        # query sequence (TRANSLATOR'S NOTE: sequence of homologous region of query sequence)</div>
<div id="_mcePaste">            puts hit.midline          # middle line string of alignment of homologous region (*)</div>
<div id="_mcePaste">            puts hit.target_seq       # hit sequence (TRANSLATOR'S NOTE: sequence of homologous region of query sequence)</div>
<div id="_mcePaste">            puts hit.evalue           # E-value</div>
<div id="_mcePaste">            puts hit.identity         # % identity</div>
<div id="_mcePaste">            puts hit.overlap          # length of overlapping region</div>
<div id="_mcePaste">           puts hit.query_id         # identifier of query sequence</div>
<div id="_mcePaste">           puts hit.query_def        # definition(comment line) of query sequence</div>
<div id="_mcePaste">           puts hit.query_len        # length of query sequence</div>
<div id="_mcePaste">           puts hit.target_id        # identifier of hit sequence</div>
<div id="_mcePaste">           puts hit.target_def       # definition(comment line) of hit sequence</div>
<div id="_mcePaste">           puts hit.target_len       # length of hit sequence</div>
<div id="_mcePaste">           puts hit.query_start      # start position of homologous region in query sequence</div>
<div id="_mcePaste">           puts hit.query_end        # end position of homologous region in query sequence</div>
<div id="_mcePaste">           puts hit.target_start     # start position of homologous region in hit(target) sequence</div>
<div id="_mcePaste">           puts hit.target_end       # end position of homologous region in hit(target) sequence</div>
<div id="_mcePaste">           puts hit.lap_at           # array of above four numbers</div>

hit.each <span style="color:#0000e6;">do</span> |hsp|
             puts hsp.query_from
            <span style="color:#0000e6;">end</span>
         <span style="color:#0000e6;">end</span>
      <span style="color:#0000e6;">end</span>
    <span style="color:#0000e6;">end</span>
<span style="color:#0000e6;">
</span></pre>
<p><span style="color:#000000;">The method will execute BLAST and also print the hits and the high scoring potions start coordinates for each hit. How ever you may want to just run BLAST without the bioruby overhead. The line below will work as well:</span><span style="color:#000000;"><br />
</span></p>
<pre>  input = query_path
    <span style="color:#969696;">#execute blast and store the results in the blast_results  variable
</span>    <span style="color:#969696;">#-p blast program to run
</span>    <span style="color:#969696;">#-d blast database to query against
</span>    <span style="color:#969696;">#-T gives a html output
</span>    <span style="color:#969696;">#-i query file path
</span>
  <span style="color:#969696;">#execution</span>
blast_result = <span style="color:#ce7b00;">%x(</span><span style="color:#ce7b00;">blastall -p </span><span style="color:#ce7b00;">#{</span><span style="color:#000000;background:#ffffff;">program</span><span style="color:#ce7b00;">}</span><span style="color:#ce7b00;"> -d </span><span style="color:#ce7b00;">#{</span><span style="color:#000000;background:#ffffff;">database</span><span style="color:#ce7b00;">}</span><span style="color:#ce7b00;"> -e </span><span style="color:#ce7b00;">#{</span><span style="color:#000000;background:#ffffff;">expectation</span><span style="color:#ce7b00;">}</span><span style="color:#ce7b00;"> -M </span><span style="color:#ce7b00;">#{</span><span style="color:#000000;background:#ffffff;">matrix</span><span style="color:#ce7b00;">}</span>
<span style="color:#ce7b00;">                 -i </span><span style="color:#ce7b00;">#{</span><span style="color:#000000;background:#ffffff;">input</span><span style="color:#ce7b00;">}</span><span style="color:#ce7b00;"> -T  T</span><span style="color:#ce7b00;">)</span>
<span style="color:#ce7b00;">#blast_result will be the output from the system execution of the above command. You can choose to write it </span>
<span style="color:#ce7b00;">to a file or process it using the Bio::Blast::Report object.</span></pre>
<p>You can use a similar style command like the one above to create BLAST databases using the formatdb command.</p>
<p>I would recommend the use of the bio-ruby blast report parsing classes to automate the process. Please look at the <a title="Bioruby" href="http://bioruby.org/" target="_blank">Bio-ruby API documentation</a> for more details.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/biorelated.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/biorelated.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/biorelated.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/biorelated.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/biorelated.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/biorelated.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/biorelated.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/biorelated.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/biorelated.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/biorelated.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/biorelated.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/biorelated.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/biorelated.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/biorelated.wordpress.com/211/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=biorelated.com&amp;blog=1167040&amp;post=211&amp;subd=biorelated&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://biorelated.com/2009/12/15/standalone-blast-with-ruby-revisited/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d9e14f1be0972ff1f393cc87dbd072e1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">george_g</media:title>
		</media:content>
	</item>
		<item>
		<title>A ruby class for screen-scraping plasmodb database</title>
		<link>http://biorelated.com/2009/12/09/a-ruby-class-for-screen-scraping-plasmodb-database/</link>
		<comments>http://biorelated.com/2009/12/09/a-ruby-class-for-screen-scraping-plasmodb-database/#comments</comments>
		<pubDate>Wed, 09 Dec 2009 15:25:50 +0000</pubDate>
		<dc:creator>biorelated</dc:creator>
				<category><![CDATA[bioinformatics]]></category>
		<category><![CDATA[bioruby]]></category>
		<category><![CDATA[databases]]></category>
		<category><![CDATA[malaria]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[tutorials]]></category>

		<guid isPermaLink="false">http://biorelated.wordpress.com/?p=182</guid>
		<description><![CDATA[Plasmodb is the primary resource for retrieving Plasmodium falciparum genomic data and information. Unfortunately this database has no API or XML service to request or query its  information from a programmer&#8217;s point of view or for easy automation of sequence information retrieval.  Recently I needed to download a long list of Plasmodium falciparum genomic, Protein [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=biorelated.com&amp;blog=1167040&amp;post=182&amp;subd=biorelated&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a title="Plasmodb" href="http://www.plasmodb.org" target="_blank">Plasmodb</a> is the primary resource for retrieving <em>Plasmodium falciparum </em>genomic data and information. Unfortunately this database has no API or XML service to request or query its  information from a programmer&#8217;s point of view or for easy automation of sequence information retrieval.  Recently I needed to download a long list of <em>Plasmodium falciparum </em>genomic, Protein and other information for a set of genes. Been lazy to click and open the webpage for each gene in my list. I wrote this in ruby.</p>
<p>It would be great if Plasmodb  would provide an easy way  of automated sequence retrieval. A webservice or an XML output format would do. Screen scraping is not a very efficient approach.  Here we use<a title="ScrAPI" href="http://blog.labnotes.org/tag/scrapi/" target="_self"> Scrapi </a>which  is an HTML scraping toolkit for Ruby. It uses CSS selectors to write easy, maintainable scraping rules to select, extract and store data from HTML content.</p>
<p><img src="http://static.rubyforge.vm.bytemark.co.uk/themes/rubyforge/images/clear.png" alt="" width="10" height="1" /></p>
<pre><span style="color:#969696;">#A class to fetch information from plasmodb using the scrapi API
</span><span style="color:#969696;">#</span><span style="color:#969696;">#TODO handle  Scraper::Reader::HTTPUnspecifiedError
</span><span style="color:#0000e6;">class</span> <span style="color:#000000;">Plasmodb</span>
   <span style="color:#969696;">#retrives a information  using the gene_id
</span>   <span style="color:#969696;">#returns a structure obj
</span>  <span style="color:#0000e6;">def</span> fetch_by_gene_id(var_name)
    <span style="color:#0000e6;">begin</span>
      scraper = <span style="color:#000000;">Scraper</span>.define <span style="color:#0000e6;">do</span>
        process <span style="color:#ce7b00;">"</span><span style="color:#ce7b00;">div#genomicSequence pre</span><span style="color:#ce7b00;">"</span>,    <span style="color:#2e92c7;">:</span><span style="color:#2e92c7;">genomic_sequence</span>  =&gt; <span style="color:#2e92c7;">:</span><span style="color:#2e92c7;">text</span>
        process <span style="color:#ce7b00;">"</span><span style="color:#ce7b00;">div#transcriptSequence pre</span><span style="color:#ce7b00;">"</span>, <span style="color:#2e92c7;">:</span><span style="color:#2e92c7;">mrna_sequence</span> =&gt;<span style="color:#2e92c7;">:</span><span style="color:#2e92c7;">text</span>
        process <span style="color:#ce7b00;">"</span><span style="color:#ce7b00;">div#proteinSequence pre</span><span style="color:#ce7b00;">"</span>,    <span style="color:#2e92c7;">:</span><span style="color:#2e92c7;">protein_sequence</span>  =&gt;<span style="color:#2e92c7;">:</span><span style="color:#2e92c7;">text</span><span style="color:#969696;">
</span>        process <span style="color:#ce7b00;">"</span><span style="color:#ce7b00;">div#Aliases td&gt;table</span><span style="color:#ce7b00;">"</span>,       <span style="color:#2e92c7;">:</span><span style="color:#2e92c7;">aliases</span> =&gt;<span style="color:#2e92c7;">:</span><span style="color:#2e92c7;">text</span>
        result <span style="color:#2e92c7;">:</span><span style="color:#2e92c7;">protein_sequence</span>,<span style="color:#2e92c7;">:</span><span style="color:#2e92c7;">aliases</span>,<span style="color:#2e92c7;">:</span><span style="color:#2e92c7;">mrna_sequence</span>,<span style="color:#2e92c7;">:</span><span style="color:#2e92c7;">genomic_sequence</span>
        <span style="color:#0000e6;">end
</span>
     search_link="http://plasmodb.org/plasmo/showRecord.do?
               name=GeneRecordClasses.GeneRecordClass&amp;source_id="+var_name+"&amp;project_id=PlasmoDB"
     uri = <span style="color:#000000;">URI</span>.parse(search_link)
     <span style="color:#009900;">@query</span> = scraper.scrape(uri)

    <span style="color:#0000e6;">rescue</span> <span style="color:#000000;">Scraper</span>::<span style="color:#000000;">Reader</span>::<span style="color:#000000;">HTTPUnspecifiedError</span>
      <span style="color:#ce7b00;">"</span><span style="color:#ce7b00;">None</span><span style="color:#ce7b00;">"</span>
    <span style="color:#0000e6;">end</span>
  <span style="color:#0000e6;">end</span>
  <span style="color:#969696;">#returns the predicted protein sequence
</span>  <span style="color:#0000e6;">def</span> protein_sequence
    <span style="color:#009900;">@query</span>.protein_sequence.chomp
  <span style="color:#0000e6;">end</span>
<span style="color:#969696;">#  Returns the genomic sequence
</span>  <span style="color:#0000e6;">def</span> genomic_sequence
    <span style="color:#009900;">@query</span>.genomic_sequence.chomp
  <span style="color:#0000e6;">end</span>
  <span style="color:#969696;">#returns Aliases
</span>  <span style="color:#0000e6;">def</span> aliases
    <span style="color:#009900;">@query</span>.aliases
  <span style="color:#0000e6;">end</span>
  <span style="color:#969696;">#returns the mrna sequence
</span>  <span style="color:#0000e6;">def</span> mrna_sequence
    <span style="color:#009900;">@query</span>.mrna_sequence.chomp
  <span style="color:#0000e6;">end</span>
<span style="color:#0000e6;">end</span>

<span style="color:#969696;">#Use the class to fetch information.</span><span style="color:#969696;">
</span>require <span style="color:#ce7b00;">'</span><span style="color:#ce7b00;">rubygems</span><span style="color:#ce7b00;">'</span>
require <span style="color:#ce7b00;">'</span><span style="color:#ce7b00;">bio</span><span style="color:#ce7b00;">'</span>
require <span style="color:#ce7b00;">'</span><span style="color:#ce7b00;">scrapi</span><span style="color:#ce7b00;">'</span>

file = <span style="color:#ce7b00;">"</span><span style="color:#ce7b00;">/home/george/genes_list.txt</span><span style="color:#ce7b00;">"</span> <span style="color:#969696;">#a file containing a list of accession numbers.
#one accession number per line
</span>
plasmo = <span style="color:#000000;">Plasmodb</span>.new <span style="color:#969696;">#initialize a plasmodb class instance
</span>
<span style="color:#969696;">#Read the file and process each accession number.
</span><span style="color:#000000;">File</span>.readlines(file).each <span style="color:#0000e6;">do</span> |line|
  line.chomp!
  plasmo.fetch_by_gene_id(line)  <span style="color:#969696;">#fetches the information from Plasmodb.
</span>  <span style="color:#969696;">#print a fasta entry for the protein sequence
</span>  puts <span style="color:#000000;">Bio</span>::<span style="color:#000000;">Sequence</span>.new(plasmo.protein_sequence).output(<span style="color:#2e92c7;">:</span><span style="color:#2e92c7;">fasta</span>,<span style="color:#2e92c7;">:</span><span style="color:#2e92c7;">header</span>=&gt;line)
  puts <span style="color:#000000;">Bio</span>::<span style="color:#000000;">Sequence</span>.new(plasmo.genomic_sequence).output(<span style="color:#2e92c7;">:</span><span style="color:#2e92c7;">fasta</span>,<span style="color:#2e92c7;">:</span><span style="color:#2e92c7;">header</span>=&gt;line)
<span style="color:#0000e6;">end</span>

<span style="color:#0000e6;">#another example</span><span style="color:#0000e6;">
<div id="_mcePaste">#p = Plasmodb.new</div>
<div id="_mcePaste">#p.fetch_by_gene_id("PFD0020c")</div>
<div id="_mcePaste">#puts p.genomic_sequence</div>

</span></pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/biorelated.wordpress.com/182/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/biorelated.wordpress.com/182/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/biorelated.wordpress.com/182/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/biorelated.wordpress.com/182/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/biorelated.wordpress.com/182/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/biorelated.wordpress.com/182/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/biorelated.wordpress.com/182/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/biorelated.wordpress.com/182/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/biorelated.wordpress.com/182/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/biorelated.wordpress.com/182/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/biorelated.wordpress.com/182/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/biorelated.wordpress.com/182/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/biorelated.wordpress.com/182/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/biorelated.wordpress.com/182/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=biorelated.com&amp;blog=1167040&amp;post=182&amp;subd=biorelated&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://biorelated.com/2009/12/09/a-ruby-class-for-screen-scraping-plasmodb-database/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d9e14f1be0972ff1f393cc87dbd072e1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">george_g</media:title>
		</media:content>

		<media:content url="http://static.rubyforge.vm.bytemark.co.uk/themes/rubyforge/images/clear.png" medium="image" />
	</item>
		<item>
		<title>A Ruby algorithms resource</title>
		<link>http://biorelated.com/2007/11/17/a-ruby-algorithms-resource/</link>
		<comments>http://biorelated.com/2007/11/17/a-ruby-algorithms-resource/#comments</comments>
		<pubDate>Sat, 17 Nov 2007 08:50:20 +0000</pubDate>
		<dc:creator>biorelated</dc:creator>
				<category><![CDATA[algorithms]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://biorelated.wordpress.com/2007/11/17/a-ruby-algorithms-resource/</guid>
		<description><![CDATA[An algorithm is a procedure to accomplish a specific task. They solve general well specified problems and are the ideas behind computer programs. Rubyquiz is an interesting repository for ruby programs that implement queit interesting algorithms. Even though the programs may not have anything to do with biology, some of the algorithms definitely do. It [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=biorelated.com&amp;blog=1167040&amp;post=19&amp;subd=biorelated&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://biorelated.wordpress.com/2007/11/17/a-ruby-algorithms-resource/ruby-quiz-resource/" target="_blank" rel="attachment wp-att-20" title="Ruby quiz resource"><img src="http://biorelated.files.wordpress.com/2007/11/ruby_quiz_logo.thumbnail.jpg" alt="Ruby quiz resource" /></a>An algorithm is a procedure to accomplish a specific task. They solve general well specified problems and are the ideas behind computer programs.</p>
<p><a href="http://www.rubyquiz.com/index.html" title="Ruby Quiz" target="_blank">Rubyquiz</a> is an interesting repository for ruby programs  that implement queit interesting algorithms. Even though the programs may not  have anything to do with biology, some of the algorithms definitely do.  It is a good place to a find a start point for your ruby algorithm implementation. Browsing the different sets of problems can give a lot of insight on how to approach some common programming problems eg. writing an <a href="http://www.rubyquiz.com/quiz37.html" title="inference engine" target="_blank">inference engine</a>, <a href="http://www.rubyquiz.com/quiz74.html" title="hidden markov" target="_blank">a hidden markov</a> chain , <a href="http://www.rubyquiz.com/quiz103.html" target="_blank">dictionary matcher</a> etc</p>
<p>The site has about 147 quizzes as of this writing.  <a href="http://www.rubyquiz.com/index.html" title="Ruby Quiz" target="_blank">Take a look!</a></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/biorelated.wordpress.com/19/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/biorelated.wordpress.com/19/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/biorelated.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/biorelated.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/biorelated.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/biorelated.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/biorelated.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/biorelated.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/biorelated.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/biorelated.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/biorelated.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/biorelated.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/biorelated.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/biorelated.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/biorelated.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/biorelated.wordpress.com/19/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=biorelated.com&amp;blog=1167040&amp;post=19&amp;subd=biorelated&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://biorelated.com/2007/11/17/a-ruby-algorithms-resource/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d9e14f1be0972ff1f393cc87dbd072e1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">george_g</media:title>
		</media:content>

		<media:content url="http://biorelated.files.wordpress.com/2007/11/ruby_quiz_logo.thumbnail.jpg" medium="image">
			<media:title type="html">Ruby quiz resource</media:title>
		</media:content>
	</item>
		<item>
		<title>A ruby micro review</title>
		<link>http://biorelated.com/2007/11/10/a-ruby-micro-intro/</link>
		<comments>http://biorelated.com/2007/11/10/a-ruby-micro-intro/#comments</comments>
		<pubDate>Sat, 10 Nov 2007 13:26:49 +0000</pubDate>
		<dc:creator>biorelated</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[technology]]></category>

		<guid isPermaLink="false">http://biorelated.wordpress.com/2007/11/10/a-ruby-micro-intro/</guid>
		<description><![CDATA[Ruby is a reflective, dynamic, object-oriented programming language, created by Yukihiro Matsumoto and released to the public in 1995. It is an extremely pragmatic language, less concerned with formalities and more concerned with ease of development and valid results. You will see Agile principles running through ruby and particularly with rails. Most of all TDD [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=biorelated.com&amp;blog=1167040&amp;post=13&amp;subd=biorelated&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p class="content"><a href="http://biorelated.files.wordpress.com/2007/11/ruby-logo-notext.png" title="ruby logo"><img src="http://biorelated.files.wordpress.com/2007/11/ruby-logo-notext.thumbnail.png" alt="ruby logo" /></a><strong>Ruby</strong> is a reflective, dynamic, object-oriented programming language, created by Yukihiro Matsumoto and released to the public in 1995. It  is an extremely pragmatic language, less concerned with formalities and more concerned with ease of development and valid results. You will see Agile principles running through ruby and particularly with rails.  Most of all  TDD and BDD concepts / philosophies have been implemented for ruby developers. Ruby differs from most programming languages by syntax, culture, grammar and customs. It has more in common with LISP and Smalltalk than with most languages such as C++ and PHP.</p>
<p>If you can program in languages such as Perl, PHP, C or Pascal, using and learning ruby is quite easy, but the problem solving pespectives that ruby uses may throw you out at first.</p>
<p>The so popular and hyped  <a href="http://www.rubyonrails.com" title="ruby on rails site">ruby on rails</a> DSL (domain specific language) is a framework for developing web applications and currently powers hundreds of large websites around the world.</p>
<p><a href="http://bioruby.org" title="bioruby" target="_blank">Bioruby</a> is an excellent bioinformatics library for ruby. Though not highly documented like its sister, <a href="http://bioperl.org" title="bioperl">bioperl</a>, efforts are been made to improve its level of documentation. The bioruby community is also really nice and friendly. Not a single question that i have posted on the mailing list goes unanswered.</p>
<p>Hundreds of libraries for performing different tasks have been written for ruby , packaged as gems and  hosted at <a href="http://www.rubyforge.org" title="rubyforge" target="_blank">rubyforge</a></p>
<p>So far my favorite ruby editor is the <a href="http://www.netbeans.org" title="Netbeans IDE" target="_blank">netbeans IDE</a>, whose currently release is  in beta 2. The final release is slated for 3rd of Dec 2007. (Am waiting!). It features auto completion, syntax highlighting among other cool things that makes programming a joy. It also comes bundled with the jruby release,  a java implementation of ruby that is starting to  rock the world,  so you can choose to use either native ruby or jruby, the choice is all yours!</p>
<p>Ruby can be downloaded <a href="http://www.ruby-lang.org/en/" title="ruby official site" target="_blank">here</a></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/biorelated.wordpress.com/13/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/biorelated.wordpress.com/13/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/biorelated.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/biorelated.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/biorelated.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/biorelated.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/biorelated.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/biorelated.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/biorelated.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/biorelated.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/biorelated.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/biorelated.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/biorelated.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/biorelated.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/biorelated.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/biorelated.wordpress.com/13/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=biorelated.com&amp;blog=1167040&amp;post=13&amp;subd=biorelated&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://biorelated.com/2007/11/10/a-ruby-micro-intro/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d9e14f1be0972ff1f393cc87dbd072e1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">george_g</media:title>
		</media:content>

		<media:content url="http://biorelated.files.wordpress.com/2007/11/ruby-logo-notext.thumbnail.png" medium="image">
			<media:title type="html">ruby logo</media:title>
		</media:content>
	</item>
		<item>
		<title>Standalone BLAST with Ruby (windows)</title>
		<link>http://biorelated.com/2007/10/03/standalone-blast-with-ruby-part-1/</link>
		<comments>http://biorelated.com/2007/10/03/standalone-blast-with-ruby-part-1/#comments</comments>
		<pubDate>Wed, 03 Oct 2007 11:42:37 +0000</pubDate>
		<dc:creator>biorelated</dc:creator>
				<category><![CDATA[bioinformatics]]></category>
		<category><![CDATA[blast]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[technology]]></category>

		<guid isPermaLink="false">http://biorelated.wordpress.com/2007/10/03/standalone-blast-with-ruby-part-1/</guid>
		<description><![CDATA[Updated article BLAST is one of the most widely used search algorithms in molecular biology. So lets see how you can run and retrieve blast results via a simple Ruby script .I will assume you already have ruby 1.8.5 and above installed in your windows box and a standalone blast.exe which you can download from [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=biorelated.com&amp;blog=1167040&amp;post=10&amp;subd=biorelated&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://biorelated.wordpress.com/2009/12/15/standalone-blast-with-ruby-revisited/" target="_blank">Updated article</a></p>
<div id="_mcePaste">BLAST is one of the most widely used search algorithms in molecular biology. So lets see how you can run and retrieve blast results via a simple Ruby script .I will assume you already have ruby 1.8.5 and above installed in your windows box and a standalone blast.exe which you can download from the NCBI&#8217;s ftp site here . The latest windows binaries as of this writing is 2.2.17. Create a new folder in C and call it NCBI_Blast. Paste the downloaded blast program in this folder. Double click the blast program and it will create a bin, doc and data folders inside your your NCBI_Blast folder. If this is your first time to install blast in your machine. You will need to do a little configuration. Follow these instructions for setting up blast .</div>
<pre>#create a query sequence
myseq="pcaatcacatyyawwqqffgghhhkllkl"
#create a temporary file
require 'tempfile'
temp=Tempfile.new("seqfile")
#get the name of the temporary file
name=temp.path
#append the contents your sequence to this temporary file
temp.puts "#{myseq}"
temp.close
#since we have a protein query sequence, we will run a blastp. Please note that you will need to have a valid #database to query against. use the formatdb command to create your database before executing the lines #below.
@program = 'blastp'
#path to blast
@database = 'c:/path_to_databasefile'
#name of your query file
@input= name
#your blast output file
@output='c:/path_output_file'
#assume your blast is in a folder called NCBI_Blast, execute
system( "c:/NCBI_Blast/bin/blastall.exe -p #{@program} -d #{@database} -i #{@input} -o #{@output}")
#To capture the output in a variable execute this command instead.
#note that we have omitted the blast -o parameter
result=%x(c:/NCBI_Blast/bin/blastall.exe -p #{@program} -d #{@database} -i #{@input} )
#remember to delete the temporary file!
temp.close(true)</pre>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/biorelated.wordpress.com/10/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/biorelated.wordpress.com/10/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/biorelated.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/biorelated.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/biorelated.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/biorelated.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/biorelated.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/biorelated.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/biorelated.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/biorelated.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/biorelated.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/biorelated.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/biorelated.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/biorelated.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/biorelated.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/biorelated.wordpress.com/10/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=biorelated.com&amp;blog=1167040&amp;post=10&amp;subd=biorelated&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://biorelated.com/2007/10/03/standalone-blast-with-ruby-part-1/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d9e14f1be0972ff1f393cc87dbd072e1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">george_g</media:title>
		</media:content>
	</item>
	</channel>
</rss>