<?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>Codec &#187; perl</title>
	<atom:link href="http://www.trembl.org/codec/tag/perl/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.trembl.org/codec</link>
	<description>A Personal Polylogic Code/Decode &#039;Zettelkasten&#039;</description>
	<lastBuildDate>Thu, 02 Feb 2012 03:38:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Circos comes to OSX-town!</title>
		<link>http://www.trembl.org/codec/810/</link>
		<comments>http://www.trembl.org/codec/810/#comments</comments>
		<pubDate>Tue, 22 Nov 2011 03:33:19 +0000</pubDate>
		<dc:creator>Georg Tremmel</dc:creator>
				<category><![CDATA[Raw]]></category>
		<category><![CDATA[circos]]></category>
		<category><![CDATA[installation]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[tool]]></category>
		<category><![CDATA[visualization]]></category>

		<guid isPermaLink="false">http://www.trembl.org/codec/?p=810</guid>
		<description><![CDATA[Circos, the Perl-package for visualizing data and information in a circular layout is an immensely popular application in the bio-informatics/bio-visualization community. And rightly so, as it able to produce visually stunning and appealing graphics. Because its the native environment is bio-informaticians, the software is written in Perl. For those without Perl experience, it can be [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://circos.ca/">Circos</a>, the Perl-package for visualizing data and information in a circular layout is an immensely popular application in the bio-informatics/bio-visualization community. And rightly so, as it able to produce visually stunning and appealing graphics.</p>
<p>Because its the native environment is bio-informaticians, the software is written in Perl. For those without Perl experience, it can be slightly frustrating to set it up on OSX (as it was for me). Here are the steps I needed to do to get it running, hope that this might reduce the trouble and let others get to work on their visualization more quickly.</p>
<p>The whole installation process is also detailed on the <a href="http://circos.ca/software/installation/">Installation</a> page.</p>
<p><strong>1 Getting Circos</strong><br />
Download the <a href="http://circos.ca/software/download/">software, tutorials, tools and courses</a></p>
<p><strong>2 Testing the modules</strong><br />
Go the the circosX-XX/bin folder and run: ./test.modules<br />
This gives you a list of the installed Perl modules, and &#8211; more importantly &#8211; the ones still missing.</p>
<p><strong>3 Install the missing modules</strong><br />
Switch to the super user with &#8216;su&#8217;.<br />
For each missing modules say: cpan -i Modulename::Subname</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">cpan -i Config::General
cpan -i Graphics::ColorObject
cpan -i Math::VecStat
etc, etc</pre></div></div>

<p>All worked swimmingly, except GD was making a bit of trouble.</p>
<p><strong>4 Installing GD</strong><br />
The graphics library GD has to be present on your system. If it&#8217;s not, install it. (I am with <a href="http://mxcl.github.com/homebrew/">homebrew</a>, therefore installing GD is done like that: <em>brew install gd</em>)</p>
<p>Still after installing GD, installing the Perl module would not work. But after applying a little force, it went fine:</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">cpan -i -f GD</pre></div></div>

<p><strong>5 Adding circos to your path</strong><br />
Adding the circos &#8216;bin&#8217; directory to your path lets you call the circos program directly without specifying the whole path. That&#8217;s a good thing.</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">PATH=&quot;/path/to/circos-0.55/bin:${PATH}&quot;
export PATH</pre></div></div>

<p>After that, everything should work and your Circos adventure can begin&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.trembl.org/codec/810/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Combining stderr and stdout 2&gt;&amp;1</title>
		<link>http://www.trembl.org/codec/791/</link>
		<comments>http://www.trembl.org/codec/791/#comments</comments>
		<pubDate>Mon, 08 Aug 2011 07:29:07 +0000</pubDate>
		<dc:creator>Georg Tremmel</dc:creator>
				<category><![CDATA[Raw]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[redirect]]></category>
		<category><![CDATA[stderr]]></category>
		<category><![CDATA[stdout]]></category>

		<guid isPermaLink="false">http://www.trembl.org/codec/?p=791</guid>
		<description><![CDATA[If you ever find yourself in a situation of having to call a perl script from within PHP, and you want to get the return values from the perl script, you might do it like the following: $command = &#34;perl /my/perl/script.pl&#34;; $results = exec&#40;$command&#41;; // does not print error If the perl script generates error, [...]]]></description>
			<content:encoded><![CDATA[<p>If you ever find yourself in a situation of having to call a perl script from within PHP, and you want to get the return values from the perl script, you might do it like the following:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$command</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;perl /my/perl/script.pl&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$results</span> <span style="color: #339933;">=</span> <span style="color: #990000;">exec</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$command</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// does not print error</span></pre></div></div>

<p>If the perl script generates error, you won&#8217;t be able to see them, as they are written to stderr.</p>
<p>One solution might be to append the stderr to stdout, therefore getting it into the $results variable.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$command</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;perl /my/perl/script.pl 2&gt;&amp;1&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$results</span> <span style="color: #339933;">=</span> <span style="color: #990000;">exec</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$command</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// Prints: Died at /my/perl/script.pl line 25.</span></pre></div></div>

<p>As <a href="http://stackoverflow.com/questions/818255/in-the-bash-shell-what-is-21">this post</a> explains, 1 means stdout, 2 means stderr. 2>1 might look ok at first sight, but the &#8217;1&#8242; will be interpreted as a filename. Therefore it has to be escaped with &#038;1, resulting in 2>&#038;1.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.trembl.org/codec/791/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

