function section2D = dssp2int(S);
% Convert a vector with 2D data from DSSP representation to integer representation
% Program by Steinar Thorvaldsen, november 2004.
% Use:
% section2D = dssp2int(S)

% S: Data from the DSSP database (characters)
% section2D: DSSP characters represented with numbers and three states:
%    1: alpha helix (H,G,I in DSSP notation)
%    2: beta sheet (E,B in DSSP)
%    3: loop (C,T,S in DSSP)
%    4: udetermined (gaps and unknown areas)

N=length(S(1,:))
section2D(1,N) = ones('uint8'); % ; section2D(1,N) = ones;
S=upper(S); %Convert string to uppercase
for n=1:N
    switch S(1,n)
        case {'H','G','I'} %Alpha helix
            section2D(1,n) = 1;
        case {'E','B'} %Beta sheet
            section2D(1,n) = 2;
        case {'T','S','C','L','Z'} %loop and irregular
            section2D(1,n) = 3;
        otherwise % Gaps and unknown areas
            section2D(1,n) = 4;
    end
end

