⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mismatchstringkernel.m

📁 Proteins _ String Kernel
💻 M
字号:
%Computes the string kernel for contiguous strings of length seqLength%between the strings in proteinStrings.%Arthur Grettonfunction [K_mismatch]=mismatchStringKernel(seqLength,proteinStrings);disp('Computing mismatch kernel...')totalStringNum =length(proteinStrings);sequenceFeatures = zeros(totalStringNum,26^seqLength);  %rows are data pointsfor l=1:totalStringNum  singleString = char(proteinStrings(l));  for m=1:length(singleString)-seqLength+1       %loop through substrings    substring=singleString(m:m+seqLength-1);    featureIndices = zeros(1,seqLength);     %terms that sum to the feature index                                             %of string "substring".    for n=1:seqLength      featureIndices(n) = featureIndices(n)+(substring(n)-'a')*26^(n-1);    end    %Generate all possible feature indices which result from the    %perturbation of ONE entry in the starting string    for n=1:seqLength      featureIndexBase = 1+ sum(featureIndices([1:n-1 n+1:seqLength]));      for p=0:25	featureIndex=featureIndexBase+p*26^(n-1);        sequenceFeatures(l,featureIndex)=sequenceFeatures(l,featureIndex)+1;      end    end  endl;endK_mismatch=sequenceFeatures*sequenceFeatures';

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -