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

MakePajekGraphOfProtein

PURPOSE ^

[Pos] = MakePajekGraphOfProtein(vector)

SYNOPSIS ^

function[Pos] = MakePajekGraphOfProtein(vector,pajekfilename)

DESCRIPTION ^

 [Pos] =  MakePajekGraphOfProtein(vector)
 MakePajekGraphOfProtein:  Creates a graph in Pajek format corresponding to the configuration encoded by vector
 INPUTS
 vector: Sequence of residues ( (H)ydrophobic or (P)olar, respectively represented by zero and one)
 OUTPUTS
 Pos:    Position of the residues

 Last version 3/9/2009. Roberto Santana (roberto.santana@ehu.es)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function[Pos] =  MakePajekGraphOfProtein(vector,pajekfilename)
0002 % [Pos] =  MakePajekGraphOfProtein(vector)
0003 % MakePajekGraphOfProtein:  Creates a graph in Pajek format corresponding to the configuration encoded by vector
0004 % INPUTS
0005 % vector: Sequence of residues ( (H)ydrophobic or (P)olar, respectively represented by zero and one)
0006 % OUTPUTS
0007 % Pos:    Position of the residues
0008 %
0009 % Last version 3/9/2009. Roberto Santana (roberto.santana@ehu.es)
0010 
0011 
0012 global HPInitConf;
0013 
0014 [Collisions,Overlappings,Pos] =  EvalChain(vector);
0015 
0016 sizeChain = size(HPInitConf,2);
0017 
0018 Pos(:,1) = abs(min(Pos(:,1))) + Pos(:,1);
0019 Pos(:,2) = abs(min(Pos(:,2))) + Pos(:,2);
0020 
0021 Pos(:,1) = (Pos(:,1) / max(Pos(:,1)))*0.85 + 1/sizeChain;
0022 Pos(:,2) = (Pos(:,2) / max(Pos(:,2)))*0.85 + 1/sizeChain;
0023 
0024 fid = fopen(pajekfilename,'wt');
0025         fprintf(fid,'*Vertices %d \n', sizeChain); 
0026          for i=1:sizeChain,        
0027           auxstr = ['"v',num2str(i),'"'];   
0028           if(HPInitConf(i) == 0)
0029            auxstr1 = 'box ic Red fos 30';
0030           else    
0031            auxstr1 = 'ellipse ic Black fos 30';
0032           end
0033           fprintf(fid,'%d %s %d %d %s \n',i,auxstr,Pos(i,1),Pos(i,2),auxstr1);
0034          end,
0035      
0036      fprintf(fid,'*Edges %d \n', sizeChain-1); 
0037       for i=2:sizeChain,        
0038           fprintf(fid,'%d %d \n',i-1,i);
0039       end
0040       
0041   fclose(fid)
0042

Generated on Fri 04-Dec-2009 13:38:29 by m2html © 2003