www.gusucode.com > DNA序列检测源码程序 > DNA序列检测源码程序/SVD/dna_binary.m

    % ------------------------------------------------ %
% ------ Prepared by : Ismail M. El-Badawy ------- %
% ------------------------------------------------ %

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  This function accepts dna sequence and convert  %
% ---- it to four binary indicator sequences ----- %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function [xA xT xC xG]=dna_binary(sample_dna)

for i=1:length(sample_dna)
    
    if sample_dna(i)=='A' || sample_dna(i)=='a'
        
        xA(i)=1;
        xT(i)=0;
        xC(i)=0;
        xG(i)=0;
        
    elseif sample_dna(i)=='T' || sample_dna(i)=='t'
        
        xA(i)=0;
        xT(i)=1;
        xC(i)=0;
        xG(i)=0;
        
    elseif sample_dna(i)=='C' || sample_dna(i)=='c'
        
        xA(i)=0;
        xT(i)=0;
        xC(i)=1;
        xG(i)=0;
        
    elseif sample_dna(i)=='G' || sample_dna(i)=='g'
        
        xA(i)=0;
        xT(i)=0;
        xC(i)=0;
        xG(i)=1;
    
    end
end

end