<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
<title type="text">Calgorithms</title>
<subtitle type="text"></subtitle>
<generator uri="https://github.com/mojombo/jekyll">Jekyll</generator>
<link rel="self" type="application/atom+xml" href="/feed.xml" />
<link rel="alternate" type="text/html" href="" />
<updated>2015-04-14T21:22:17-04:00</updated>
<id>/</id>
<author>
  <name>Keith Callenberg</name>
  <uri>/</uri>
  <email>keithcallenberg@gmail.com</email>
</author>


<entry>
  <title type="html"><![CDATA[Fixing multiple monitor position in Ubuntu Gnome 14.04]]></title>
  <link rel="alternate" type="text/html" href="/blog/2014/07/30/fixing-multiple-monitor-position-in-ubuntu-gnome-14-dot-04/" />
  <id>/blog/2014/07/30/fixing-multiple-monitor-position-in-ubuntu-gnome-14-dot-04</id>
  <published>2014-07-30T00:00:00-04:00</published>
  <updated>2014-07-30T00:00:00-04:00</updated>
  <author>
    <name>Keith Callenberg</name>
    <uri></uri>
    <email>keithcallenberg@gmail.com</email>
  </author>
  <content type="html">&lt;p&gt;Upon switching to Gnome 3/Shell I found that my two monitor positions were not persisting after reboot, or even after suspending. N. Bernaerts wrote &lt;a href=&quot;http://bernaerts.dyndns.org/linux/74-ubuntu/309-ubuntu-dual-display-monitor-position-lost&quot;&gt;an excellent post&lt;/a&gt; on how to fix this, complete with a dynamic script that fixes your monitor positions based on your monitors.xml. I have made a minor extension to this script that also handles correcting the primary monitor flag. For me, the display manager was not only reversing the left/right positions of the monitors, but was also setting the wrong one to be primary. Here are instructions, summarized from &lt;a href=&quot;http://bernaerts.dyndns.org/linux/74-ubuntu/309-ubuntu-dual-display-monitor-position-lost&quot;&gt;N. Bernaerts’ site&lt;/a&gt; for fixing these issues.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;Setup a clean configuration, as you want it by deleting your old &lt;code&gt;monitors.xml&lt;/code&gt; file and starting fresh with a new one, created using the Gnome display settings tool.&lt;/p&gt;

    &lt;p&gt;&lt;code&gt;
 rm ~/.config/monitors.xml  
 gnome-control-center
&lt;/code&gt;&lt;/p&gt;

    &lt;p&gt;Now go to Displays, and change the positions to how you would like them.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Open &lt;code&gt;~/.config/monitors.xml&lt;/code&gt; in an editor and make sure the display you want to be primary has a “yes” for the primary flag.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Install the &lt;code&gt;libxml2-utils&lt;/code&gt; package if not already installed.&lt;/p&gt;

    &lt;p&gt;&lt;code&gt;
 sudo apt-get install libxml2-utils
&lt;/code&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Copy and paste the below script (or download it using wget) to a directory on your path and make it executable.&lt;/p&gt;

    &lt;p&gt;&lt;code&gt;
 sudo wget -O /usr/local/sbin/update-monitor-position /assets/files/update-monitor-position
 chmod +x /usr/local/sbin/update-monitor-position
&lt;/code&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Use the &lt;code&gt;System - Startup Applications tool&lt;/code&gt; to add &lt;code&gt;update-monitor-position&lt;/code&gt; so that it runs when you login.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Reboot your machine and now your configuration should persist!&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;&lt;span class=&quot;c&quot;&gt;#!/bin/bash&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# -------------------------------------------------&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;#  Get monitors configuration from monitor.xml and apply it for current user session.&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;#  In case of multiple definitions in monitor.xml only first one is used.&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;#&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;#  See http://bernaerts.dyndns.org/linux/74-ubuntu/309-ubuntu-dual-display-monitor-position-lost&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;#  for instructions&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;#&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;#  Revision history :&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;#    19/04/2014, V1.0 - Creation by N. Bernaerts&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;#    10/07/2014, V1.1 - Wait 5 seconds for X to fully initialize&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;#    30/07/2014, V1.2 - K. Callenberg added handling of primary monitor setting&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# -------------------------------------------------&lt;/span&gt;


&lt;span class=&quot;c&quot;&gt;# get number of declared monitors&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;NUM&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;$(&lt;/span&gt;xmllint --xpath &lt;span class=&quot;s1&quot;&gt;&amp;#39;count(//monitors/configuration[&amp;#39;&lt;/span&gt;1&lt;span class=&quot;s1&quot;&gt;&amp;#39;]/output)&amp;#39;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$HOME&lt;/span&gt;/.config/monitors.xml&lt;span class=&quot;k&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# loop thru declared monitors to create the command line parameters&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;((&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;1&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; i&amp;lt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$NUM&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; i++&lt;span class=&quot;o&quot;&gt;))&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
  &lt;span class=&quot;c&quot;&gt;# get attributes of current monitor (name and x &amp;amp; y positions)&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;NAME&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;$(&lt;/span&gt;xmllint --xpath &lt;span class=&quot;s1&quot;&gt;&amp;#39;string(//monitors/configuration[&amp;#39;&lt;/span&gt;1&lt;span class=&quot;s1&quot;&gt;&amp;#39;]/output[&amp;#39;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$i&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;]/@name)&amp;#39;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$HOME&lt;/span&gt;/.config/monitors.xml 2&amp;gt;NULL&lt;span class=&quot;k&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;POS_X&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;$(&lt;/span&gt;xmllint --xpath &lt;span class=&quot;s1&quot;&gt;&amp;#39;//monitors/configuration[&amp;#39;&lt;/span&gt;1&lt;span class=&quot;s1&quot;&gt;&amp;#39;]/output[&amp;#39;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$i&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;]/x/text()&amp;#39;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$HOME&lt;/span&gt;/.config/monitors.xml 2&amp;gt;NULL&lt;span class=&quot;k&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;POS_Y&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;$(&lt;/span&gt;xmllint --xpath &lt;span class=&quot;s1&quot;&gt;&amp;#39;//monitors/configuration[&amp;#39;&lt;/span&gt;1&lt;span class=&quot;s1&quot;&gt;&amp;#39;]/output[&amp;#39;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$i&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;]/y/text()&amp;#39;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$HOME&lt;/span&gt;/.config/monitors.xml 2&amp;gt;NULL&lt;span class=&quot;k&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;PRIMARY&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;$(&lt;/span&gt;xmllint --xpath &lt;span class=&quot;s1&quot;&gt;&amp;#39;//monitors/configuration[&amp;#39;&lt;/span&gt;1&lt;span class=&quot;s1&quot;&gt;&amp;#39;]/output[&amp;#39;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$i&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;]/primary/text()&amp;#39;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$HOME&lt;/span&gt;/.config/monitors.xml 2&amp;gt;NULL&lt;span class=&quot;k&quot;&gt;)&lt;/span&gt;

  &lt;span class=&quot;c&quot;&gt;# if position is defined for current monitor, add its position to command line parameters&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;$PRIMARY&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;yes&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
      &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; -n &lt;span class=&quot;s2&quot;&gt;&amp;quot;$POS_X&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;PARAM_ARR&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;${PARAM_ARR[@]}&amp;quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;--output&amp;quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;$NAME&amp;quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;--primary&amp;quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;--pos&amp;quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;${POS_X}x${POS_Y}&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;
      &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; -n &lt;span class=&quot;s2&quot;&gt;&amp;quot;$POS_X&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;PARAM_ARR&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;${PARAM_ARR[@]}&amp;quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;--output&amp;quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;$NAME&amp;quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;--pos&amp;quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;${POS_X}x${POS_Y}&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;fi&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;done&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# wait for 5 seconds (for X to finish initialisation)&lt;/span&gt;
sleep 5

&lt;span class=&quot;c&quot;&gt;#echo &amp;quot;${PARAM_ARR[@]}&amp;quot;&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# position all monitors&lt;/span&gt;
xrandr &lt;span class=&quot;s2&quot;&gt;&amp;quot;${PARAM_ARR[@]}&amp;quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


  &lt;p&gt;&lt;a href=&quot;/blog/2014/07/30/fixing-multiple-monitor-position-in-ubuntu-gnome-14-dot-04/&quot;&gt;Fixing multiple monitor position in Ubuntu Gnome 14.04&lt;/a&gt; was originally published by Keith Callenberg at &lt;a href=&quot;&quot;&gt;Calgorithms&lt;/a&gt; on July 30, 2014.&lt;/p&gt;</content>
</entry>


<entry>
  <title type="html"><![CDATA[Producing high resolution animations of high-dimensional data with tourr]]></title>
  <link rel="alternate" type="text/html" href="/blog/2014/07/11/producing-animations-of-high-dimensional-data-with-tourr/" />
  <id>/blog/2014/07/11/producing-animations-of-high-dimensional-data-with-tourr</id>
  <published>2014-07-11T00:00:00-04:00</published>
  <updated>2014-07-11T00:00:00-04:00</updated>
  <author>
    <name>Keith Callenberg</name>
    <uri></uri>
    <email>keithcallenberg@gmail.com</email>
  </author>
  <content type="html">&lt;h2 id=&quot;introduction&quot;&gt;Introduction&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;http://www.ggobi.org/&quot;&gt;GGobi&lt;/a&gt; and its R wrapper package (&lt;a href=&quot;http://cran.r-project.org/web/packages/rggobi/index.html&quot;&gt;RGgobi&lt;/a&gt;) are excellent for exploratory data analysis. One difficulty, however, is showing other people what you’ve found with these tools. To be fair, the focus of the tool is probably more individual – showing a single user where interesting patterns and correlations might lie – so that the user can then evaluate the truth of those patterns with a more quantitative method. I imagine the GGobi developers still see other quantitative methods or simpler graphs as the principal means of communicating to others what you’ve discovered in GGobi. &lt;/p&gt;

&lt;p&gt;That said, the graphics GGobi produces are very attractive and impressive. It could be very useful to be able to publish and distribute them to others. If you search for GGobi videos, you will find many screen captures. These are very straight-forward to make, but they suffer from framerate and resolution limitations. They also suffer from reproducibility; it would be impossible to reconstruct the same tour paths over again if you only wanted to make a simple change to the colors, for instance. Screen captures also take some work – cropping for only the window of interest, trimming the resulting video to remove breaks when you had to adjust the parameters – to get looking professional. For these reasons, I recommend another direction: using the R-based &lt;a href=&quot;http://cran.r-project.org/web/packages/tourr/index.html&quot;&gt;tourr package&lt;/a&gt; to produce paths that can be rendered into an image sequence and subsequently encoded into a video. &lt;/p&gt;

&lt;h2 id=&quot;procedure&quot;&gt;Procedure&lt;/h2&gt;
&lt;ol&gt;
  &lt;li&gt;Use &lt;a href=&quot;http://www.inside-r.org/packages/cran/tourr/docs/save_history&quot;&gt;savehistory()&lt;/a&gt; to build each subpath.&lt;/li&gt;
  &lt;li&gt;If necessary, you can manually add or modify subpaths, but remember to run the subpath through orthonormalise() or orthonormalise_by() afterward so that you can be sure to provide valid input. &lt;/li&gt;
  &lt;li&gt;Combine all subpaths with the &lt;a href=&quot;http://cran.r-project.org/web/packages/abind/index.html&quot;&gt;abind package&lt;/a&gt;. abind(), as opposed to rbind and cbind, concatenates 3-dimensional matrices.&lt;/li&gt;
  &lt;li&gt;Add attributes such as $data and the object’s $class to the new combined path object from one of the subpaths.&lt;/li&gt;
  &lt;li&gt;Render the entire path into a sequence of PNG files.&lt;/li&gt;
  &lt;li&gt;Encode the PNG sequence into a video with a tool like avconv.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;modifications-for-aesthetics&quot;&gt;Modifications for aesthetics&lt;/h2&gt;
&lt;p&gt;I needed to hack into the tourr package in order to achieve the aesthetics I had in mind. In display_xy() I added a new axes representation similar to the “center” option called “highlight”. This option removes the line segments, makes the axes labels unabbreviated and their font larger, and additionally sets the opacity and size of the text based on distance from the origin. The size/opacity adjustment really cleans up the video, making it feel less cluttered. In retrospect it would probably have been cleaner to just implement a new display function for these changes, which I plan to do next.&lt;/p&gt;

&lt;h2 id=&quot;example&quot;&gt;Example&lt;/h2&gt;
&lt;p&gt;Here is an example animation based on roughly 68,000 training data points from the &lt;a href=&quot;https://www.kaggle.com/c/higgs-boson/data&quot;&gt;Higgs Boson Machine Learning challenge&lt;/a&gt;. I selected just the primary/raw/non-derived features and colored each entry by the training label (&lt;span style=&quot;color:#EA0102&quot;&gt;signal&lt;/span&gt; or noise). For this animation I combined 5 tourr paths: &lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;A little tour to start with simple 1x1 comparisons&lt;/li&gt;
  &lt;li&gt;Random grand tour to give a sense of the number of dimensions&lt;/li&gt;
  &lt;li&gt;Guided tour based on the LDA pursuit projection index, started from the default projection&lt;/li&gt;
  &lt;li&gt;Guided tour based on the LDA pursuit projection index, restarted from a random projection&lt;/li&gt;
  &lt;li&gt;Guided tour based on the LDA pursuit projection index, restarted from a random projection&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here is the R code:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;r&quot;&gt;library&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;tourr&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
library&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;abind&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;#load training data from Higgs ML competition&lt;/span&gt;
higgs &lt;span class=&quot;o&quot;&gt;&amp;lt;-&lt;/span&gt; read.csv&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;training.csv&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
higgs&lt;span class=&quot;o&quot;&gt;$&lt;/span&gt;color &lt;span class=&quot;o&quot;&gt;&amp;lt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;#000000AA&amp;quot;&lt;/span&gt;
higgs&lt;span class=&quot;o&quot;&gt;$&lt;/span&gt;color&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;higgs&lt;span class=&quot;o&quot;&gt;$&lt;/span&gt;Label &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;#39;s&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;#EA0102AA&amp;quot;&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;#simply remove cases with any missing data&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;#  NB: this is a boring way to handle missing data,&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;#  much better to use some sort of imputation,&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;#  but this is just for demonstration&lt;/span&gt;
higgs&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;higgs&lt;span class=&quot;o&quot;&gt;==&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;-999&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;-&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;NA&lt;/span&gt;
higgs &lt;span class=&quot;o&quot;&gt;&amp;lt;-&lt;/span&gt; higgs&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;complete.cases&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;higgs&lt;span class=&quot;p&quot;&gt;),]&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;#set random seed so that we can reproduce the same video later&lt;/span&gt;
set.seed&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;#construct the tourr paths&lt;/span&gt;
p1 &lt;span class=&quot;o&quot;&gt;&amp;lt;-&lt;/span&gt; save_history&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;data&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;higgs&lt;span class=&quot;p&quot;&gt;[,&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;15&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;31&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; tour_path&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;little_tour&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; max_bases &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
p2 &lt;span class=&quot;o&quot;&gt;&amp;lt;-&lt;/span&gt; save_history&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;data&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;higgs&lt;span class=&quot;p&quot;&gt;[,&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;15&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;31&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; tour_path&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;grand_tour&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; max_bases &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; 
p3 &lt;span class=&quot;o&quot;&gt;&amp;lt;-&lt;/span&gt; save_history&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;data&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;higgs&lt;span class=&quot;p&quot;&gt;[,&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;15&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;31&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; tour_path&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;guided_tour&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;lda_pp&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;higgs&lt;span class=&quot;o&quot;&gt;$&lt;/span&gt;Label&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;max.tries&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt; 
p4 &lt;span class=&quot;o&quot;&gt;&amp;lt;-&lt;/span&gt; save_history&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;data&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;higgs&lt;span class=&quot;p&quot;&gt;[,&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;15&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;31&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; start&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;basis_random&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;17&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; tour_path&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;guided_tour&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;lda_pp&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;higgs&lt;span class=&quot;o&quot;&gt;$&lt;/span&gt;Label&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;max.tries&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt; 
p5 &lt;span class=&quot;o&quot;&gt;&amp;lt;-&lt;/span&gt; save_history&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;data&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;higgs&lt;span class=&quot;p&quot;&gt;[,&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;15&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;31&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; start&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;basis_random&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;17&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; tour_path&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;guided_tour&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;lda_pp&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;higgs&lt;span class=&quot;o&quot;&gt;$&lt;/span&gt;Label&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;max.tries&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt; 

&lt;span class=&quot;c1&quot;&gt;#join the separate paths into a single 3D array with abind&lt;/span&gt;
combined.path &lt;span class=&quot;o&quot;&gt;&amp;lt;-&lt;/span&gt; abind&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;p1&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;p2&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;p3&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;p4&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;p5&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;#add the attributes from the first path (or any of them) to the &lt;/span&gt;
attributes&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;combined.path&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;$&lt;/span&gt;data &lt;span class=&quot;o&quot;&gt;&amp;lt;-&lt;/span&gt; attributes&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;p1&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;$&lt;/span&gt;data
attributes&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;combined.path&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;$&lt;/span&gt;class &lt;span class=&quot;o&quot;&gt;&amp;lt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;history_array&amp;quot;&lt;/span&gt;
render&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;higgs&lt;span class=&quot;p&quot;&gt;[,&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;15&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;31&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; planned_tour&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;combined.path&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; display_xy&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;pch&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;21&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;col&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;higgs&lt;span class=&quot;o&quot;&gt;$&lt;/span&gt;color&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;axes&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;highlight&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;full.labels&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;k-Variable&quot;&gt;T&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;png&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;higgs-%04d.png&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; width&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;720&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; height&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;480&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; apf&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;35&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; frames&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;4000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;And here is the resulting video:&lt;/p&gt;

&lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;//www.youtube-nocookie.com/embed/FgKU1gEZHqg?rel=0&quot; frameborder=&quot;0&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;

  &lt;p&gt;&lt;a href=&quot;/blog/2014/07/11/producing-animations-of-high-dimensional-data-with-tourr/&quot;&gt;Producing high resolution animations of high-dimensional data with tourr&lt;/a&gt; was originally published by Keith Callenberg at &lt;a href=&quot;&quot;&gt;Calgorithms&lt;/a&gt; on July 11, 2014.&lt;/p&gt;</content>
</entry>


<entry>
  <title type="html"><![CDATA[Global weather comparisons]]></title>
  <link rel="alternate" type="text/html" href="/blog/project/2014/07/07/global-weather-comparisons/" />
  <id>/blog/project/2014/07/07/global-weather-comparisons</id>
  <published>2014-07-07T00:00:00-04:00</published>
  <updated>2014-07-07T00:00:00-04:00</updated>
  <author>
    <name>Keith Callenberg</name>
    <uri></uri>
    <email>keithcallenberg@gmail.com</email>
  </author>
  <content type="html">&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;/h2&gt;
&lt;p&gt;I recently built &lt;a href=&quot;http://apps.calgorithms.com/weather/&quot;&gt;a tool&lt;/a&gt; for calculating and interactively displaying the similarity between climates around the world. I was particularly interested in this question: what are the farthest cities from my current city that experience a similar climate throughout the year? To be precise, I wanted to know what cities experience a similar &lt;em&gt;sequence&lt;/em&gt; of weather throughout a year. I did not want the results to be limited to hemisphere; I wanted the results to be irrespective of phase of seasons so that climates in North America, for instance, could be directly compared with climates in South America or Australia. &lt;/p&gt;

&lt;h2 id=&quot;you-can-access-the-app-at-httpappscalgorithmscomweatherhttpappscalgorithmscomweather&quot;&gt;You can access the app at &lt;a href=&quot;http://apps.calgorithms.com/weather/&quot;&gt;http://apps.calgorithms.com/weather/&lt;/a&gt;.&lt;/h2&gt;

&lt;h2 id=&quot;rough-outline-of-methods&quot;&gt;Rough outline of methods&lt;/h2&gt;
&lt;ol&gt;
  &lt;li&gt;Downloaded daily weather data from the &lt;a href=&quot;http://www.ncdc.noaa.gov/&quot;&gt;NOAA GHCND&lt;/a&gt; database.&lt;/li&gt;
  &lt;li&gt;Filtered for min temperature, max temperature, and precipitation data. &lt;/li&gt;
  &lt;li&gt;Filtered out any stations without at least 50 years of these 3 data types. Ended up with about 25,000 weather stations.&lt;/li&gt;
  &lt;li&gt;Averaged data over all years to end up with an average year sequence for each station.&lt;/li&gt;
  &lt;li&gt;Shifted all data so that the hottest day of the year was the first day, in order to align the seasons.&lt;/li&gt;
  &lt;li&gt;Calculated three similarity matrices for the min temperature, max temperature, and precipitation data.&lt;/li&gt;
  &lt;li&gt;Saved these matrices as &lt;a href=&quot;http://cran.r-project.org/web/packages/bigmemory/index.html&quot;&gt;bigmemory&lt;/a&gt; objects.&lt;/li&gt;
  &lt;li&gt;Developed R &lt;a href=&quot;http://shiny.rstudio.com/&quot;&gt;Shiny&lt;/a&gt; app with &lt;a href=&quot;http://www.leafletjs.com/&quot;&gt;leaflet&lt;/a&gt; and Mapbox to display results.&lt;/li&gt;
  &lt;li&gt;Uploaded and served from a &lt;a href=&quot;https://www.digitalocean.com/?refcode=2df09252c285&quot;&gt;DigitalOcean&lt;/a&gt; droplet running &lt;a href=&quot;http://www.rstudio.com/products/shiny/shiny-server/&quot;&gt;Shiny Server&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;bigmemory-was-essential&quot;&gt;bigmemory was essential&lt;/h2&gt;
&lt;p&gt;Due to the size of the data set, it wasn’t feasible to calculate similarity on the fly. Therefore I looked for some way of storing the data set that would allow me to quickly take a subset for only the current city. The binary RData format is space-efficient, but cannot be sliced without loading the whole object into memory, and each of the similarity matrices is &amp;gt;5 GB. I also experimented with setting up a simple SQLite database using the &lt;a href=&quot;http://cran.r-project.org/web/packages/RSQLite/index.html&quot;&gt;RSQLite&lt;/a&gt; package, but found the query speed unusably slow (&amp;gt;0.5 sec), even with what I think was proper indexing. I finally landed on the &lt;a href=&quot;http://cran.r-project.org/web/packages/bigmemory/index.html&quot;&gt;bigmemory&lt;/a&gt; package. I found the file sizes quite large – possibly almost 50 times larger than RData binary format – but &lt;a href=&quot;http://cran.r-project.org/web/packages/bigmemory/index.html&quot;&gt;bigmemory&lt;/a&gt; was exceptionally easy to setup, and most importantly for this application, very quick (&amp;lt;0.01 sec) to access slices of large datasets.&lt;/p&gt;

&lt;h2 id=&quot;why-i-selected-only-min-temp-max-temp-and-precipitation&quot;&gt;Why I selected only min temp, max temp, and precipitation&lt;/h2&gt;
&lt;p&gt;While I really would have liked to include features such as humidity, I found quite a few misformatted entries for data types other than temperature and precipitation. And perhaps more importantly, these three were the most parsimonious and I found that more than 25,000 stations had these entries.&lt;/p&gt;

&lt;h2 id=&quot;how-the-shiny-app-works&quot;&gt;How the Shiny app works&lt;/h2&gt;
&lt;p&gt;The app takes a latitude and longitude as input. These can be provided by clicking on any of the already plotted station locations, selecting a city from the drop-down, or manually by entering them into the textboxes. It calculates the distance from that desired lat/long to all stations. It then takes the closest station and retrieves (from bigmemory objects) the max temp, min temp, and precipitation similarities between this station and all others. From those 3 data sources it calculates a total similarity score which is currently just a weighted sum:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;similarity = w_1 * sum(min_temp_differences) + w_2 * sum(max_temp_differences) + w_3 * sum(precipitation_differences)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Finally, to make the app lighter and more responsive, it places location markers for only a random sample of a few thousand stations, colored by their similarity to the selected station. &lt;/p&gt;

&lt;h2 id=&quot;results&quot;&gt;Results&lt;/h2&gt;
&lt;p&gt;I am still in the process of testing whether the metric is qualitatively accurate and I would definitely appreciate &lt;a href=&quot;&amp;#109;&amp;#097;&amp;#105;&amp;#108;&amp;#116;&amp;#111;:&amp;#107;&amp;#101;&amp;#105;&amp;#116;&amp;#104;&amp;#099;&amp;#097;&amp;#108;&amp;#108;&amp;#101;&amp;#110;&amp;#098;&amp;#101;&amp;#114;&amp;#103;&amp;#064;&amp;#103;&amp;#109;&amp;#097;&amp;#105;&amp;#108;&amp;#046;&amp;#099;&amp;#111;&amp;#109;&quot;&gt;feedback&lt;/a&gt;. That said, one of my motivating questions was whether a similarity score like this could recapitulate the climates that are ideal for growing grapes and producing wine. If you click on a circle just north of San Francisco in Napa or Sonoma county, you will find indeed similar scores shown in the mediterranean, South Africa and southern Australia. I take that as a very very rough and preliminary measure of progress. On my to-do list is evaluating deserts and tropical locations.&lt;/p&gt;

&lt;h2 id=&quot;work-in-progress&quot;&gt;Work in progress&lt;/h2&gt;
&lt;p&gt;This app is definitely still a work in progress. On the top of my list of things to fix is how drastically the color scale can change depending on the sampling that is performed (each time you zoom in and out or change stations). I think I need to set the color based on the log of the similarity score and also set limits for the score to avoid outlier effects. I will also explore ways to increase the number of stations sampled. I’m currently only showing about 20% of the total because even on modern hardware, when more than 30% of the stations are added it becomes very sluggish to scroll around the map.&lt;/p&gt;

&lt;h2 id=&quot;other-work-in-this-area&quot;&gt;Other work in this area&lt;/h2&gt;
&lt;p&gt;Before I started building this, I did a search for earlier work. &lt;a href=&quot;http://iaindunning.com/2013/comparing-the-weather-of-different-cities.html&quot;&gt;Iain Dunning&lt;/a&gt; pursued a similar question and &lt;a href=&quot;http://tenkicompare.com/&quot;&gt;built an app&lt;/a&gt; comparing Australian climate to cities in the US, albeit without a map interface. Iain’s app is nicely built on Bootstrap and returns a list of the most similar cities in the opposite country. &lt;a href=&quot;http://outflux.net/weather/noaa/&quot;&gt;Another web-based tool&lt;/a&gt; was also built on NOAA data to return a graph comparing several selected US cities. &lt;/p&gt;

&lt;p&gt;You can access the app at &lt;a href=&quot;http://apps.calgorithms.com/weather/&quot;&gt;http://apps.calgorithms.com/weather/&lt;/a&gt;.&lt;/p&gt;

  &lt;p&gt;&lt;a href=&quot;/blog/project/2014/07/07/global-weather-comparisons/&quot;&gt;Global weather comparisons&lt;/a&gt; was originally published by Keith Callenberg at &lt;a href=&quot;&quot;&gt;Calgorithms&lt;/a&gt; on July 07, 2014.&lt;/p&gt;</content>
</entry>


<entry>
  <title type="html"><![CDATA[MDS visualization in Python]]></title>
  <link rel="alternate" type="text/html" href="/blog/2014/06/25/mds-visualization-in-python/" />
  <id>/blog/2014/06/25/mds-visualization-in-python</id>
  <published>2014-06-25T00:00:00-04:00</published>
  <updated>2014-06-25T00:00:00-04:00</updated>
  <author>
    <name>Keith Callenberg</name>
    <uri></uri>
    <email>keithcallenberg@gmail.com</email>
  </author>
  <content type="html">&lt;figure&gt;
	&lt;img src=&quot;/images/pymds.png&quot; /&gt;
	&lt;figcaption&gt;Simple tk-based GUI for MDS&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;I recently came across some code that Andrew Gelman &lt;a href=&quot;http://andrewgelman.com/2007/06/25/animated_mds_co/&quot;&gt;published&lt;/a&gt; on his blog back in 2007 for visualizing several multidimensional scaling (MDS) algorithms in Python with a simple tk interface. Given the age of the code, it used the Numeric, LinearAlgebra, and RandomArray packages which were all precursors to NumPy and therefore no longer readily available. So I made some simple updates and I am reposting &lt;a href=&quot;/assets/files/pyNationsMDS_numpy.zip&quot;&gt;the code here&lt;/a&gt;. The code includes a demo that can be run as: &lt;/p&gt;

&lt;p&gt;&lt;code&gt;
python ./MDSdemo.py
&lt;/code&gt;&lt;/p&gt;

  &lt;p&gt;&lt;a href=&quot;/blog/2014/06/25/mds-visualization-in-python/&quot;&gt;MDS visualization in Python&lt;/a&gt; was originally published by Keith Callenberg at &lt;a href=&quot;&quot;&gt;Calgorithms&lt;/a&gt; on June 25, 2014.&lt;/p&gt;</content>
</entry>


<entry>
  <title type="html"><![CDATA[Barrel-organing by Graham Greene]]></title>
  <link rel="alternate" type="text/html" href="/etc/2014/06/19/barrel-organing-by-graham-greene/" />
  <id>/etc/2014/06/19/barrel-organing-by-graham-greene</id>
  <published>2014-06-19T00:00:00-04:00</published>
  <updated>2014-06-19T00:00:00-04:00</updated>
  <author>
    <name>Keith Callenberg</name>
    <uri></uri>
    <email>keithcallenberg@gmail.com</email>
  </author>
  <content type="html">&lt;p&gt;Those who have barrel-organed in a hard December may be said to have graduated in that peculiarly classical profession whose gamut of tunes, in the form of a numbered dial, ranges from the Dead March in &lt;em&gt;Saul&lt;/em&gt; to the Toreador’s Song. The latter was the gayest tune which my organ contained, and was intended, perhaps, to combat with its cheerful bludgeoning the searching rapier of the wind. It was the former’s velvet-hung pomp, however, which brouht in the pennies, until the organ, slipping from cold, clutching fingers, tumbled over and over down a steep Hertfordshire hill and came to rest at the bottom with all its bass notes broken. What seemed at first disaster and bankruptcy, for my friend Claud Cockburn and I were far from home with no money in our pockets but our scanty earnings, and with nothing to pawn but our elaborate and careful rags, proved a blessing. In the first street in which we played four separate elderly ladies gave us four separate sixpences on condition that we moved on to a neighbor’s house.&lt;/p&gt;

&lt;p&gt;And in this connection it may be noted that in the country – I have no experience of London – the barrel-organist’s principal income is derived not from the rich but from the poor – the youths ‘walking out’ who wish to impress their companions with the measure of their charity and from women who bring their children to the door to listen to the music, bad music, perhaps, but music with a hint of a hot south – ‘des fruits, des fleurs, des feuilles et des branches’, These do not pay sixpence to the organist to go away, but pay him a penny for another tune. This is less profitable but more warming to the heart, and was very welcome on the three bitter December days during which I followed the profession and graduated, if not with the legendary motor-car, at least with a few pence profit.&lt;/p&gt;

&lt;p&gt;Perhaps to begin with the organ was a little too polished in its performance to carry conviction of poverty, for it was only after disaster had marred its notes that we were admitted to the &lt;em&gt;camaraderie&lt;/em&gt; of the profession. Among itinerant musicians there is a very real fellowship. Trundling the barrel-organ along a frozen lane, we met at the approach to a village one time a lean, drooping figure, curled round a forlorn pipe, who, passing, indicated, without staying his steps, the street in which the wealthiest harvest could be reaped; another time a fat, red fellow with a gramophone perched on a perambulator, who warned us between wet, pendulous lips of the presence of skinflints. Little do those who throw an organist sixpence in order to drive him away know that they are thus ensuring the arrival of a succession of similar players.&lt;/p&gt;

&lt;p&gt;I do not know whether London is the Mecca of the barrel-organist, as it is of the more legitimate musician. Certainly during the winter it has great advantages over the country in the matter of lodgings. In London there is the crypt of St Martin between the common lodging-house and the Embankment; in the country there is little, as we proved to our cost, between the public house and frost-gnarled field.&lt;/p&gt;

&lt;p&gt;Of all but one of the five towns in which I have barrel-organed I have nothing but pleasant memories. The exception should surely have been foremost in charity, since it was the birthplace of the English Pope, Nicholas Breakspear, friend of poor men and enemy of emperors. But in this town, because of our dirty faces and our rags, we were rejected at every inn. One inn, more friendly than the others, offered a stable for our organ, if we paid, but from his organ, as from his horse, a man should not be separated.&lt;/p&gt;

&lt;p&gt;There seemed only to remain an iron-bound field, but here, after a few hours’ attempt at sleep, cramp knotted every muscle. Thence we made our way to a half-built house with a roof and floor, but only unlidded gaps for windows, through which the wind swept in a regular succession of chilling gusts. We woke again before dawn in the grip of cramp, and finally left the suspicious and uncharitable town for the comparative warmth of walking between high hedges, followed on our right hand by a spectrally coughing cow – and so trundled out of the profession for ever. &lt;/p&gt;

&lt;p&gt;Listen! Outside the window a gradually growing tinkle of sound – small scented sugar-plums of brittle music dropping rapidly one by one into the blue dusk. Here is sixpence, organist. Do not go, but turn the handle of your dial and play another tune.&lt;/p&gt;

&lt;p&gt;Graham Greene&lt;br /&gt;
&lt;em&gt;The Times&lt;/em&gt;&lt;br /&gt;
27 December 1928&lt;/p&gt;

  &lt;p&gt;&lt;a href=&quot;/etc/2014/06/19/barrel-organing-by-graham-greene/&quot;&gt;Barrel-organing by Graham Greene&lt;/a&gt; was originally published by Keith Callenberg at &lt;a href=&quot;&quot;&gt;Calgorithms&lt;/a&gt; on June 19, 2014.&lt;/p&gt;</content>
</entry>


<entry>
  <title type="html"><![CDATA[Barrel-organing by Graham Greene]]></title>
  <link rel="alternate" type="text/html" href="/etc/2014/06/19/barrel-organing-by-graham-greene/" />
  <id>/etc/2014/06/19/barrel-organing-by-graham-greene</id>
  <published>2014-06-19T00:00:00-04:00</published>
  <updated>2014-06-19T00:00:00-04:00</updated>
  <author>
    <name>Keith Callenberg</name>
    <uri></uri>
    <email>keithcallenberg@gmail.com</email>
  </author>
  <content type="html">&lt;p&gt;Those who have barrel-organed in a hard December may be said to have graduated in that peculiarly classical profession whose gamut of tunes, in the form of a numbered dial, ranges from the Dead March in &lt;em&gt;Saul&lt;/em&gt; to the Toreador’s Song. The latter was the gayest tune which my organ contained, and was intended, perhaps, to combat with its cheerful bludgeoning the searching rapier of the wind. It was the former’s velvet-hung pomp, however, which brouht in the pennies, until the organ, slipping from cold, clutching fingers, tumbled over and over down a steep Hertfordshire hill and came to rest at the bottom with all its bass notes broken. What seemed at first disaster and bankruptcy, for my friend Claud Cockburn and I were far from home with no money in our pockets but our scanty earnings, and with nothing to pawn but our elaborate and careful rags, proved a blessing. In the first street in which we played four separate elderly ladies gave us four separate sixpences on condition that we moved on to a neighbor’s house.&lt;/p&gt;

&lt;p&gt;And in this conection it may be noted that in the country – I have no experience of London – the barrel-organist’s principal income is derived not from the rich but from the poor – the youths ‘walking out’ who wish to impress their companions with the measure of their charity and from women who bring their children to the door to listen to the music, bad music, perhaps, but music with a hint of a hot south – ‘des fruits, des fleurs, des feuilles et des branches’, These do not pay sixpence to the organist to go away, but pay him a penny for another tune. This is less profitable but more warming to the heart, and was very welcome on the three bitter December days during which I followed the profession and graduated, if not with the legendary motor-car, at least with a few pence profit.&lt;/p&gt;

&lt;p&gt;Perhaps to begin with the organ was a little too polished in its performance to carry conviction of poverty, for it was only after disaster had marred its notes that we were admitted to the &lt;em&gt;camaraderie&lt;/em&gt; of the profession. Among itinerant musicians there is a very real fellowship. Trundling the barrel-organ along a frozen lane, we met at the approach to a village one time a lean, drooping figure, curled round a forlorn pipe, who, passing, indicated, without staying his steps, the street in which the wealthiest harvest could be reaped; another time a fat, red fellow with a gramophone perched on a perambulator, who warned us between wet, pendulous lips of the presence of skinflints. Little do those who throw an organist sixpence in order to drive him away know that they are thus ensuring the arrival of a succession of similar players.&lt;/p&gt;

&lt;p&gt;I do not know whether London is the Mecca of the barrel-organist, as it is of the more legitimate musician. Certainly during the winter it has great advantages over the country in the matter of lodgings. In London there is the crypt of St Martin between the common lodging-house and the Embankment; in the country there is little, as we proved to our cost, between the public house and frost-gnarled field.&lt;/p&gt;

&lt;p&gt;Of all but one of the five towns in which I have barrel-organed I have nothing but pleasant memories. The exception should surely have been foremost in charity, since it was the birthplace of the English Pope, Nicholas Breakspear, friend of poor men and enemy of emperors. But in this town, because of our dirty faces and our rags, we were rejected at every inn. One inn, more friendly than the others, offered a stable for our organ, if we paid, but from his organ, as from his horse, a man should not be separated.&lt;/p&gt;

&lt;p&gt;There seemed only to remain an iron-bound field, but here, after a few hours’ attempt at sleep, cramp knotted every muscle. Thence we made our way to a half-built house with a roof and floor, but only unlidded gaps for windows, through which the wind swept in a regular succession of chilling gusts. We woke again before dawn in the grip of cramp, and finally left the suspicious and uncharitable town for the comparative warmth of walking between high hedges, followed on our right hand by a spectrally coughing cow – and so trundled out of the profession for ever. &lt;/p&gt;

&lt;p&gt;Listen! Outside the window a gradually growing tinkle of sound – small scented sugar-plums of brittle music dropping rapidly one by one into the blue dusk. Here is sixpence, organist. Do not go, but turn the handle of your dial and play another tune.&lt;/p&gt;

&lt;p&gt;Graham Greene
&lt;em&gt;The Times&lt;/em&gt;
27 December 1928&lt;/p&gt;

  &lt;p&gt;&lt;a href=&quot;/etc/2014/06/19/barrel-organing-by-graham-greene/&quot;&gt;Barrel-organing by Graham Greene&lt;/a&gt; was originally published by Keith Callenberg at &lt;a href=&quot;&quot;&gt;Calgorithms&lt;/a&gt; on June 19, 2014.&lt;/p&gt;</content>
</entry>


<entry>
  <title type="html"><![CDATA[Visualization of membrane shape optimization]]></title>
  <link rel="alternate" type="text/html" href="/blog/2014/06/12/visualization-of-membrane-shape-optimization/" />
  <id>/blog/2014/06/12/visualization-of-membrane-shape-optimization</id>
  <published>2014-06-12T00:00:00-04:00</published>
  <updated>2014-06-12T00:00:00-04:00</updated>
  <author>
    <name>Keith Callenberg</name>
    <uri></uri>
    <email>keithcallenberg@gmail.com</email>
  </author>
  <content type="html">&lt;p&gt;I presented the following video during my thesis defense. It is a visualization of the optimization of the local membrane shape surrounding a peptide with a charged residue (highlighted in green). The peptide structure is assumed static.&lt;/p&gt;

&lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;https://www.youtube.com/embed/yEah4oBDl2A&quot; frameborder=&quot;0&quot;&gt; &lt;/iframe&gt;

  &lt;p&gt;&lt;a href=&quot;/blog/2014/06/12/visualization-of-membrane-shape-optimization/&quot;&gt;Visualization of membrane shape optimization&lt;/a&gt; was originally published by Keith Callenberg at &lt;a href=&quot;&quot;&gt;Calgorithms&lt;/a&gt; on June 12, 2014.&lt;/p&gt;</content>
</entry>


<entry>
  <title type="html"><![CDATA[seq shell command replacement for Mac OS X]]></title>
  <link rel="alternate" type="text/html" href="/blog/2014/06/12/seq-shell-command-replacement-for-mac-os-x/" />
  <id>/blog/2014/06/12/seq-shell-command-replacement-for-mac-os-x</id>
  <published>2014-06-12T00:00:00-04:00</published>
  <updated>2014-06-12T00:00:00-04:00</updated>
  <author>
    <name>Keith Callenberg</name>
    <uri></uri>
    <email>keithcallenberg@gmail.com</email>
  </author>
  <content type="html">&lt;p&gt;There are several ways to write shell script for loops, but I have found their compatibility doesn’t depend only on the shell you are using, but the operating system as well.&lt;/p&gt;

&lt;p&gt;I personally like using the /usr/bin/seq command with a syntax like this:&lt;/p&gt;

&lt;p&gt;for i in &lt;code&gt;seq ${1} ${2}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;where $1 and $2 are my command-line arguments specifying the integer start and stop of my loop. However, Mac OS X does not ship with the seq command. Here is a shell script you can place in the /usr/bin/ directory. It will then be on your path for use in any scripts you write. I use “echo -n” instead of printf so that it will properly handle negative numbers, though the -n option may not be available with your distribution.&lt;/p&gt;

&lt;p&gt;#!/bin/bash&lt;/p&gt;

&lt;p&gt;if [ $# -eq 2 ]
then
  let from=”$1”;
  let to=”$2”;
elif [ $# -eq 1 ]
then
  let from=”0”;
  let to=”$1”;
else
  echo “Usage: seq [from] [to]”
exit 1;
fi&lt;/p&gt;

&lt;p&gt;while [ $from -lt $to ]
do
  echo -n “$from “;
  from=$[$from+1]
done
echo -n “$from “;
{% endhighlight %}&lt;/p&gt;

  &lt;p&gt;&lt;a href=&quot;/blog/2014/06/12/seq-shell-command-replacement-for-mac-os-x/&quot;&gt;seq shell command replacement for Mac OS X&lt;/a&gt; was originally published by Keith Callenberg at &lt;a href=&quot;&quot;&gt;Calgorithms&lt;/a&gt; on June 12, 2014.&lt;/p&gt;</content>
</entry>


<entry>
  <title type="html"><![CDATA[Methods for calculating solvent accessible surface area (SASA)]]></title>
  <link rel="alternate" type="text/html" href="/blog/2014/06/12/methods-for-calculating-solvent-accessible-surface-area-sasa/" />
  <id>/blog/2014/06/12/methods-for-calculating-solvent-accessible-surface-area-sasa</id>
  <published>2014-06-12T00:00:00-04:00</published>
  <updated>2014-06-12T00:00:00-04:00</updated>
  <author>
    <name>Keith Callenberg</name>
    <uri></uri>
    <email>keithcallenberg@gmail.com</email>
  </author>
  <content type="html">&lt;figure&gt;
	&lt;img src=&quot;/images/asa.png&quot; /&gt;
	&lt;figcaption&gt;Image credit: Keith Callenberg&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;Most of these methods are based on the Shrake-Rupley algorithm [1] which creates many points on the surface of each (heavy) atom and determines whether each point is occluded or exposed to solvent.&lt;/p&gt;

&lt;p&gt;You can calculate SASA in VMD’s tkConsole with the measure command using the following syntax:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;
measure sasa  $selection [-points varname] [-restrict restrictedsel] [-samples numsamples]
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Other free software packages:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;Barry Honig SURFace: &lt;a href=&quot;http://wiki.c2b2.columbia.edu/honiglab_public/index.php/Software:SURFace_Algorithms&quot;&gt;http://wiki.c2b2.columbia.edu/honiglab_public/index.php/Software:SURFace_Algorithms&lt;/a&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;NACCESS: &lt;a href=&quot;http://www.bioinf.manchester.ac.uk/naccess/&quot;&gt;http://www.bioinf.manchester.ac.uk/naccess/&lt;/a&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Python-based ASA by Bosco Ho: &lt;a href=&quot;http://boscoh.com/protein/calculating-the-solvent-accessible-surface-area-asa.html&quot;&gt;http://boscoh.com/protein/calculating-the-solvent-accessible-surface-area-asa.html&lt;/a&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;MSMS: &lt;a href=&quot;http://mgltools.scripps.edu/downloads&quot;&gt;http://mgltools.scripps.edu/downloads&lt;/a&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Calc-surface by Mark Gerstein: download and compile the libproteingeometry package from &lt;a href=&quot;http://www.molmovdb.org/geometry/&quot;&gt;http://www.molmovdb.org/geometry/&lt;/a&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;GETAREA, a web server: &lt;a href=&quot;http://curie.utmb.edu/getarea.html&quot;&gt;http://curie.utmb.edu/getarea.html&lt;/a&gt;&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;References:
[1] A. Shrake, J. A. Rupley, Environment and exposure to solvent of protein atoms. Lysozyme and insulin, Journal of Molecular Biology, Volume 79, Issue 2, 15 September 1973, Pages 351-364, ISSN 0022-2836, DOI: 10.1016/0022-2836(73)90011-9&lt;/p&gt;

  &lt;p&gt;&lt;a href=&quot;/blog/2014/06/12/methods-for-calculating-solvent-accessible-surface-area-sasa/&quot;&gt;Methods for calculating solvent accessible surface area (SASA)&lt;/a&gt; was originally published by Keith Callenberg at &lt;a href=&quot;&quot;&gt;Calgorithms&lt;/a&gt; on June 12, 2014.&lt;/p&gt;</content>
</entry>


<entry>
  <title type="html"><![CDATA[How to easily align two molecular structures in VMD]]></title>
  <link rel="alternate" type="text/html" href="/blog/2014/06/12/how-to-easily-align-two-molecular-structures-in-vmd/" />
  <id>/blog/2014/06/12/how-to-easily-align-two-molecular-structures-in-vmd</id>
  <published>2014-06-12T00:00:00-04:00</published>
  <updated>2014-06-12T00:00:00-04:00</updated>
  <author>
    <name>Keith Callenberg</name>
    <uri></uri>
    <email>keithcallenberg@gmail.com</email>
  </author>
  <content type="html">&lt;p&gt;When I say “easily”, I mean that this method does not require scripting. There is still potentially a lot of guesswork required to identify a good set of atoms for Step 3 below. Bosco Ho has an &lt;a href=&quot;http://boscoh.com/protein/structural-alignment-done-right.html&quot;&gt;alternative take&lt;/a&gt; on this task that is definitely worth a read.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;Open the two structures:
&lt;code&gt;
vmd -m structure1.pdb structure2.pdb
&lt;/code&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Open the RMSD Calculator (NOT the RMSD Trajectory Tool):
Extensions &amp;gt; Analysis &amp;gt; RMSD Calculator
You can use the Trajectory Tool to align structures too, but the Calculator actually changes the coordinates of the aligned structure so that you can save them, while the Trajectory Tool only changes the orientation of how the two molecules are displayed with respect to one another.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Specify the atoms you want to use in the text box in the upper left corner of the RMSD Calculator.
If you want to use every atom from both structures, simply type “protein”.
If you want to use only a portion of each molecule to align the structures, open the Sequence viewer:
Extensions &amp;gt; Analysis &amp;gt; Sequence viewer
and identify the residue ID numbers from each structure. Now you can type a list in the atomselect box, e.g. “residue 30 to 40”.&lt;/p&gt;

    &lt;p&gt;If the residue numbers differ between the two structures, a cumbersome, though simple workaround is to specify the residue name, or some other attribute that is different between the 2 structures, in addition to the number, e.g. “(resid 30 and resname “LYS”) or (resid 31 and resname “LYS”)” where the lysine of interest is residue 30 in one structure and residue 31 in the other.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Click the Align button.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Right-click on the structure you aligned (the one that is NOT the reference) in the VMD Main window, and select Save Coordinates… to save your new aligned structure to a new file.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

  &lt;p&gt;&lt;a href=&quot;/blog/2014/06/12/how-to-easily-align-two-molecular-structures-in-vmd/&quot;&gt;How to easily align two molecular structures in VMD&lt;/a&gt; was originally published by Keith Callenberg at &lt;a href=&quot;&quot;&gt;Calgorithms&lt;/a&gt; on June 12, 2014.&lt;/p&gt;</content>
</entry>


<entry>
  <title type="html"><![CDATA[Calculating the ion solvation energy along the permeation pathway of an ion channel]]></title>
  <link rel="alternate" type="text/html" href="/blog/2014/06/12/calculating-the-ion-solvation-energy-along-the-permeation-pathway-of-an-ion-channel/" />
  <id>/blog/2014/06/12/calculating-the-ion-solvation-energy-along-the-permeation-pathway-of-an-ion-channel</id>
  <published>2014-06-12T00:00:00-04:00</published>
  <updated>2014-06-12T00:00:00-04:00</updated>
  <author>
    <name>Keith Callenberg</name>
    <uri></uri>
    <email>keithcallenberg@gmail.com</email>
  </author>
  <content type="html">&lt;p&gt;In this tutorial we will model the membrane as a low dielectric slab to calculate the ion solvation permeation pathway. Although this functionality is now built into our APBSmem interface, we will use a script with our draw_membrane Java tool so that we can operate from the command-line.  &lt;/p&gt;

&lt;p&gt;For more details and the theory behind these calculations, please see my paper in PLoS ONE: &lt;a href=&quot;http://www.plosone.org/article/info:doi/10.1371/journal.pone.0012722&quot;&gt;http://www.plosone.org/article/info:doi/10.1371/journal.pone.0012722&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;requirements&quot;&gt;Requirements&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;APBS: &lt;a href=&quot;http://www.poissonboltzmann.org/&quot;&gt;poissonboltzmann.org&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;Linux, OS X, or Windows with Cygwin&lt;/li&gt;
  &lt;li&gt;Java v1.4.2 or greater&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;procedure&quot;&gt;Procedure&lt;/h2&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;Download and extract the following archive to a new directory: &lt;a href=&quot;/assets/files/permeation.zip&quot;&gt;permeation.zip&lt;/a&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Verify that the tools work for the test case on KcsA by executing this command in a terminal:
&lt;code&gt;
./ion_permeation -1.000 1 3
&lt;/code&gt;&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This will move an ion through the pore from -1 to +3 in steps of 1 angstrom.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;Prepare your protein by converting it to the PQR format. You can use the PDB2PQR server: http://kryptonite.nbcr.net/pdb2pqr/&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;The protein should also be oriented with its principal axis oriented along the z-axis. This can be achieved in the lastest version of &lt;a href=&quot;http://apbsmem.sf.net/&quot;&gt;APBSmem&lt;/a&gt;
This can also be done in VMD: &lt;a href=&quot;http://www.ks.uiuc.edu/Research/vmd/script_library/scripts/orient/&quot;&gt;http://www.ks.uiuc.edu/Research/vmd/script_library/scripts/orient/&lt;/a&gt;
PyMOL: &lt;a href=&quot;http://www.pymolwiki.org/index.php/Orient&quot;&gt;http://www.pymolwiki.org/index.php/Orient&lt;/a&gt;
or using MODELLER: &lt;a href=&quot;http://salilab.org/modeller/9v6/manual/node180.html&quot;&gt;http://salilab.org/modeller/9v6/manual/node180.html&lt;/a&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Open the &lt;code&gt;ion_permeation&lt;/code&gt; script in a text editor. At the top of the script are a series of parameters that specify the membrane geometry and dielectrics. For more details on what these parameters signify, please see our PLoS ONE paper. Change the line that reads &lt;code&gt;cat K1K2K3_protein.pqr ion.pqr &amp;gt; K1K2K3_protein.pqr.withion.pqr&lt;/code&gt; to reflect your own protein pqr file names.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Open the permeation.dummy.in and permeation.solv.in input files in a text editor. First make sure the file locations reflect the locations of your pqr files. Now modify the settings to reflect your system. This can be made easier using APBSmem. Details on the parameters are available here: &lt;a href=&quot;http://www.poissonboltzmann.org/apbs/user-guide/running-apbs/input-files&quot;&gt;http://www.poissonboltzmann.org/apbs/user-guide/running-apbs/input-files&lt;/a&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Run the script using the following syntax:
&lt;code&gt;
./ion_permeation -1.000 1 3
&lt;/code&gt;  &lt;br /&gt;
The arguments are: Starting Z position, Step distance, Stop Z position
Please note, the number format of the first argument needs to be 6 characters for the pqr columns to line up properly.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Results will be saved in results.out.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

  &lt;p&gt;&lt;a href=&quot;/blog/2014/06/12/calculating-the-ion-solvation-energy-along-the-permeation-pathway-of-an-ion-channel/&quot;&gt;Calculating the ion solvation energy along the permeation pathway of an ion channel&lt;/a&gt; was originally published by Keith Callenberg at &lt;a href=&quot;&quot;&gt;Calgorithms&lt;/a&gt; on June 12, 2014.&lt;/p&gt;</content>
</entry>


<entry>
  <title type="html"><![CDATA[Installing NCBI Genome Workbench on Ubuntu 12.10]]></title>
  <link rel="alternate" type="text/html" href="/blog/2014/06/10/installing-ncbi-genome-workbench-on-ubuntu-12-dot-10/" />
  <id>/blog/2014/06/10/installing-ncbi-genome-workbench-on-ubuntu-12-dot-10</id>
  <published>2014-06-10T00:00:00-04:00</published>
  <updated>2014-06-10T00:00:00-04:00</updated>
  <author>
    <name>Keith Callenberg</name>
    <uri></uri>
    <email>keithcallenberg@gmail.com</email>
  </author>
  <content type="html">&lt;p&gt;If while trying to install the NCBI Genome Workbench on Ubuntu 12.10 (quantal) you get the following error:
“gbench depends on libglewmx1.6; however: Package libglewmx1.6 is not installed.”
Follow these steps to install the dependencies.&lt;/p&gt;

&lt;h1 id=&quot;install-the-dependencies&quot;&gt;1. install the dependencies&lt;/h1&gt;
&lt;p&gt;&lt;code&gt;
sudo apt-get install libftgl2 libglewmx-dev
&lt;/code&gt;&lt;/p&gt;

&lt;h1 id=&quot;install-genome-workbench-by-ignoring-libglewmx16-dependency&quot;&gt;2. install genome workbench by ignoring libglewmx1.6 dependency&lt;/h1&gt;
&lt;p&gt;&lt;code&gt;
sudo dpkg -i --ignore-depends=libglewmx1.6 gbench-linux-Ubuntu-precise_amd64-2.7.15.deb
&lt;/code&gt;&lt;/p&gt;

&lt;h1 id=&quot;make-a-symbolic-link-from-the-older-libglewmx-to-the-newer-version&quot;&gt;3. make a symbolic link from the older libglewmx to the newer version&lt;/h1&gt;
&lt;p&gt;&lt;code&gt;
sudo ln -s /usr/lib/x86_64-linux-gnu/libGLEWmx.so.1.8 /usr/lib/x86_64-linux-gnu/libGLEWmx.so.1.6
&lt;/code&gt;&lt;/p&gt;

  &lt;p&gt;&lt;a href=&quot;/blog/2014/06/10/installing-ncbi-genome-workbench-on-ubuntu-12-dot-10/&quot;&gt;Installing NCBI Genome Workbench on Ubuntu 12.10&lt;/a&gt; was originally published by Keith Callenberg at &lt;a href=&quot;&quot;&gt;Calgorithms&lt;/a&gt; on June 10, 2014.&lt;/p&gt;</content>
</entry>


<entry>
  <title type="html"><![CDATA[First Post]]></title>
  <link rel="alternate" type="text/html" href="/blog/2014/06/10/first-post/" />
  <id>/blog/2014/06/10/first-post</id>
  <published>2014-06-10T00:00:00-04:00</published>
  <updated>2014-06-10T00:00:00-04:00</updated>
  <author>
    <name>Keith Callenberg</name>
    <uri></uri>
    <email>keithcallenberg@gmail.com</email>
  </author>
  <content type="html">&lt;p&gt;First post on this newly created site built with Jekyll. Exciting! Hope you find some of the content here interesting and useful. &lt;/p&gt;

&lt;p&gt;–Keith&lt;/p&gt;

  &lt;p&gt;&lt;a href=&quot;/blog/2014/06/10/first-post/&quot;&gt;First Post&lt;/a&gt; was originally published by Keith Callenberg at &lt;a href=&quot;&quot;&gt;Calgorithms&lt;/a&gt; on June 10, 2014.&lt;/p&gt;</content>
</entry>

</feed>