<?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>Honolulu Hacker &#187; Bioinformatics</title>
	<atom:link href="http://honoluluhacker.com/category/bioinformatics/feed/" rel="self" type="application/rss+xml" />
	<link>http://honoluluhacker.com</link>
	<description>Tech, Linux, Rails by Honululu-based Kevin English</description>
	<lastBuildDate>Sat, 24 Sep 2011 22:53:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>Force download of fasta files and aln files with Apache</title>
		<link>http://honoluluhacker.com/2010/01/14/force-download-of-fasta-files-and-aln-files-with-apache/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=force-download-of-fasta-files-and-aln-files-with-apache</link>
		<comments>http://honoluluhacker.com/2010/01/14/force-download-of-fasta-files-and-aln-files-with-apache/#comments</comments>
		<pubDate>Thu, 14 Jan 2010 20:11:19 +0000</pubDate>
		<dc:creator>kenglish</dc:creator>
				<category><![CDATA[Bioinformatics]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://honoluluhacker.com/?p=998</guid>
		<description><![CDATA[If you are serving fasta files or alignment files on your server, you may want to force users to download them instead of previewing them in the browser. My application would return the fasta files as Content-Type text/plain. I wanted to force it to application/x-fasta and force download. This is accomplished rather easily in Apache [...]]]></description>
			<content:encoded><![CDATA[<p>If you are serving fasta files or alignment files on your server, you may want to force users to download them instead of previewing them in the browser. My application would return the fasta files as Content-Type text/plain. I wanted to force it to application/x-fasta and force download. This is accomplished rather easily in Apache with the following directive:</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;">  &lt;<span style="color: #000000; font-weight:bold;">FilesMatch</span> <span style="color: #7f007f;">&quot;<span style="color: #000099; font-weight: bold;">\.</span>(?i:fasta)$&quot;</span>&gt;
    <span style="color: #00007f;">ForceType</span> application/x-fasta
    <span style="color: #00007f;">Header</span> set Content-Disposition attachment
  &lt;/<span style="color: #000000; font-weight:bold;">FilesMatch</span>&gt;
  &lt;<span style="color: #000000; font-weight:bold;">FilesMatch</span> <span style="color: #7f007f;">&quot;<span style="color: #000099; font-weight: bold;">\.</span>(?i:aln)$&quot;</span>&gt;
    <span style="color: #00007f;">ForceType</span> application/x-aln
    <span style="color: #00007f;">Header</span> set Content-Disposition attachment
  &lt;/<span style="color: #000000; font-weight:bold;">FilesMatch</span>&gt;</pre></div></div>

<p>You will have to enable the apache module &#8220;mod_header&#8221; for this to work.</p>
]]></content:encoded>
			<wfw:commentRss>http://honoluluhacker.com/2010/01/14/force-download-of-fasta-files-and-aln-files-with-apache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Parsing Emboss Water output with Ruby</title>
		<link>http://honoluluhacker.com/2009/11/20/parsing-emboss-water-output-with-ruby/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=parsing-emboss-water-output-with-ruby</link>
		<comments>http://honoluluhacker.com/2009/11/20/parsing-emboss-water-output-with-ruby/#comments</comments>
		<pubDate>Fri, 20 Nov 2009 18:29:14 +0000</pubDate>
		<dc:creator>kenglish</dc:creator>
				<category><![CDATA[Bioinformatics]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://honoluluhacker.com/?p=812</guid>
		<description><![CDATA[First, you will need to install the emboss suite on your computer: sudo apt-get install emboss emboss-lib If don&#8217;t already have the BioRuby installed, you will need that too: sudo gem install bio --no-ri --no-rdoc Your first ruby script calling Emboss Water from Ruby: 1 2 3 4 5 require 'rubygems' require 'bio' test_filename =ARGV.shift [...]]]></description>
			<content:encoded><![CDATA[<p>First, you will need to install the emboss suite on your computer:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> emboss emboss-lib</pre></div></div>

<p>If don&#8217;t already have the <a href="http://bioruby.org/">BioRuby</a> installed, you will need that too:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> bio <span style="color: #660033;">--no-ri</span> <span style="color: #660033;">--no-rdoc</span></pre></div></div>

<p>Your first ruby script calling Emboss Water from Ruby:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'rubygems'</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'bio'</span>
test_filename =ARGV.<span style="color:#9900CC;">shift</span>
target_filename =ARGV.<span style="color:#9900CC;">shift</span>
result = <span style="color:#6666ff; font-weight:bold;">Bio::EMBOSS</span>.<span style="color:#9900CC;">run</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'water'</span>, <span style="color:#996600;">'-asequence'</span>, test_filename, <span style="color:#996600;">'-bsequence'</span>, target_filename<span style="color:#006600; font-weight:bold;">&#41;</span></pre></td></tr></table></div>

<p>Unforntunately, there is not a nice report result class in BioRuby for Emboss Water so you will have to parse the output yourself. Here&#8217;s an example script that finds percent similarity:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'rubygems'</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'bio'</span>
test_filename =ARGV.<span style="color:#9900CC;">shift</span>
target_filename =ARGV.<span style="color:#9900CC;">shift</span>
result = <span style="color:#6666ff; font-weight:bold;">Bio::EMBOSS</span>.<span style="color:#9900CC;">run</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'water'</span>, <span style="color:#996600;">'-asequence'</span>, test_filename, <span style="color:#996600;">'-bsequence'</span>, target_filename<span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#008000; font-style:italic;"># result now has the text output of water...</span>
<span style="color:#008000; font-style:italic;"># Here's an example of looping through each line of the result to get the similary:</span>
&nbsp;
test_seq = <span style="color:#996600;">&quot;&quot;</span>
target_seq = <span style="color:#996600;">&quot;&quot;</span>
similarity = <span style="color:#996600;">''</span>
&nbsp;
&nbsp;
result.<span style="color:#CC0066; font-weight:bold;">split</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;<span style="color:#000099;">\n</span>&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span> line <span style="color:#006600; font-weight:bold;">|</span>
  <span style="color:#008000; font-style:italic;"># This mean</span>
  <span style="color:#9966CC; font-weight:bold;">if</span> line =~ <span style="color:#006600; font-weight:bold;">/</span>^<span style="color:#008000; font-style:italic;"># Aligned_sequences/</span>
    <span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#996600;">&quot;Seq '#{test_seq}' has similarity to Seq '#{target_seq}' of #{similarity}&quot;</span>  <span style="color:#9966CC; font-weight:bold;">unless</span> <span style="color:#006600; font-weight:bold;">&#40;</span>test_seq == <span style="color:#996600;">&quot;&quot;</span> <span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&amp;&amp;</span> <span style="color:#006600; font-weight:bold;">&#40;</span>target_seq == <span style="color:#996600;">&quot;&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    test_seq = <span style="color:#996600;">&quot;&quot;</span>
    target_seq = <span style="color:#996600;">&quot;&quot;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#008000; font-style:italic;"># Get sequence numbers </span>
  <span style="color:#9966CC; font-weight:bold;">if</span> line =~ <span style="color:#006600; font-weight:bold;">/</span>^<span style="color:#008000; font-style:italic;"># (\d+): (\d+)/</span>
     test_seq  = $2 <span style="color:#9966CC; font-weight:bold;">if</span> $1 == <span style="color:#996600;">'1'</span>
     target_seq = $2 <span style="color:#9966CC; font-weight:bold;">if</span> $1 == <span style="color:#996600;">'2'</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#008000; font-style:italic;"># parse similarity</span>
  <span style="color:#9966CC; font-weight:bold;">if</span> line =~ <span style="color:#006600; font-weight:bold;">/</span>^<span style="color:#008000; font-style:italic;"># Similarity:.*\((.*)%\)/</span>
    similarity  = $1
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#996600;">&quot;Seq '#{test_seq}' has similarity to Seq '#{target_seq}' of #{similarity}&quot;</span></pre></div></div>

<p>Place this in a file called water.rb and run it with <a href="http://github.com/kenglishhi/ics632/blob/master/ics675/emboss/fastas/frags.fasta">frags.fasta</a> and <a href="http://github.com/kenglishhi/ics632/blob/master/ics675/emboss/fastas/frags1.fasta">frags1.fasta</a> and the above script will output this.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ ruby water.rb fastas<span style="color: #000000; font-weight: bold;">/</span>frags1.fasta frags.fasta 
Seq <span style="color: #ff0000;">'1'</span> has similarity to Seq <span style="color: #ff0000;">'1'</span> of <span style="color: #000000;">100.0</span>
Seq <span style="color: #ff0000;">'1'</span> has similarity to Seq <span style="color: #ff0000;">'2'</span> of <span style="color: #000000;">96.6</span>
Seq <span style="color: #ff0000;">'1'</span> has similarity to Seq <span style="color: #ff0000;">'3'</span> of <span style="color: #000000;">64.3</span>
Seq <span style="color: #ff0000;">'1'</span> has similarity to Seq <span style="color: #ff0000;">'4'</span> of <span style="color: #000000;">97.9</span>
Seq <span style="color: #ff0000;">'1'</span> has similarity to Seq <span style="color: #ff0000;">'5'</span> of <span style="color: #000000;">96.9</span>
Seq <span style="color: #ff0000;">'1'</span> has similarity to Seq <span style="color: #ff0000;">'6'</span> of <span style="color: #000000;">94.1</span>
Seq <span style="color: #ff0000;">'1'</span> has similarity to Seq <span style="color: #ff0000;">'7'</span> of <span style="color: #000000;">62.5</span>
Seq <span style="color: #ff0000;">'1'</span> has similarity to Seq <span style="color: #ff0000;">'8'</span> of <span style="color: #000000;">61.1</span>
Seq <span style="color: #ff0000;">'1'</span> has similarity to Seq <span style="color: #ff0000;">'9'</span> of <span style="color: #000000;">62.5</span>
Seq <span style="color: #ff0000;">'1'</span> has similarity to Seq <span style="color: #ff0000;">'10'</span> of <span style="color: #000000;">57.1</span>
Seq <span style="color: #ff0000;">'1'</span> has similarity to Seq <span style="color: #ff0000;">'11'</span> of <span style="color: #000000;">57.4</span>
Seq <span style="color: #ff0000;">'1'</span> has similarity to Seq <span style="color: #ff0000;">'12'</span> of <span style="color: #000000;">97.8</span>
Seq <span style="color: #ff0000;">'1'</span> has similarity to Seq <span style="color: #ff0000;">'13'</span> of <span style="color: #000000;">50.0</span>
Seq <span style="color: #ff0000;">'1'</span> has similarity to Seq <span style="color: #ff0000;">'14'</span> of <span style="color: #000000;">62.5</span>
Seq <span style="color: #ff0000;">'1'</span> has similarity to Seq <span style="color: #ff0000;">'15'</span> of <span style="color: #000000;">97.9</span>
Seq <span style="color: #ff0000;">'1'</span> has similarity to Seq <span style="color: #ff0000;">'16'</span> of <span style="color: #000000;">62.5</span>
Seq <span style="color: #ff0000;">'1'</span> has similarity to Seq <span style="color: #ff0000;">'17'</span> of <span style="color: #000000;">59.1</span>
Seq <span style="color: #ff0000;">'1'</span> has similarity to Seq <span style="color: #ff0000;">'18'</span> of <span style="color: #000000;">55.9</span>
Seq <span style="color: #ff0000;">'1'</span> has similarity to Seq <span style="color: #ff0000;">'19'</span> of <span style="color: #000000;">61.9</span>
Seq <span style="color: #ff0000;">'1'</span> has similarity to Seq <span style="color: #ff0000;">'20'</span> of <span style="color: #000000;">60.0</span>
Seq <span style="color: #ff0000;">'1'</span> has similarity to Seq <span style="color: #ff0000;">'21'</span> of <span style="color: #000000;">56.4</span>
Seq <span style="color: #ff0000;">'1'</span> has similarity to Seq <span style="color: #ff0000;">'22'</span> of <span style="color: #000000;">56.2</span></pre></div></div>

<p>Water is the worse name for a program, EVER. Because it is impossible to Google&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://honoluluhacker.com/2009/11/20/parsing-emboss-water-output-with-ruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>blast notes</title>
		<link>http://honoluluhacker.com/2009/03/23/blast-notes/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=blast-notes</link>
		<comments>http://honoluluhacker.com/2009/03/23/blast-notes/#comments</comments>
		<pubDate>Tue, 24 Mar 2009 04:57:28 +0000</pubDate>
		<dc:creator>kenglish</dc:creator>
				<category><![CDATA[Bioinformatics]]></category>

		<guid isPermaLink="false">http://honoluluhacker.com/?p=579</guid>
		<description><![CDATA[Create db from fasta file: formatdb -p F -i EST_Clade_A.fasta -n EST_Clade_A This will create a 3 files: EST_Clade_A.nhr, EST_Clade_A.nin, EST_Clade_A.nsq. If you omit the -n option, it will create EST_Clade_A.fasta.nhr, EST_Clade_A.fasta.nin, EST_Clade_A.fasta.nsq Blast example: blastall -p blastn -i EST_Clade_C_1.fasta -d EST_Clade_A -e 25]]></description>
			<content:encoded><![CDATA[<p>Create db from fasta file:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">formatdb <span style="color: #660033;">-p</span> F <span style="color: #660033;">-i</span> EST_Clade_A.fasta <span style="color: #660033;">-n</span> EST_Clade_A</pre></div></div>

<p>This will create a 3 files: EST_Clade_A.nhr, EST_Clade_A.nin, EST_Clade_A.nsq. If you omit the -n option, it will create EST_Clade_A.fasta.nhr, EST_Clade_A.fasta.nin, EST_Clade_A.fasta.nsq<br />
Blast example:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">blastall <span style="color: #660033;">-p</span> blastn <span style="color: #660033;">-i</span> EST_Clade_C_1.fasta <span style="color: #660033;">-d</span> EST_Clade_A  <span style="color: #660033;">-e</span> <span style="color: #000000;">25</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://honoluluhacker.com/2009/03/23/blast-notes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

