1

I have a sequence call it ACGTCCT.... Is there anyway of plotting this without using stairs? Does anyone know how to make the colourful 2D/3D arrows towards the bottom of the page this: How to plot a gene graph for a DNA sequence say ATGCCGCTGCGC?

in matlab? Other suggestions on the ACGTCCT visualisation are welcome too.

Cheers

Community
  • 1
  • 1
HCAI
  • 2,213
  • 8
  • 33
  • 65
  • What do you mean when you say 'stairs'? – Andrey Rubshtein Jan 14 '12 at 23:14
  • @Andrey I believe he means the latter structure of DNA. What do you hope to be able to see better with a nontraditional representation? – St-Ste-Ste-Stephen Jan 14 '12 at 23:29
  • Stairs as in `stairs(X,Y,'-rs','linewidth',1)`. My sequence is not actually from DNA but a Markov chain showing the movements of a person during a 15 minute period. What do you think? – HCAI Jan 15 '12 at 08:34

1 Answers1

1

The arrow.m submission from FileExchange is what you need. It's hard to imagine that it's not built in, but at least this contribution fills the gap nicely. Here is an example using it like in that Q/A you linked to:

function randomWalk(seq)

n = length(seq);

ptStart = zeros(n, 3);
ptEnd   = zeros(n, 3);

cols = jet(n);

for i=1:n
    switch seq(i)
        case 'A'
            d = [1 0];
        case 'T'
            d = [-1 0];
        case 'G'
            d = [0 1];
        case 'C'
            d = [0 -1];
    end

    ptEnd(i,:) = ptStart(i,:) + [d 1];
    ptStart(i+1,:) = ptEnd(i,:);
end

rng = [min([ptStart; ptEnd], [], 1); max([ptStart; ptEnd], [], 1)];
axis(rng(:))
for i=1:n
    arrow(ptStart(i,:), ptEnd(i,:), 'BaseAngle', 90,...
                                    'TipAngle',  15,...
                                    'Length',    30,...
                                    'CrossDir', [1 1 0],...
                                    'EdgeColor', cols(i,:),...
                                    'FaceColor', cols(i,:));
end

axis equal
view([45 15])
>> randomWalk('ATGCGTCGTAACGT')

enter image description here

John Colby
  • 22,169
  • 4
  • 57
  • 69