clear all;
viru = fastaread('D:\Files\Second year\paper\training\Virulent_delet.fasta');
viru_frequency = zeros(length(viru),256);
load kmer_order
for i = 1:length(viru)
    viru_kmer = nmercount(viru(i).Sequence,4);
    kmer_order_seq = strings();
    for k = 1:length(viru_kmer)
        kmer_order_seq(k,1) =  char(viru_kmer{k,1});
    end
    for j = 1:length(viru_kmer)
        index1 = find(strcmp(kmer_order, viru_kmer{j,1}));
        viru_frequency(i,index1) =  viru_kmer{j,2};
    end
end

for i = 1:size(viru_frequency,1)
    viru_frequency(i,:) = viru_frequency(i,:)./sum(viru_frequency(i,:));
end
save viru_frequency viru_frequency

clear all;
temp = fastaread('D:\Files\Second year\paper\training\Temperate.fasta');
temp_frequency = zeros(length(temp),256);
load kmer_order
for i = 1:length(temp)
    temp_kmer = nmercount(temp(i).Sequence,4);
    kmer_order_seq = strings();
    for k = 1:length(temp_kmer)
        kmer_order_seq(k,1) =  char(temp_kmer{k,1});
    end
    for j = 1:length(temp_kmer)
        index1 = find(strcmp(kmer_order, temp_kmer{j,1}));
        temp_frequency(i,index1) =  temp_kmer{j,2};
    end
end

for i = 1:size(temp_frequency,1)
    temp_frequency(i,:) = temp_frequency(i,:)./sum(temp_frequency(i,:));
end
save temp_frequency temp_frequency

