<?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>Marios Braindump &#187; english</title>
	<atom:link href="http://www.mfasold.net/blog/tag/english/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mfasold.net/blog</link>
	<description>Just shouting my thoughts out</description>
	<lastBuildDate>Fri, 23 Jul 2010 14:21:22 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>The Latticist Package for R</title>
		<link>http://www.mfasold.net/blog/2010/07/the-latticist-package-for-r/</link>
		<comments>http://www.mfasold.net/blog/2010/07/the-latticist-package-for-r/#comments</comments>
		<pubDate>Fri, 23 Jul 2010 14:21:16 +0000</pubDate>
		<dc:creator>Mario</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[R]]></category>
		<category><![CDATA[research]]></category>

		<guid isPermaLink="false">http://www.mfasold.net/blog/?p=435</guid>
		<description><![CDATA[One of my dear readers, C S,  has pointed out to me the R package latticist. In the beginning I was sceptical, since the package is merely more than an interface to existing visualization routines. However, I now consider it astonishingly useful and use it almost every day. The reason is simple: Getting an intial [...]]]></description>
			<content:encoded><![CDATA[<p>One of my dear readers, <a href="http://r-chart.blogspot.com/">C S</a>,  has pointed out to me the R package <a href="http://code.google.com/p/latticist/">latticist</a>. In the beginning I was sceptical, since the package is merely more than an interface to existing visualization routines. However, I now consider it astonishingly useful and use it almost every day. The reason is simple: Getting an intial glimpse onto a large set of multivariate data is tedious in R, due to the command line interface. With latticist, you get an instant overview over all variables of interest and it allows you to quickly dive into details by selecting subgroups and to look at potential correlations. Recommended.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mfasold.net/blog/2010/07/the-latticist-package-for-r/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Project Organization Advice</title>
		<link>http://www.mfasold.net/blog/2010/06/project-organization-advice/</link>
		<comments>http://www.mfasold.net/blog/2010/06/project-organization-advice/#comments</comments>
		<pubDate>Tue, 08 Jun 2010 19:41:14 +0000</pubDate>
		<dc:creator>Mario</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[research]]></category>
		<category><![CDATA[scripting]]></category>

		<guid isPermaLink="false">http://www.mfasold.net/blog/?p=432</guid>
		<description><![CDATA[Have you ever had the problem of re-finding how you created this particular image or that specific result of your recent bioinformatics project? I did, and not only once.  In his article &#8220;A quick guide to organizing computational biology projects&#8220;, the distinguished scientist William S. Noble gives great advice on how to organize a research [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever had the problem of re-finding how you created this particular image or that specific result of your recent bioinformatics project? I did, and not only once.  In his article &#8220;<a href="http://www.ploscompbiol.org/article/info%3Adoi%2F10.1371%2Fjournal.pcbi.1000424">A quick guide to organizing computational biology projects</a>&#8220;, the distinguished scientist William S. Noble gives great advice on how to organize a research project practically. His key suggestions include:</p>
<ul>
<li>use a date-based directory structure for the experiments you perform</li>
<li>keep a lab-notebook containing documentation and code for each experiment (How about Org-mode?)</li>
<li>create generate scripts that work on original data and a general runner script for the complete experiment</li>
</ul>
<p>His work flow is applies mostly to *nix enviroments. One thing I&#8217;d like to add: Use symbolic links! Due to huge amounts of data and backup strategies, it might be impractical to have all the project&#8217;s data in a single directory. Create subdirectories of your data and result directories according to the naming convention and link them to other network drives using the &#8216;ln -s&#8217; command.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mfasold.net/blog/2010/06/project-organization-advice/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python Recipe: Read CSV/TSV Textfiles and Ignore Comment-lines</title>
		<link>http://www.mfasold.net/blog/2010/02/python-recipe-read-csvtsv-textfiles-and-ignore-comment-lines/</link>
		<comments>http://www.mfasold.net/blog/2010/02/python-recipe-read-csvtsv-textfiles-and-ignore-comment-lines/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 15:37:53 +0000</pubDate>
		<dc:creator>Mario</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.mfasold.net/blog/?p=411</guid>
		<description><![CDATA[Scientific data commonly comes in tab-separated textfile format containing comment lines. What is the best way to read this data? Analogous to the recipe given by skip.montanaro, use a commented file decorator as follows:
import sys, re
import csv
class CommentedFile:
    def __init__(self, f, commentstring="#"):
        self.f = f
 [...]]]></description>
			<content:encoded><![CDATA[<p>Scientific data commonly comes in tab-separated textfile format containing comment lines. What is the best way to read this data? Analogous to the recipe given by <a href="http://bugs.python.org/msg48505">skip.montanaro</a>, use a commented file decorator as follows:</p>
<blockquote><pre>import sys, re
import csv
class CommentedFile:
    def __init__(self, f, commentstring="#"):
        self.f = f
        self.commentstring = commentstring
    def next(self):
        line = self.f.next()
        while line.startswith(self.commentstring):
            line = self.f.next()
        return line
    def __iter__(self):
        return self

tsv_file = csv.reader(CommentedFile(open("inputfile.txt", "rb")),
                      delimiter='\t')
for row in tsv_file:
    print row[2] # prints column 3 of each line</pre>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.mfasold.net/blog/2010/02/python-recipe-read-csvtsv-textfiles-and-ignore-comment-lines/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>A Reload-Button in Adobe Acrobat</title>
		<link>http://www.mfasold.net/blog/2009/12/a-reload-button-in-adobe-acrobat/</link>
		<comments>http://www.mfasold.net/blog/2009/12/a-reload-button-in-adobe-acrobat/#comments</comments>
		<pubDate>Mon, 21 Dec 2009 13:08:27 +0000</pubDate>
		<dc:creator>Mario</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[tech]]></category>

		<guid isPermaLink="false">http://www.mfasold.net/blog/?p=408</guid>
		<description><![CDATA[Read this post about how to reload your pdf document. This is particularly useful when you are creating a new document with LaTeX. Sweet, I was waiting for that functionality.
]]></description>
			<content:encoded><![CDATA[<p>Read <a href="http://www.nonperiodic.net/blog/2009/04/02/reloading-a-file-in-adobe-reader/">this post</a> about how to reload your pdf document. This is particularly useful when you are creating a new document with LaTeX. Sweet, I was waiting for that functionality.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mfasold.net/blog/2009/12/a-reload-button-in-adobe-acrobat/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Use the new Emacs Daemon!</title>
		<link>http://www.mfasold.net/blog/2009/11/use-the-new-emacs-daemon/</link>
		<comments>http://www.mfasold.net/blog/2009/11/use-the-new-emacs-daemon/#comments</comments>
		<pubDate>Fri, 20 Nov 2009 15:33:22 +0000</pubDate>
		<dc:creator>Mario</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[tech]]></category>

		<guid isPermaLink="false">http://www.mfasold.net/blog/?p=400</guid>
		<description><![CDATA[Emacs usually takes quite some time to fully start up. However, as described in the great blog Emacs-Fu, Emacs 23 can now be started in the background as a daemon. This allows to fire up a new Emacs instance really fast. Thanks djcb!
]]></description>
			<content:encoded><![CDATA[<p>Emacs usually takes quite some time to fully start up. However, as <a href="http://emacs-fu.blogspot.com/2008/12/welcome-to-emacs-fu.html">described</a> in the great blog Emacs-Fu, Emacs 23 can now be started in the background as a daemon. This allows to fire up a new Emacs instance really fast. Thanks djcb!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mfasold.net/blog/2009/11/use-the-new-emacs-daemon/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Print Particular Lines of a File Using SED</title>
		<link>http://www.mfasold.net/blog/2009/10/print-particular-lines-of-a-file-using-sed/</link>
		<comments>http://www.mfasold.net/blog/2009/10/print-particular-lines-of-a-file-using-sed/#comments</comments>
		<pubDate>Sat, 31 Oct 2009 17:32:56 +0000</pubDate>
		<dc:creator>Mario</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[commandline]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[tech]]></category>

		<guid isPermaLink="false">http://www.mfasold.net/blog/?p=394</guid>
		<description><![CDATA[Say you want to print the lines 3 and 7, and all lines from 11 to 15 of a text-file. The following SED one-liner will do for you
sed -n -e '3p' -e '5p' -e '11,15p' textfile.txt
]]></description>
			<content:encoded><![CDATA[<p>Say you want to print the lines 3 and 7, and all lines from 11 to 15 of a text-file. The following SED one-liner will do for you</p>
<blockquote><p><code>sed -n -e '3p' -e '5p' -e '11,15p' textfile.txt</code></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.mfasold.net/blog/2009/10/print-particular-lines-of-a-file-using-sed/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Anycom Bluetooth USB Adapter on Windows 7</title>
		<link>http://www.mfasold.net/blog/2009/10/anycom-bluetooth-usb-adapter-on-windows-7/</link>
		<comments>http://www.mfasold.net/blog/2009/10/anycom-bluetooth-usb-adapter-on-windows-7/#comments</comments>
		<pubDate>Tue, 06 Oct 2009 19:50:17 +0000</pubDate>
		<dc:creator>Mario</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.mfasold.net/blog/?p=381</guid>
		<description><![CDATA[For the first time I could personally sense the effects of the economic crisis. The manufacturer of my Bluetooth device ANYCOM USB-200, the Germany-based ITM Technology AG is insolvent. Immediate effect for customers like me: No more driver updates and their general unavailability on the homepage.
Here is the good news for everybody who wants to [...]]]></description>
			<content:encoded><![CDATA[<p>For the first time I could personally sense the effects of the economic crisis. The manufacturer of my Bluetooth device ANYCOM USB-200, the Germany-based ITM Technology AG is insolvent. Immediate effect for customers like me: No more driver updates and their general unavailability on the homepage.</p>
<p>Here is the good news for everybody who wants to use an ANYCOM Bluetooth USB adapter (200, 250, 500) on Windows 7. The Vista driver runs just fine under Windows 7. And I got the driver (	&#8220;anycom-bluetooth-usb200-250-500-vista-v6-1-0-4700.exe&#8221;). If anybody needs it, feel free to send me an email (see <a href="http://www.mfasold.net/blog/about/">About</a>). It may be worth noting that Windows 7 complains about not being able to correctly install Bluetooth devices like a headset (Plantronics Voyager 510 for me), while in fact you you only need the correct driver for the adapter.</p>
<p><em>Update: After brisk demand I decided to allow you to <a href="http://www.mfasold.net/anycom-bluetooth-usb200-250-500-vista-v6-1-0-4700.exe">download the driver</a> directly from this website. Of course, no warranty whatsoever provided.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mfasold.net/blog/2009/10/anycom-bluetooth-usb-adapter-on-windows-7/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Working with a List of Tuples in Shell Scripting</title>
		<link>http://www.mfasold.net/blog/2009/10/working-with-a-list-of-tuples-in-shell-scripting/</link>
		<comments>http://www.mfasold.net/blog/2009/10/working-with-a-list-of-tuples-in-shell-scripting/#comments</comments>
		<pubDate>Fri, 02 Oct 2009 13:08:17 +0000</pubDate>
		<dc:creator>Mario</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[commandline]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[tech]]></category>

		<guid isPermaLink="false">http://www.mfasold.net/blog/?p=367</guid>
		<description><![CDATA[Several people have recently asked me whether or not it is possible to use tuples in their shell script. One example is running a program with a varying set of parameters. Since they often did not find a good solution, they began to formulate their problem in a higher-level scripting language like Ruby. Surprisingly, you [...]]]></description>
			<content:encoded><![CDATA[<p>Several people have recently asked me whether or not it is possible to use tuples in their shell script. One example is running a program with a varying set of parameters. Since they often did not find a good solution, they began to formulate their problem in a higher-level scripting language like Ruby. Surprisingly, you can accomplish the same task easily with simple shell scripting (supported by bash, zsh,..). Consider the following (semi-stupid) example</p>
<blockquote><p><code>#!/bin/bash<br />
paramset="foo.txt 1 --with-graphics<br />
bar.txt 8 --no-graphics<br />
flock.txt 4 --with-graphics"</code></p>
<p><code>echo "$du" | while read file p1 p2 ; do<br />
     ./myProgram $file -t $p1 --verbose $p2<br />
done</code></p></blockquote>
<p>We here run the program <code>myProgram</code> three times (for each line in the multi-line string). Every line contains three white-space separated values (words), to which we assign the variable names <code>file, p1, p2</code> in the loop header. Note that the last variable (in this case <code>p2</code>) always contains all remaining words of a given line if there are more words then variables.</p>
<p>The set of parameters can also be stored in a file. In that case, replace the loop header with <code>cat params.txt  | while read file p1 p2 ; do</code>. If the script is not working properly, examine the Input-Field-Separator (IFS) variable, which should be set to <code>IFS=" "</code>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mfasold.net/blog/2009/10/working-with-a-list-of-tuples-in-shell-scripting/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Inline Figures in Org-Mode Paper Drafts</title>
		<link>http://www.mfasold.net/blog/2009/07/inline-figures-in-org-mode-paper-drafts/</link>
		<comments>http://www.mfasold.net/blog/2009/07/inline-figures-in-org-mode-paper-drafts/#comments</comments>
		<pubDate>Wed, 08 Jul 2009 13:46:43 +0000</pubDate>
		<dc:creator>Mario</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[R]]></category>
		<category><![CDATA[science]]></category>

		<guid isPermaLink="false">http://www.mfasold.net/blog/?p=315</guid>
		<description><![CDATA[Writing a paper often comes along with a problem known as information fragmentation: figures, tables and the respective data sources related to the paper certainly are somewhere on your hard disk &#8211; but where? How did I name the file with the data-points again? And, the heck, which commands did I use to create that [...]]]></description>
			<content:encoded><![CDATA[<p>Writing a paper often comes along with a problem known as information fragmentation: figures, tables and the respective data sources related to the paper certainly are somewhere on your hard disk &#8211; but where? How did I name the file with the data-points again? And, the heck, which commands did I use to create that fancy plot? But chill, there is a way to avoid the joyless seeking and re-finding. At least if you <a href="http://www.mfasold.net/blog/2009/02/using-emacs-org-mode-to-draft-papers/">draft your papers in org-mode</a>, as I described in a recent post.</p>
<p><span id="more-315"></span>The key tool here is the wonderful org-mode extension Org-R by Dan Davison. It allows to include code fragments that create figures or tables directly into your document. That way, everything will be in one place.  Searching, au revoir.</p>
<p><strong>Introduction to Org-R</strong></p>
<p>Luckily, Dan wrote a <a href="http://orgmode.org/worg/org-tutorials/org-R/org-R.php">comprehensive tutorial</a> on how to use org-R. If your planning to give it a try, I suggest to look over his words first. However, he forgot to mention two things you&#8217;ll need to enable the org-R goodness. Insert</p>
<blockquote><p>(add-to-list &#8216;load-path &#8220;~/site-lisp/org-mode/contrib/lisp&#8221;)<br />
(require &#8216;org-R)</p></blockquote>
<p>into your .emacs and edit the directory to point into your org-mode directory. Also, you need to have a R instance running (invoke <code>M-x R</code>) in the directory of your document. Try some of the examples given in his tutorial in a new .org document now.</p>
<p>What happens behind the scenes here is that org-R translates the inline commands into a R command sequence. For example, <code>infile:x.csv</code> is converted into <code>x = read.table(...)</code> . The <code>+RR</code> prefix introduces direct R commands, which are executed before the <code>+R</code> commands (except infile:). The result is then inserted as a table or as a link to a graphic. Note that many actions rely on conventions:  <code>outfile:x.png</code> will create a png image. Reading from a datafile will only work if the file suffix is .csv. And its contents will always be stored in a variable x. If you are not sure what is happening behind the scenes, the command <code>showcode:t</code> shows you the created R-code and is hence a great tool for debugging.</p>
<p><strong>Using figures</strong></p>
<p>A typical fragment for creating a figure that is also exported into LaTeX/PDF/HTML properly is</p>
<blockquote><p>#+CAPTION: Distribution of foot sizes among coputer scientists<br />
#+LABEL: fig:SizeDistribution<br />
#+ATTR_LaTeX: scale=0.5<br />
[[file:images/distanceDist.png]]<br />
#+R: infile:&#8221;tmp.csv&#8221; #+R: action:density columns:1 args:(:lwd 4)<br />
#+R: outfile:&#8221;images/distanceDist.png&#8221;<br />
#+R: inline:t</p></blockquote>
<p>The first three lines give the image a caption and a reference, and define the size of the image in the paper. Invoking C-c (or <code>org-apply</code>) in the second part will (re-)create the image. The command <code>#+R: inline:t</code> is required for the resulting link to the image having the same format as the LaTeX exporter recognizes for figures.</p>
<p><strong>Keeping your document clean</strong></p>
<p>The main intend of org-R obviously was to enable org-mode users to perform quick calculations and create simple graphs from data that originates from org-tables. Undeniable, org-r is very good at that. However, our objective shall rather be to centralize and de-fragment drafting of papers containing complex figures. When it comes to more elaborate graphs and datasets, the usefulness of  the predefined actions vanishes and longer, more complex R code is required. You might rather want to work in ESS/R-mode, where you have all the coloring and intendation niceness, and you do not have to precede every line with an +RR:.</p>
<p>The alternative is to source the functions from a separate .R file, for example you could use</p>
<blockquote><p>#+CAPTION: Distribution of finger lengths among computer scientists<br />
#+ATTR_LaTeX: scale=0.5<br />
#+LABEL: fig:LengthDistribution<br />
[[file:images/distanceDist.png]]<br />
#+R: infile:&#8221;tmp.csv&#8221;<br />
#+RR: source(&#8221;rcode.R&#8221;)<br />
#+RR: myDensity(x)<br />
#+R: outfile:&#8221;images/distanceDist.png&#8221;<br />
#+R: inline:t</p></blockquote>
<p>with the following code (imagine a longer fragment) in rcode.R</p>
<blockquote><p>myDensity &lt;- function(x) {  <br />
    plot(density(x[,1]), col=&#8221;chartreuse4&#8243;, lwd=5, xlim=c(0,2000))<br />
}</p></blockquote>
<p>That way, you avoid immense R code pollution in your draft, yet you have all the information (data-files, linked code and parameters) in one place. Happy drafting!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mfasold.net/blog/2009/07/inline-figures-in-org-mode-paper-drafts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>List Only Subdirectories for Shell Scripting</title>
		<link>http://www.mfasold.net/blog/2009/06/list-only-subdirectories-for-shell-scripting/</link>
		<comments>http://www.mfasold.net/blog/2009/06/list-only-subdirectories-for-shell-scripting/#comments</comments>
		<pubDate>Sun, 07 Jun 2009 12:15:39 +0000</pubDate>
		<dc:creator>Mario</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[commandline]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.mfasold.net/blog/?p=313</guid>
		<description><![CDATA[I like to have the following snippet in my .zshrc (or .bashrc) for convenience
alias lsd="ls -l&#124;awk '/^d/ {print \$9}'"
It displays all subdirectories underneath the current directory. The goodness in this variant is that it gives you the pure names and that you can use it in loops without hassle :
for d in `lsd`; do
mv $d/resultfile.dat [...]]]></description>
			<content:encoded><![CDATA[<p>I like to have the following snippet in my .zshrc (or .bashrc) for convenience</p>
<blockquote><p><code>alias lsd="ls -l|awk '/^d/ {print \$9}'"</code></p></blockquote>
<p>It displays all subdirectories underneath the current directory. The goodness in this variant is that it gives you the pure names and that you can use it in loops without hassle :</p>
<blockquote><p><code>for d in `lsd`; do<br />
mv $d/resultfile.dat $d_result.dat;<br />
rmdir $d;<br />
done</code></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.mfasold.net/blog/2009/06/list-only-subdirectories-for-shell-scripting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
