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

# PutMoveAtPos

## PURPOSE

PutMoveAtPos: updates the lattice given a mov

## SYNOPSIS

function[Pos] = PutMoveAtPos(Pos,pos,mov)

## DESCRIPTION

     PutMoveAtPos:    updates the lattice given a mov
     INPUTS
     sizeChain: Size of the subchain inspected
     pos: Position of the residue in the sequence
     mov: Corresponding move (left,front,right)
     OUTPUTS
     Pos: Final configuration of the sequence

## CROSS-REFERENCE INFORMATION

This function calls:

This function is called by:

- CheckConstraint [Overlappings,Pos] = CheckConstraint(Pos,pos,vector)
- EvalChain [Collisions,Overlappings,Pos] = EvalChain(vector)
- HP_newrepairing HP_newrepairing: An auxiliary function that modifies a sequence configuration to avoid self-intersections

## SOURCE CODE

    0001 function[Pos] = PutMoveAtPos(Pos,pos,mov)
    0002 % PutMoveAtPos:    updates the lattice given a mov
    0003 % INPUTS
    0004 % sizeChain: Size of the subchain inspected
    0005 % pos: Position of the residue in the sequence
    0006 % mov: Corresponding move (left,front,right)
    0007 % OUTPUTS
    0008 % Pos: Final configuration of the sequence
    0009
    0010 if (pos<3)
    0011  return;
    0012 end
    0013
    0014 i = pos;
    0015
    0016  if(Pos(i-1,2)==Pos(i-2,2))
    0017   if (mov==0)            %UP MOVE
    0018    Pos(i,1) = Pos(i-1,1);
    0019    Pos(i,2) = Pos(i-1,2) + (Pos(i-1,1)-Pos(i-2,1));
    0020   elseif (mov==1)        %FORWARD MOVE
    0021    Pos(i,1) = Pos(i-1,1) + (Pos(i-1,1)-Pos(i-2,1));
    0022    Pos(i,2) = Pos(i-1,2);
    0023   else                         %DOWN MOVE
    0024    Pos(i,1) = Pos(i-1,1);
    0025    Pos(i,2) = Pos(i-1,2) - (Pos(i-1,1)-Pos(i-2,1));
    0026   end
    0027   end
    0028 if (Pos(i-1,1)==Pos(i-2,1))
    0029   if (mov==0)            %UP MOVE
    0030     Pos(i,2) = Pos(i-1,2);
    0031     Pos(i,1) = Pos(i-1,1) -  (Pos(i-1,2)-Pos(i-2,2));
    0032   elseif (mov==1)        %FORWARD MOVE
    0033     Pos(i,2) = Pos(i-1,2) +  (Pos(i-1,2)-Pos(i-2,2));
    0034     Pos(i,1) = Pos(i-1,1);
    0035   else                         %DOWN MOVE
    0036     Pos(i,2) = Pos(i-1,2);
    0037     Pos(i,1) = Pos(i-1,1) + (Pos(i-1,2)-Pos(i-2,2));
    0038   end
    0039  end
    0040
    0041
    0042 % Last version 10/09/2005. Roberto Santana (rsantana@si.ehu.es)