Skip to content
Permalink
master
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time
function [colored_string] = getColored(given_string, oligoLen)
% GETCOLORED
% Colors the given string (DNA motif) using the IUPAC color scheme for the nucleotides A, C, G, T.
%
% INPUT PARAMS
% Param 'given_string'
% The DNA oligomer
%
% Param 'oligoLen'
% Length of the oligomer
%
% OUTPUT PARAMS
% Param 'colored_string'
% String with each DNA sequence character appropriately colored according to the IUPAC scheme
%
% ADDITIONAL NOTES
%
%
% Author: snikumbh@mpi-inf.mpg.de
given_string = char(given_string);
alphabet = upper('acgt');
colored_string = [];
for i=1:size(given_string, 2)
% i iterates over the number of characters in the string
if isscalar(given_string(1,i))
if oligoLen~= 0 && i == oligoLen+1
colored_string = strcat(colored_string, '\color{black}|');
end
switch(given_string(1,i))
case 'A'
colored_string = [colored_string strcat('\color[rgb]{0 0.5 0}', given_string(1,i))];
case 'C'
colored_string = [colored_string strcat('\color{blue}', given_string(1,i))];
case 'G'
colored_string = [colored_string strcat('\color{orange}', given_string(1,i))];
case 'T'
colored_string = [colored_string strcat('\color{red}', given_string(1,i))];
end
end
end
end