\HeaderA{findSubComp}{A function that looks for either equality between two complexes
or complete containment of one complex in another}{findSubComp}
\keyword{datagen}{findSubComp}
\keyword{array}{findSubComp}
\begin{Description}\relax
This function determines if either a complex C-i of bg1 is equal to
some complex K-j of bg2 or if a complex C-i (or K-j) is a subcomplex
to K-j (or C-i).
\end{Description}
\begin{Usage}
\begin{verbatim}
findSubComp(bg1, bg2, interSectMat, simMat)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{bg1}] The first bipartite graph matrix
\item[\code{bg2}] The second bipartite graph matrix; bg2 may be equal to bg1
\item[\code{interSectMat}] A matrix whose rows and columns are indexed by
protein complexes: the rows are indexed by complexes of bg1
(colnames of bg1) and the columns indexed by complexes of bg2
(colnames of bg2). The (i,j) entries is the cardinality of the
intersection between the i-th complex of bg1 and the j-th complex
of bg2.
\item[\code{simMat}] A matrix of similarity measures (e.g. Jaccard Index)
between two bipartite graphs where the rows are indexed by complexes
of the first bipartite graph, bg1, and the columns are indexed by the
complexes of the second bipartite graph, bg2. The (i,j) entry of this
matrix would be the similarity between C-i of bg1 and K-j of bg2.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
This function uses interSectMat and simMat to determine which
complexes C-i of bg1 is equal to which complexes K-j of bg2. When the
function finds an equality, C-i = K-j, it produces 5 statistics:

1. The name of C-i
2. The name of K-j
3. The cardinality of C-i
4. The cardinality of K-j
5. The cardinality of (C-i intersect K-j)

When all the equality of complexes have been found, this function also
uses interSectMat and simMat to find which complexes C-i (or K-j)
completely contain complexes K-n (or C-m respectively), i.e. which
complexes are subcomplexes. It also returns the 5 statistics listed
above.

NB - from the 5 statistics above, it will be clear if the relationship
between the complexes is that of equality or sub-ordination.
\end{Details}
\begin{Value}
\begin{ldescription}
\item[\code{record1}] A list of lists. The value of each sublist is: 1. a
complex of bg1, 2. a complex of bg2, 3. the cardinality of the
complex of bg1, 4. the cardinality of the complex of bg2, 5. the
cardinality of these two complexes mutual intersection.
\item[\code{record3}] A list of lists. The value of each sublist is: 1. a
complex of bg1, 2. a complex of bg2, 3. the cardinality of the
complex of bg1, 4. the cardinality of the complex of bg2, 5. the
cardinality of these two complexes mutual intersection.
\item[\code{toBeRm1}] A character vector of the names of complexes in bg1
that equal some complex in bg2. These complexes should be deleted to
avoid redundancy if these two bipartite graphs are merged.
\item[\code{toBeRm2}] A character vector of the names of complexes from
either bg1 or bg2 which are sub-complexes of another protein complex.
\end{ldescription}
\end{Value}
\begin{Author}\relax
Tony Chiang
\end{Author}
\begin{Examples}
\begin{ExampleCode}
#go = getGOInfo()
#mips = getMipsInfo()
#goM = createGOMatrix(go)
#mipsM = createMipsMatrix(mips)
#cc = runCompareComplex(mipsM, goM, byWhich = "ROW")

\end{ExampleCode}
\end{Examples}

