Installing and Packaging Circos on OS X 10.8

Circos is a software package for visualizing data and information. It visualizes data in a circular layout — this makes Circos ideal for exploring relationships between objects or positions. There are other reasons why a circular layout is advantageous, not the least being the fact that it is attractive.

What is less immediately apparent until you start digging into the documentation is that actually making Circos run is a bit of a trick. I needed it not only running, but packaged for InstaDMG and Casper distribution. The documentation links to a variety of sources that are a confusing mash of helpful, slightly outdated, now-wrong and missing. To keep myself sane, I decided to document my own process, thus this post.

Easily the best starting point is Paulo Nuin’s excellent and clearly-written install procedure. Unfortunately, even at 10 months old, it’s slipping slightly out of date, and packages available from MacPorts enable skipping a few steps. Here’s how I did things.. A general familiarity with the command line is assumed.

Gather Your Materials

Other instructions provide direct links to files. Those links go stale quickly, so I’ve linked to source directories where possible.

  • Circos (currently at 0.63-4)
  • MacPorts
  • GD perl module (I have elected to use 2.49 rather than the current version, for reasons I shall explain shortly)
  • Xcode
  • JAMF Composer (or packaging tool of your choice, but I highly recommend something capable of snapshot comparisons…I won’t cover packaging this manually, as the tree just becomes needlessly complex)

Set Up Your Environment

Standard packaging rules: Clean system with no other apps running. I set mine up in a Mountain Lion VM and it worked a treat.

  • Install MacPorts
  • Install Xcode
    • Launch Xcode and accept the license agreement and device support install
    • Open Preferences > Downloads and install the Command Line Tools
    • Quit Xcode
  • Configure and update cpan
    • Open Terminal and issue the following commands (accepting the defaults as prompted)
    • sudo cpan
    • install CPAN <- Case sensitive
    • reload cpan

Take Your Snapshot

At this point you’re ready to start installing the modules required to run Circos, so take your starting snapshot. This will be a simple, standard package.

Install and Test Circos

Decompress the Circos download, and put the resulting directory where ever you want to run Circos for simplicity’s sake, I followed Paulo’s suggestion and placed it at /Applications/circos-0.63-4/. Circos comes with its own module tester, so let’s use it. Open Terminal, and

cd /Applications/circos-0.63-4/
./test.modules

This should return a list of installed and missing modules needed to run Circos. On a vanilla 10.8 install, that’ll look about like this:

ok Carp
ok Clone
fail Config::General is not usable (it or a sub-module is missing)
ok Cwd
ok Data::Dumper
ok Digest::MD5
ok File::Basename
ok File::Spec::Functions
ok File::Temp
ok FindBin
fail Font::TTF::Font is not usable (it or a sub-module is missing)
fail GD is not usable (it or a sub-module is missing)
fail GD::Image is not usable (it or a sub-module is missing)
fail GD::Polyline is not usable (it or a sub-module is missing)
ok Getopt::Long
ok IO::File
ok List::MoreUtils
ok List::Util
fail Math::Bezier is not usable (it or a sub-module is missing)
ok Math::BigFloat
ok Math::Round
fail Math::VecStat is not usable (it or a sub-module is missing)
ok Memoize
ok POSIX
ok Params::Validate
ok Pod::Usage
fail Readonly is not usable (it or a sub-module is missing)
ok Regexp::Common
fail Set::IntSpan is not usable (it or a sub-module is missing)
ok Storable
ok Sys::Hostname
ok Text::Balanced
fail Text::Format is not usable (it or a sub-module is missing)
ok Time::HiRes

Install items required by Circos

It’s those “fail” entries we’re concerned with, of course. So at a bare minimum, we need to install:

Config::General
Font::TTF::Font
GD
GD::Image
GD::Polyline
Math::Bezier
Math::VecStat
Readonly
Set::IntSpan
Text::Format

We’ll do this using a mix of CPAN, build from source, and MacPorts. Since GD2 is available via MacPorts, let’s start there. The trick to know is that as of the 2.0.35 build of GD2, letting MacPorts install the fontconfig dependency seems to hard-hang the process. So:

sudo port install fontconfig
sudo port install gd2

Now, crank up CPAN, and let’s get started on the perl modules. Note that CPAN commands are case sensitive.

sudo cpan
install Config::General
install Font::TTF::Font
install Math::Bezier
install Math::VecStat
install Readonly
install Set::IntSpan
install Text::Format
exit

If you run the test.module script at this point, everything should pass but the GD modules. Let’s take care of that. (A word about versions: There is a newer version of GD available from the BitBucket repo Paulo mentions, but they’ve changed compilation methods and I can’t for the life of me get it to build. If you can, I’d appreciate a how-to!) In the Finder, locate your GD-2.49 download and decompress it. In Terminal, move to the GD-2.49 directory you just decompressed, and issue the following commands:

perl Makefile.PL
make
sudo make install

When that’s done, cd back to Circos’ bin directory and re-run test.modules. Everything should now register okay. Then:

sudo ln -s /usr/bin/env /bin/env

This symlinks env to /bin. Circos is picky about finding it there. You could also add it to your path. At this point, Circos should be ready to rock.

cd /Applications/circos-0.63-4/example
./run
ls  -lah

You should see circos.png and circos.svg with a creation date/time of…well, now.

Take your finished snapshot

All that remains is to finish your snapshot and package Circos! Use your standard procedure…no tweaking of permissions is required. But be sure to remove the extraneous junk that CPAN, et. al. leave strewn around your home directory!

Advertisements

One thought on “Installing and Packaging Circos on OS X 10.8

  1. Pingback: Installing and Packaging Circos on Mavericks (OS X 10.9) | Technopracticum

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s