function [common,exclusiveA,exclusiveB] = featurescomp(featuresA, featuresB) % compFeatures Compares features(continuous or discrete) in 2 proteins, A and B % featuresA [log(lengthA), %alphaHelices, %betaSheets, contactOrder] % common = A intersection B % exclusiveA = A-B % exclusiveB = B-A % ASSUMPTIONS % 1. length of featuresA = length of featuresB % Inputs: % 1. feature vector % 2. feature vector % Outputs: % common(i) = 1 if A intersect B = 1 % common(i) = 0 if A intersect B = 0 % common(i) = -1 if A intersect B = null l = length(featuresA); for i=1:l if(featuresA(i) == featuresB(i)) common(i) = featuresA(i); exclusiveA(i) = -1; exclusiveB(i) = -1; else common(i) = -1; exclusiveA(i) = featuresA(i); exclusiveB(i) = featuresB(i); end end %% Example %% >> featA = [1 1 1]; %% >> featB = [1 1 0]; %% >> [comm, A, B] = featurescomp(featA, featB); %% >> comm %% comm = %% 1 1 0 %% >> A %% A = %% 0 0 1 %% >> B %% B = %% 0 0 0