Circular sequence diagram (tikz?)

Apologies in advance for the slightly-crappy camera phone picture:

I'd like to include some figures like this in something I'm working on. I've just started learning tikz, which seems like it could be used to do something like this, but I'm not quite dextrous enough just yet.

The included picture has 16 cells, but I have another figure with 8 cells and a less important one with 27 cells, so if this can be done generally to make doing those easy as well, that'd be great.

-
some related posts: question search for ring chart –  cmhughes Dec 6 '12 at 4:20
It would be nice to have certain cells filled with color. –  Uwe Ziegenhagen Dec 6 '12 at 4:21
You can check the examples of chains and foreach commands in the manual for a few examples similar to this one. Also you can check this one for the repetition task. tex.stackexchange.com/questions/42261/… –  percusse Dec 6 '12 at 4:23

The CircularSequence macro below takes three paramaters:

• the sequence to be applied

which should be able to create this image with any desired number of elements. Below are examples with 8 and 16 elements:

Code:

\documentclass{article}
\usepackage{tikz}
\usepackage{xstring}

% http://tex.stackexchange.com/questions/21559/macro-to-access-a-specific-member-of-a-list/21560#21560
\newcommand*\GetListMember[2]{\StrBetween[#2,\number\numexpr#2+1]{,#1,},,\par}%

\newcommand*{\CircularSequence}[3]{%
% #1 = outer circle radius
% #2 = inner circle radius
% #3 = seqeunce
\StrCount{#3}{,}[\NumberOfElements]
\pgfmathsetmacro{\AngleSep}{360/(\NumberOfElements+1)}
\draw [red,  ultra thick] circle (#2);
\draw [blue, ultra thick] circle (#1);
\foreach [count = \Count] \Angle in {0,\AngleSep,..., 360} {%
\draw [gray, ultra thick] (\Angle:#2) -- (\Angle:#1);
\pgfmathsetmacro{\MidPoint}{\Angle+\AngleSep/2}
}%
}%
\begin{document}
\begin{tikzpicture}
\CircularSequence{3.0cm}{2.cm}{1,2,3,4,5,6,7,8}

\begin{scope}[xshift=7.0cm]
\CircularSequence{2.5cm}{1.5cm}{1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8}
\end{scope}
\end{tikzpicture}
\end{document}

-
Thanks! (and fast) Sadly, this doesn't compile for me. The errors are: ./circular-sequence-test.tex:26: Missing control sequence inserted. <inserted text> \inaccessiblel.26 ...ularSequence{3.0cm}{2.cm}{1,2,3,4,5,6,7,8} ? ./circular-sequence-test.tex:26: Undefined control sequence. <argument> \Angle :2.cm l.26 ...ularSequence{3.0cm}{2.cm}{1,2,3,4,5,6,7,8} ... Replacing 2.cm with 2.0cm does not help. –  Harold Dec 6 '12 at 4:57
I suspect that you are on an older release. Unless there is a good reason to stay on that you should probably to upgrade to TexLive 2012. –  Peter Grill Dec 6 '12 at 4:59
Indeed I am. I shall upgrade. –  Harold Dec 6 '12 at 5:08
–  cmhughes Dec 6 '12 at 5:08
@Harold: My crystal ball says that you are on a 2009 release. :-) And if so, you should just install TeXLive2012 directly. –  Peter Grill Dec 6 '12 at 5:08