11 January 2006

Drawing pedigrees.

At Integragen, we are working on genetic diseases using a large collection of individuals. Pedigrees are stored using a simple recursive SQL table:
+--------------+--------------+------+-----+------------+
| Field | Type | Null | Key | Default |
+--------------+--------------+------+-----+------------+
| id | int(11) | | PRI | NULL |
| father | int(11) | YES | MUL | NULL |
| mother | int(11) | YES | MUL | NULL |
| svgX | int(5) | YES | | NULL |
| svgY | int(5) | YES | | NULL |
(...)
+--------------+--------------+------+-----+------------+

Although a colleague of mine wrote a paper about the art of drawing pedigrees, I wondered if I could use Graphviz/Dot in order to build the family trees. Using a SQL query transformed into DOT with awk, I was able to parse the X and Y positions generated by dot and to update my database. As those x/y coordinates are now in the tables, drawing the pedigrees in SVG is now easy.



No comments:

Post a Comment