Installing and Packaging Circos on Mavericks (OS X 10.9)

Revised and updated from last year’s version.

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 DeployStudio and Casper distribution. The documentation has improved since 2013, but is still maddeningly vague in places. Here’s how I did things. A general familiarity with the command line is assumed, and use of a VM is recommended..

Gather Your Materials

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

  • Circos
  • MacPorts
  • GD perl module
  • 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 Mavericks VM and it worked a treat.

  • Install MacPorts
  • Install Xcode
    • Launch Xcode and accept the license agreement and device support install
    • Quit Xcode
    • Open Terminal and issue the following command (this will invoke an installer…allow it to run to completion):
      xcode-select --install.
  • Configure and update cpan
    • Open Terminal and issue the following commands (accepting the defaults as prompted)
    • sudo cpan
    • install CPAN <- Case sensitive, and take the defaults unless you know what you’re doing otherwise.
    • 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. Snapshotting the VM wouldn’t be a bad idea, either.

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 placed it at /Applications/circos-0.66/. 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.9 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)
ok Getopt::Long
ok IO::File
ok List::MoreUtils
ok List::Util
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
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
Math::VecStat
Readonly
Text::Format

We’ll do this using a mix of CPAN, build from source, and MacPorts. Since the GD2 library is available via MacPorts, let’s start there. Happily, letting MacPorts install the fontconfig dependency no longer seems to hard-hang the process. So:

sudo port install gd2

My advice is to go get lunch.

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::VecStat
install Readonly
install Text::Format
exit

If you run the test.module script at this point, you’ll get a new list of failures.

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

So:

install Clone
install List::MoreUtils
install Math::Round
install Params::Validate
install Regexp::Common

Exit CPAN and run test.modules again. Everything but GD should now pass. It should be installable by CPAN, but that never works for me…it needs a compile from source. Let’s take care of that. In the Finder, locate your GD download and decompress it. In Terminal, move to the 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 a directory etc, containing circos.png and circos.svg with a creation date/time of…well, now. Unfortunately, what you like get is run.out indicating that Math::Bezier failed. Install it via CPAN. While you’re at it, go ahead and install Set::IntSpan. When you’re finished, re-execute run and check etc/ again. You should now be good to go!

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.

Advertisements

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