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

# HP_repairing

## PURPOSE

[NewPop] = HP_repairing(Pop,Card,repairing_params)

## SYNOPSIS

function[NewPop] = HP_repairing(Pop,Card,repairing_params)

## DESCRIPTION

     [NewPop] =  HP_repairing(Pop,Card,repairing_params)
     HP_repairing:   Modifies a sequence configuration to avoid self-intersections
     INPUTS
     Pop: Population in which each vector corresponds to a relative position of a residue
          in a grid
     Card: Cardinality of the variables
     repairing_params: Repairing params are not used
     OUTPUTS
     s:  Sequence of residues repaired (without self-intersections)

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

## CROSS-REFERENCE INFORMATION

This function calls:

- HP_newrepairing HP_newrepairing: An auxiliary function that modifies a sequence configuration to avoid self-intersections

This function is called by:

## SOURCE CODE

    0001 function[NewPop] =  HP_repairing(Pop,Card,repairing_params)
    0002 % [NewPop] =  HP_repairing(Pop,Card,repairing_params)
    0003 % HP_repairing:   Modifies a sequence configuration to avoid self-intersections
    0004 % INPUTS
    0005 % Pop: Population in which each vector corresponds to a relative position of a residue
    0006 %      in a grid
    0007 % Card: Cardinality of the variables
    0008 % repairing_params: Repairing params are not used
    0009 % OUTPUTS
    0010 % s:  Sequence of residues repaired (without self-intersections)
    0011 %
    0012 % Last version 8/26/2008. Roberto Santana (roberto.santana@ehu.es)
    0013 global HPInitConf;
    0014
    0015 PopSize = size(Pop,1);
    0016 sizeChain = size(Pop,2);
    0017
    0018 for j=1:PopSize
    0019  Pos = zeros(sizeChain,2);
    0020
    0021  Pos(1,1) = 0;  %Position for the initial molecule
    0022  Pos(1,2) = 0;
    0023
    0024  Pos(2,1) = 1;  %Position for the second molecule
    0025  Pos(2,2) = 0;
    0026
    0027   for i=1:sizeChain
    0028    moves(i,:) = randperm(3)-1;
    0029   end
    0030   moves = [Pop(j,:)',moves];
    0031   s = [];
    0032
    0033   [SolutionFound,NewPop(j,:)] = HP_newrepairing(sizeChain,Pos,1,moves,s,Pop(j,:));
    0034   %NewPop(j,[1,2]) = [0,0];
    0035   clear moves;
    0036 end