% SEND:
% --- P:     protein sequence
% --- DFTi:  list of FTs found on the protein.

% DO:
% --- according to the locations of all FT, calculate the effective length the coverage

% GET:
% --- N: number of FTs
% --- TC: the total effective coverage in AA
% --- RC: TC / length


function RC = get_RC(P, DFTi)

Nft = length(DFTi);
if Nft > 0
    loc = [];
    %  go over the FTs, aggregate their location and sort them
    for i = 1:Nft

        % locations
        tmp = strfind(P, DFTi{i});
        loc = [loc tmp];
        clear tmp
    end
    loc = sort(loc);

    % claculate coverage according to the locations
    Nl = length(loc);
    C = 3;
    for i = 1:Nl-1

        delta = loc(i+1) - loc(i);
        addletter = min(delta,3);
        C = C + addletter;

    end
    TC = C;
    RC = C/length(P);
else
    RC = 0;
    TC = 0;
end
