<?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/"
	>

<channel>
	<title>Ruby and Bioinformatics</title>
	<atom:link href="http://ruby.genedrift.org/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://ruby.genedrift.org</link>
	<description></description>
	<lastBuildDate>Wed, 12 Aug 2009 13:34:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1-alpha</generator>
		<item>
		<title>My first Ruby script (that actually does something useful)</title>
		<link>http://ruby.genedrift.org/?p=18</link>
		<comments>http://ruby.genedrift.org/?p=18#comments</comments>
		<pubDate>Wed, 12 Aug 2009 13:34:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[BioPython]]></category>
		<category><![CDATA[bioruby]]></category>
		<category><![CDATA[PubMed]]></category>

		<guid isPermaLink="false">http://ruby.genedrift.org/?p=18</guid>
		<description><![CDATA[We are on a grant writing mode. As I&#8217;m not actively participating of the writing per se, I decided to help on the background. We needed something to gather all the references and save them in a format that some software like Endnote was capable of reading. As I mentioned before BioPython seems really convoluted [...]]]></description>
			<content:encoded><![CDATA[
<!-- ALL ADSENSE ADS DISABLED -->
<p>We are on a grant writing mode. As I&#8217;m not actively participating of the writing <i>per se</i>, I decided to help on the background. We needed something to gather all the references and save them in a format that some software like Endnote was capable of reading. As I mentioned before BioPython seems really convoluted when accessing PubMed, so I decided to go with BioRuby. We had the references entries and their PMID organized this way</p>
<p><code><br />
Goldman, JM, Melo JV 2003 NEJM 349:1451		14534339<br />
Lewis GD 1993 Cancer Immunol Immun other 37: 255		8102322<br />
McShane LM 2009 Clin Canc Res 15: 1898		19276274<br />
Fox JL 2007 Nature Biotech 25: 489		17483821<br />
Bodin L 2005 Blood 106: 135		15790782<br />
</code></p>
<p>basically author name(s), journal information, two tabs and the PMID at the end of each row. From this I would need to search PubMed for the ID and download a formatted reference. The script I used was this</p>
<pre class="brush: ruby;">
require 'rubygems'
require 'bio'

my_file = File.new(ARGV[0])
refs = my_file.readlines
ids = []

refs.each do |line|
  pmid = line.strip().split(&quot;\t&quot;)
  ids.push(pmid[2])
end

ids.each do |id|
   entry = Bio::PubMed.query(id)
   medline = Bio::MEDLINE.new(entry)
   reference = medline.reference
   puts reference.endnote
end
</pre>
<p>The file name with the refs table is passed to the script that reads its entirety, ids is initialized as an array and the PMIDs are extracted from each line, by using a split on the tabs (not forgetting to remove the carriage return/line feed with strip) and saved in the ids array.</p>
<p>After that, by iterating over the ids array, we use the Bio::PubMed to query PubMed in order get the reference in PubMed format and then by using the Bio::MEDLINE we get the reference, which then can be output onto an Endnote format.</p>
<p>Quite simple and useful.</p>
<div style="margin-top: 10px; height: 15px;" class="zemanta-pixie"><a class="zemanta-pixie-a" href="http://reblog.zemanta.com/zemified/cd289ada-63e5-4459-8c3e-f459b96cef68/" title="Reblog this post [with Zemanta]"><img style="border: medium none ; float: right;" class="zemanta-pixie-img" src="http://img.zemanta.com/reblog_e.png?x-id=cd289ada-63e5-4459-8c3e-f459b96cef68" alt="Reblog this post [with Zemanta]"></a><span class="zem-script more-related pretty-attribution"><script type="text/javascript" src="http://static.zemanta.com/readside/loader.js" defer="defer"></script></span></div>
]]></content:encoded>
			<wfw:commentRss>http://ruby.genedrift.org/?feed=rss2&amp;p=18</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>BioRuby and something strange &#8230;</title>
		<link>http://ruby.genedrift.org/?p=13</link>
		<comments>http://ruby.genedrift.org/?p=13#comments</comments>
		<pubDate>Fri, 07 Aug 2009 21:15:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bioruby]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://ruby.genedrift.org/?p=13</guid>
		<description><![CDATA[I recently installed BioRuby on my machine and yesterday I need some script to access and get some pubmed IDs from NCBI. I had some time to write the script, so I decided to compare the functionality of BioRuby with BioPython. As I have more Python knowledge, I decided to start with it. Turns out, [...]]]></description>
			<content:encoded><![CDATA[
<!-- ALL ADSENSE ADS DISABLED -->
<p>I recently installed BioRuby on my machine and yesterday I need some script to access and get some pubmed IDs from NCBI. I had some time to write the script, so I decided to compare the functionality of BioRuby with BioPython. As I have more Python knowledge, I decided to start with it. Turns out, it&#8217;s very complicated to get some PMIDs from search timers in BioPython. The programming is quite convoluted and not clear, maybe the tutorial doesn&#8217;t help.</p>
<p>I then decided to check BioRuby. I went to their wiki page and found exactly what I wanted, a short script that would return a list of PMIDs from search terms. And to my surprise, much simpler than anything I needed to do on BioPython. You can check the script below</p>
<pre class="brush: ruby;">require 'rubygems'
require 'bio'

keywords = ARGV.join(' ')

options = {
  'retmax' =&gt; 1
}

entries = Bio::PubMed.esearch(keywords, options)

Bio::PubMed.efetch(entries).each do |entry|
  medline = Bio::MEDLINE.new(entry)
  reference = medline.reference
  puts reference.bibtex
end
</pre>
<p>The only differences to the script on the wiki are the <i>require &#8216;rubygems&#8217;</i> that needs to be added due to the fact I&#8217;m on a Mac (using the default 1.8 version) and some small changes in the <i>options</i> hash, instead of returning 1000 I modified to return just the top result. The scripts searches fine, seems to download the data, but the output is quite strange. Apparently, each record is being split into different output records</p>
<p><code><br />
@article{PMID:,<br />
  author       = {Ji, R. Y.},<br />
  journal      = {},<br />
  year         = {},<br />
  volume       = {},<br />
}<br />
@article{PMID:,<br />
  journal      = {},<br />
  year         = {},<br />
  volume       = {},<br />
}<br />
@article{PMID:,<br />
  journal      = {},<br />
  year         = {},<br />
  volume       = {},<br />
}<br />
@article{PMID:,<br />
  journal      = {},<br />
  year         = {},<br />
  volume       = {},<br />
}<br />
@article{PMID:,<br />
  journal      = {},<br />
  year         = {},<br />
  volume       = {},<br />
}<br />
@article{PMID:,<br />
  journal      = {Yao Xue Xue Bao},<br />
  year         = {},<br />
  volume       = {},<br />
}<br />
</code></p>
<p>It&#8217;s very weird, don&#8217;t know if there&#8217;s a bug on my code or on BioRuby modules. Any help appreciated.</p>
]]></content:encoded>
			<wfw:commentRss>http://ruby.genedrift.org/?feed=rss2&amp;p=13</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Ruby books I&#8217;m reading</title>
		<link>http://ruby.genedrift.org/?p=11</link>
		<comments>http://ruby.genedrift.org/?p=11#comments</comments>
		<pubDate>Fri, 07 Aug 2009 20:59:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[books]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://ruby.genedrift.org/?p=11</guid>
		<description><![CDATA[Long time since I posted here, no updates at all. During this time I&#8217;m trying a different approach to learn a language: I&#8217;m actually reading the books and trying to immerse myself in the language. Basically I&#8217;m following three books, two at home and one at the office. These are the books I&#8217;m reading Home [...]]]></description>
			<content:encoded><![CDATA[
<!-- ALL ADSENSE ADS DISABLED -->
<p>Long time since I posted here, no updates at all. During this time I&#8217;m trying a different approach to learn a language: I&#8217;m actually reading the books and trying to immerse myself in the language. Basically I&#8217;m following three books, two at home and one at the office. These are the books I&#8217;m reading</p>
<p><strong>Home</strong><br />
<a href="http://www.amazon.com/gp/product/0596516177?ie=UTF8&#038;tag=genedrift-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=0596516177">The Ruby Programming Language</a><img src="http://www.assoc-amazon.com/e/ir?t=genedrift-20&#038;l=as2&#038;o=1&#038;a=0596516177" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /><br />
<a href="http://www.amazon.com/gp/product/1933988657?ie=UTF8&#038;tag=genedrift-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=1933988657">The Well-Grounded Rubyist</a><img src="http://www.assoc-amazon.com/e/ir?t=genedrift-20&#038;l=as2&#038;o=1&#038;a=1933988657" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /><br />
</p>
<p><strong>Office</strong><br />
<a href="http://www.amazon.com/gp/product/1934356085?ie=UTF8&#038;tag=genedrift-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=1934356085">Programming Ruby 1.9: The Pragmatic Programmers&#8217; Guide (Facets of Ruby)</a><img src="http://www.assoc-amazon.com/e/ir?t=genedrift-20&#038;l=as2&#038;o=1&#038;a=1934356085" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /><br />
</p>
<p>Of all three, the one I&#8217;m enjoying most is the Well Ground Rubyist, which is very clear and very well written.IT has a good introduction and nice examples. It&#8217;s not too deep (until the point I&#8217;m reading) and not too shallow. Really recommend it. Because of this I might have left The Ruby Programming Language on a forgotten corner.</p>
<p>I also like Programming Ruby 1.9, but it&#8217;s deeper than WGR. In one of the initial chapters it already has some unit tests. WGR is better written, but this is not a problem with PR1.9.</p>
<p>So far, I&#8217;m enjoying.</p>
]]></content:encoded>
			<wfw:commentRss>http://ruby.genedrift.org/?feed=rss2&amp;p=11</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My first contact with Ruby</title>
		<link>http://ruby.genedrift.org/?p=7</link>
		<comments>http://ruby.genedrift.org/?p=7#comments</comments>
		<pubDate>Fri, 27 Mar 2009 19:46:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Model-view-controller]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://ruby.genedrift.org/?p=7</guid>
		<description><![CDATA[Image via Wikipedia My first real contact with Ruby was a couple of years ago when I decided to find out more about Ruby on Rails, the famous web framework. My idea was to learn a little bit more of programming and the Model-View-Controller. I think at the time I had a couple of chapters [...]]]></description>
			<content:encoded><![CDATA[
<!-- ALL ADSENSE ADS DISABLED -->
<div class="zemanta-img" style="margin: 1em; display: block;">
<div>
<dl style="width: 212px;" class="wp-caption alignright">
<dt class="wp-caption-dt"><a href="http://commons.wikipedia.org/wiki/Image:Ruby_on_Rails_logo.jpg"><img src="http://upload.wikimedia.org/wikipedia/commons/thumb/9/9c/Ruby_on_Rails_logo.jpg/202px-Ruby_on_Rails_logo.jpg" alt="Ruby on Rails" title="Ruby on Rails" height="240" width="202"></a></dt>
<dd class="wp-caption-dd zemanta-img-attribution" style="font-size: 0.8em;">Image via <a href="http://commons.wikipedia.org/wiki/Image:Ruby_on_Rails_logo.jpg">Wikipedia</a></dd>
</dl>
</div>
</div>
<p>My first real contact with Ruby was a couple of years ago when I decided to find out more about <a class="zem_slink" href="http://www.rubyonrails.com" title="Ruby on Rails" rel="homepage">Ruby on Rails</a>, the famous web framework. My idea was to learn a little bit more of programming and the <a class="zem_slink" href="http://en.wikipedia.org/wiki/Model-view-controller" title="Model-view-controller" rel="wikipedia">Model-View-Controller</a>. I think at the time I had a couple of chapters of the <a class="zem_slink" href="http://en.wikipedia.org/wiki/Agile_Web_Development_with_Rails" title="Agile Web Development with Rails" rel="wikipedia">Agile Web Development with Rails</a> and did a little bit of the bookstore tutorial. At first glance, for a biologist, RoR was incredibly good and powerful. Just the fact that RoR &#8220;understands&#8221; your database and gets the fields and values with minimal coding is enough to find some reason to learn it.</p>
<p>I don&#8217;t know what happened and I ended up not having much time to continue learning and then Ruby and RoR were put on the backburner. Until late last year, at least. I god the third edition of <a href="http://www.pragprog.com/titles/rails3/agile-web-development-with-rails-third-edition">Agile Web Development with Rails</a>, which I highly recommend, and restarted the whole process. I was able to recreate the bookstore (not until the end, I admit) and even convert a <a href="http://python.genedrift.org/2009/02/09/managing-a-simple-database-with-python-sqlite-and-wxpython-1/">desktop Python application</a> to RoR.</p>
<p>But as everything done without method, the learning and conversion process was much more difficult than I expected. Particularly the deployment of the RoR app to a different webserver. So I decided to start from the beginning, got a couple more Ruby books and will learn from the beginning and try to use it in my daily programming routine, either converting Python scripts or new ones in Ruby.</p>
<div style="margin-top: 10px; height: 15px;" class="zemanta-pixie"><a class="zemanta-pixie-a" href="http://reblog.zemanta.com/zemified/c2cb290c-8a52-467a-ba75-b12f1192ad2e/" title="Zemified by Zemanta"><img style="border: medium none ; float: right;" class="zemanta-pixie-img" src="http://img.zemanta.com/reblog_a.png?x-id=c2cb290c-8a52-467a-ba75-b12f1192ad2e" alt="Reblog this post [with Zemanta]"></a><span class="zem-script more-related"><script type="text/javascript" src="http://static.zemanta.com/readside/loader.js" defer="defer"></script></span></div>
]]></content:encoded>
			<wfw:commentRss>http://ruby.genedrift.org/?feed=rss2&amp;p=7</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>And here a new journey begins &#8230;</title>
		<link>http://ruby.genedrift.org/?p=1</link>
		<comments>http://ruby.genedrift.org/?p=1#comments</comments>
		<pubDate>Wed, 25 Mar 2009 15:28:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[first post]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://ruby.genedrift.org/wordpress/?p=1</guid>
		<description><![CDATA[Image via Wikipedia Why Ruby? The same way why it was Python a couple of years ago. Just curiosity, but this time I have almost no background in Ruby as I had in Python when I started Beginning Python for Bioinformatics. This time is a different approach, I will tell my experiences in learning Ruby [...]]]></description>
			<content:encoded><![CDATA[
<!-- ALL ADSENSE ADS DISABLED -->
<div class="zemanta-img" style="margin: 1em; display: block;">
<div>
<dl style="width: 152px;" class="wp-caption alignright">
<dt class="wp-caption-dt"><a href="http://en.wikipedia.org/wiki/Image:Ruby-%28programming-language%29-logo-2008.png"><img src="http://upload.wikimedia.org/wikipedia/en/d/de/Ruby-%28programming-language%29-logo-2008.png" alt="Official Ruby logo" title="Official Ruby logo" height="163" width="142"></a></dt>
<dd class="wp-caption-dd zemanta-img-attribution" style="font-size: 0.8em;">Image via <a href="http://en.wikipedia.org/wiki/Image:Ruby-%28programming-language%29-logo-2008.png">Wikipedia</a></dd>
</dl>
</div>
</div>
<p>Why <a class="zem_slink" href="http://www.ruby-lang.org/" title="Ruby (programming language)" rel="homepage">Ruby</a>? The same way why it was Python a couple of years ago. Just curiosity, but this time I have almost no background in Ruby as I had in Python when I started <a href="http://python.genedrift.org">Beginning Python for Bioinformatics</a>. This time is a different approach, I will tell my experiences in learning Ruby (and some <a class="zem_slink" href="http://www.rubyonrails.com" title="Ruby on Rails" rel="homepage">Ruby on Rails</a>) along the way, while applying it to Bioinformatics tasks.</p>
<p>Stay tuned, it will be a bumpy ride &#8230;<br />
<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles by Zemanta</h6>
<ul class="zemanta-article-ul">
<li class="zemanta-article-ul-li"><a href="http://punetech.com/why-you-need-to-learn-ruby-and-rails/">Why you need to learn Ruby and Rails</a> (punetech.com)</li>
</ul>
<div style="margin-top: 10px; height: 15px;" class="zemanta-pixie"><a class="zemanta-pixie-a" href="http://reblog.zemanta.com/zemified/7ee0ba0b-b0fb-4ef6-ab39-3cac9812b917/" title="Zemified by Zemanta"><img style="border: medium none ; float: right;" class="zemanta-pixie-img" src="http://img.zemanta.com/reblog_a.png?x-id=7ee0ba0b-b0fb-4ef6-ab39-3cac9812b917" alt="Reblog this post [with Zemanta]"></a><span class="zem-script more-related"><script type="text/javascript" src="http://static.zemanta.com/readside/loader.js" defer="defer"></script></span></div>
]]></content:encoded>
			<wfw:commentRss>http://ruby.genedrift.org/?feed=rss2&amp;p=1</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
