function [Nall]=findCompartmentRelationship(E,epCmpt,uComp)
%[Nall]=findCompartmentRelationship(E,epCmpt,uComp)
% This function was written to calculate the number of aggravating,
% buffering, non-decisive, or no epistatic interactions occuring between
% any two compartments
%
% INPUT:
% E:    epistatic interaction matrix (scaled or non-scaled),according to
%       genes
% epCmpt:   compartments the genes were involved in, written as 2nd ordered
%           cell array
% uComp:    unique compartments present in the epCmpt
% OUTPUT:
% Nall: A structure that contains the matrices of type of interactions
%       between the compartments
        % neg:  aggravating interactions
        % zer:  no interactions
        % nd:   non-decisive interactions
        % pos:  buffering interactions
        % tot:  total interactions
%
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% % % % % Written By Chintan Joshi on 7/4/2014 % % % % % %
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % %

neg=zeros(length(uComp));
zer=zeros(length(uComp));
nd=zeros(length(uComp));
pos=zeros(length(uComp));
for i=1:length(uComp)
    for j=1:length(uComp)
        [neg(i,j),zer(i,j),nd(i,j),pos(i,j)]=findCompartmentInteractions(E,epCmpt,uComp,uComp(i,1),uComp(j,1));
    end
end
Nall.neg=sparse(neg);
Nall.zer=sparse(zer);
Nall.nd=sparse(nd);
Nall.pos=sparse(pos);
Nall.tot=sparse(neg+zer+nd+pos);