function OUT_DATA=CalculateProteinEntropy(Ref, ALIGN_CELL) OUT_DATA = cell(size(ALIGN_CELL)); for i = 1:size(ALIGN_CELL,1) aligned_seqs = ALIGN_CELL{i}; ref_seq = Ref.Sequence; ref_prof = seqprofile(ref_seq, 'alphabet', 'aa'); seqs_prof = seqprofile(aligned_seqs, 'alphabet', 'aa'); [mp, H1, H2] = profalign(ref_prof, seqs_prof); merged_seqs = char(zeros(size(aligned_seqs,1)+1, size(mp,2))); merged_seqs(2:end, H2) = aligned_seqs; merged_seqs(1, H1) = ref_seq; entropy_vals = CalculateEntropy(merged_seqs); %only pull out the values that are in the reference positions ref_entropy = entropy_vals(H1); OUT_DATA{i} = ref_entropy; end