Home > Mateda2.0 > functions > protein > EvalChain.m

# EvalChain

## PURPOSE

[Collisions,Overlappings,Pos] = EvalChain(vector)

## SYNOPSIS

function[Collisions,Overlappings,Pos] = EvalChain(vector)

## DESCRIPTION

     [Collisions,Overlappings,Pos] =  EvalChain(vector)
     EvalChain: Given a chain of molecules in the HP model, calculates the numer of Collisions with
     neighboring same sign molecules, and the number of Overlappings molecules.
     For reference on the  HP model see:
    --- R. Santana, P. Larra�aga, and J. A. Lozano (2004) Protein folding in 2-dimensional lattices with estimation of distribution algorithms.
    --- In Proceedings of the First International Symposium on Biological and Medical Data Analysis,
    --- Volume 3337 of Lecture Notes in Computer Science, pages 388-398, Barcelona, Spain, 2004. Springer Verlag.
     INPUTS
     vector: Sequence of residues ( (H)ydrophobic or (P)olar, respectively represented by zero and one)
     OUTPUTS
     Collisions:   Number of non contiguous H residues that are neighbors in the lattice
     Ovelappings:  Number of residues that self-intersect in the lattice
     Pos:    Position of the residues

     Last version 8/26/2008. Roberto Santana (roberto.santana@ehu.es)

## CROSS-REFERENCE INFORMATION

This function calls:

- PutMoveAtPos PutMoveAtPos: updates the lattice given a mov

This function is called by:

- EvaluateEnergy EvaluateEnergy: Evaluates the energy corresponding to the sequence lattice configuration determined by the lattice in vector.
- MakePajekGraphOfProtein [Pos] = MakePajekGraphOfProtein(vector)
- PrintProtein [Pos] = PrintProtein(vector)

## SOURCE CODE

    0001 function[Collisions,Overlappings,Pos] =  EvalChain(vector)
    0002 % [Collisions,Overlappings,Pos] =  EvalChain(vector)
    0003 % EvalChain: Given a chain of molecules in the HP model, calculates the numer of Collisions with
    0004 % neighboring same sign molecules, and the number of Overlappings molecules.
    0005 % For reference on the  HP model see:
    0006 %--- R. Santana, P. Larra�aga, and J. A. Lozano (2004) Protein folding in 2-dimensional lattices with estimation of distribution algorithms.
    0007 %--- In Proceedings of the First International Symposium on Biological and Medical Data Analysis,
    0008 %--- Volume 3337 of Lecture Notes in Computer Science, pages 388-398, Barcelona, Spain, 2004. Springer Verlag.
    0009 % INPUTS
    0010 % vector: Sequence of residues ( (H)ydrophobic or (P)olar, respectively represented by zero and one)
    0011 % OUTPUTS
    0012 % Collisions:   Number of non contiguous H residues that are neighbors in the lattice
    0013 % Ovelappings:  Number of residues that self-intersect in the lattice
    0014 % Pos:    Position of the residues
    0015 %
    0016 % Last version 8/26/2008. Roberto Santana (roberto.santana@ehu.es)
    0017
    0018
    0019 global HPInitConf;
    0020
    0021
    0022 sizeChain = size(vector,2);
    0023
    0024 Collisions = 0;
    0025 Overlappings = 0;
    0026
    0027
    0028 Pos = zeros(sizeChain,2);
    0029
    0030 Pos(1,1) = 0;  %Position for the initial molecule
    0031 Pos(1,2) = 0;
    0032
    0033 Pos(2,1) = 1;  %Position for the second molecule
    0034 Pos(2,2) = 0;
    0035
    0036  for i=3:sizeChain
    0037
    0038  [Pos] = PutMoveAtPos(Pos,i,vector(i));
    0039
    0040    for j=1:i-2,   % Check for Overlappings and Collissions in all the    molecules except the previous one
    0041     if(Pos(i,1)==Pos(j,1) & Pos(i,2)==Pos(j,2))
    0042       Overlappings = Overlappings + 1;
    0043     elseif (HPInitConf(i)==0  & HPInitConf(j)==0)
    0044      if (Pos(i,1)==Pos(j,1) & Pos(i,2)==Pos(j,2)-1)
    0045         Collisions =   Collisions + 1;
    0046      end
    0047      if (Pos(i,1)==Pos(j,1)+1 & Pos(i,2)==Pos(j,2))
    0048         Collisions =   Collisions + 1;
    0049      end
    0050      if (Pos(i,1)==Pos(j,1) & Pos(i,2)==Pos(j,2)+1)
    0051         Collisions =   Collisions + 1;
    0052      end
    0053      if (Pos(i,1)==Pos(j,1)-1 & Pos(i,2)==Pos(j,2))
    0054         Collisions =   Collisions + 1;
    0055      end
    0056     end
    0057   end
    0058  end
    0059
    0060
    0061
    0062
    0063
    0064
    0065