% !TEX TS-program = arara
% arara: xelatex: { shell: yes }
% arara: indent: { overwrite: yes }
% arara: clean: {extensions: [aux, bak, bbl, bcf, blg, idx, ilg, ind, ist, log, nlo, nls, out, run.xml, synctex.gz,]}

\documentclass[
    convert,
    outext=.png,
    border=2bp,
    tikz,
]{standalone}

\usepackage{fontspec}
\defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
\setmainfont[BoldFont={Fira Sans}]{Fira Sans Light}
\setmonofont{Fira Mono}

\usepackage{tikz}
\usetikzlibrary{arrows,positioning}
\usetikzlibrary{shapes.misc}
\usetikzlibrary{graphs}
\usepackage{color}

\begin{document}

\tikzset{
>=stealth', black!50, text=black, thick,
every new ->/.style       = {thick, shorten <=0pt, shorten >=1pt, color=black!70},
every new --/.style       = {thick, color=black!70},
graphs/every graph/.style = {edges=rounded corners},
skip loop/.style          = {to path={-- ++(0,#1) -| (\tikztotarget)}},
hv path/.style            = {to path={-| (\tikztotarget)}},
vh path/.style            = {to path={|- (\tikztotarget)}},
nonterminal/.style={
        rectangle, minimum size=6mm, very thick, draw=red!50!black!50,
        top color=white, bottom color=red!50!black!20,
        font=\itshape, text height=1.5ex,text depth=.25ex},
terminal/.style={
        rounded rectangle, minimum size=6mm, very thick, draw=black!50,
        top color=white, bottom color=black!20,
        font=\ttfamily, text height=1.5ex, text depth=.25ex},
shape = coordinate
}

%species.chromosome(strand):start-end
%--------^^^^^^^^^^--------^^^^^^----

\begin{tikzpicture}
    \graph[
    grow right sep,
    branch down=7mm,
    simple,
    ]{
    / --
    p1 ->
    species [nonterminal] ->
    "." [terminal] --
    p2 ->
    chromosome [nonterminal] --
    p4 ->
    "(" [terminal] --
    q1 -> [vh path]
    {[nodes={yshift=3.5mm}]
    strand_positive[as={+}, terminal], strand_negative[as={-}, terminal]
    } -- [hv path]
    q3 ->
    ")" [terminal] --
    p5 ->
    ":" [terminal] ->
    start [nonterminal] --
    p6 ->
    "-" [terminal] ->
    end [nonterminal] --
    p7 --
    / [coordinate];

    p1 -- [skip loop=5mm] p2;
    p4 -- [skip loop=9mm] p5;
    p6 -- [skip loop=5mm] p7;
    };
\end{tikzpicture}

\end{document}
