0

I have tried the Markov cluster algorithm (MCL) in Matalb but sadly I got a matrix of size 67*67 and all their elements have NaN.

enter image description here

Could anyone tell me what's wrong?

 function adjacency_matrixmod2= mcl(adjacency_matrixmod2)
% test the explanations in stijn van dongens thesis.
%
% @author gregor :: arbylon . net

if nargin < 1
    % m contains T(G3 + I) as stochastic matrix
    load -ascii adjacency_matrixmod2.txt
end


p = 2;
minval = 0.001;

e = 1.;
emax = 0.001;
while e > emax

    fprintf('iteration %i before expansion:\n', i);
    adjacency_matrixmod2

    fprintf('iteration %i after expansion/before inflation:\n', i);
    m2 = expand(adjacency_matrixmod2)

    fprintf('inflation:\n')
    [adjacency_matrixmod2, e] = inflate(m2, p, minval);

    fprintf('residual energy: %f\n', e);

end % while e

end % mcl

% expand by multiplying m * m
% this preserves column (or row) normalisation
function m2 = expand(adjacency_matrixmod2)
m2 = adjacency_matrixmod2 *adjacency_matrixmod2;
end

% inflate by Hadamard potentiation
% and column re-normalisation
% prune elements of m that are below minval
function [m2, energy] = inflate(adjacency_matrixmod2, p, minval)
% inflation
m2 = adjacency_matrixmod2 .^ p;
% pruning
m2(find(m2 < minval)) = 0;
% normalisation
dinv = diag(1./sum(m2));
m2 = m2 * dinv;
% calculate residual energy
maxs = max(m2);
sqsums = sum(m2 .^ 2);
energy = max(maxs - sqsums);
end

This is the code I have used, and its input is an adjacency matrix.

halfer
  • 19,824
  • 17
  • 99
  • 186
F.caren
  • 85
  • 1
  • 9
  • That image is too small to read the captions on the nodes. Do you have any code? What do you get if you search for "Markov Cluster Algorithm Matlab" using a search engine? – halfer May 24 '17 at 13:28
  • Those nodes are gene's name – F.caren May 24 '17 at 13:31
  • http://listserver.ebi.ac.uk/pipermail/mcl-users/2010-October/000174.html – F.caren May 24 '17 at 13:38
  • Great! If you tried it, **put it into the question**. If you have problems with it, **debug it**. If you are still stuck, modify the question **to say what problem you are having**. – halfer May 24 '17 at 13:41
  • OK, so you get NaN - that's a concrete error that people can look into for you. However, they cannot help until they can see your code. So, please edit your code (or the relevant part) into your question. – halfer May 25 '17 at 11:30
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/145133/discussion-between-f-caren-and-halfer). – F.caren May 25 '17 at 14:02
  • That is better. I don't know if it is answerable, but I have cast a reopen vote. – halfer May 25 '17 at 14:16

0 Answers0