maximizeSimilarity           package:ScISI           R Documentation

_A _f_u_n_c_t_i_o_n _c_o_m_p_a_r_e_s _t_w_o _b_i_p_a_r_t_i_t_e _g_r_a_p_h _m_a_t_r_i_c_e_s _a_n_d _f_i_n_d_s _t_h_e _m_o_s_t
_s_i_m_i_l_a_r _m_a_t_c_h_e_s _b_e_t_w_e_e_n _t_h_e _c_l_u_s_t_e_r_s

_D_e_s_c_r_i_p_t_i_o_n:

     This function takes a matrix of similarity indices between two
     bipartite graph matrices and determines, for each complex of the
     first bipartite graph matrix (bg1), the most similiar complexes of
     the second bipartite graph matrix (bg2).

_U_s_a_g_e:

     maximizeSimilarity(simMat, bywhich = "ROW", zeroSim = "NO")

_A_r_g_u_m_e_n_t_s:

  simMat: A matrix of similarity coefficients between two bipartite
          graph matrices (bg1 and bg2) where the rows are indexed by
          the first bipartite graph matrix and the colunms are indexed
          by the second bipartite graph matrix. The (i,j)th entry is
          the similarity index between complex i of bg1 and complex j
          of bg2.

 bywhich: Takes one of these three arguments: "ROW", "COL", "BOTH"

 zeroSim: Takes either one of the following arguments: "NO", "YES"

_D_e_t_a_i_l_s:

     This function's purpose is to take one (or both) bipartite graph
     matrix, wlog we take bg1, and, for each complex, C-i, of bg1,
     finds the complex(es) of bg2 that are the most similiar to C-i
     based on the similarity index. Since the complexes of bg1 is
     indexed by the rows of simMat argument, finding the complexes of
     bg2 that are the most similar to C-i means finding the maximal
     value, m, of row i and then the complexes, K-j, that index the
     colunm for which m belongs.

     If byWhich argument is set to "ROW", the function parses through
     each complex of bg1 and finds the complex(es) of bg2 which are
     most similar. If byWhich is set to "COL", the function parses
     through each complex of bg2 and finds the complex(es) of bg1 which
     are most similar. If byWhich is set to "BOTH", the function parses
     through both the complexes of bg1 and bg2. Since this matrix is
     not symmetric (this matrix is usually not square) this maximizing
     is different between row and column.

     If zeroSim argument is set to "NO", the only maximal matching
     occurs if the similarity index is nonzero; e.g. if we want to
     maximize the match for complex C-i of bg1, but row i is comprised
     only of 0, C-i will not be matched to any complex of bg2.

_V_a_l_u_e:

     The return value is a list consisting of a vector and a list: 

maximize: A named numeric vector. The name is the complex, C-i, for
          which the function is trying to find a maximal match. The
          entries of the vector is the maximal similarity index between
          C-i and all of the complexes of the other bipartite graph
          matrix, i.e. the maximal entry row i in 'simMat'.

 maxComp: A named list of named vectors. The name is the complex, C-i,
          for which the function is trying to find a maximal match. The
          named vector consists of the positions of the maximal matches
          (either which row or which column) and the names correspond
          to the conmplex of maximal matching.

_A_u_t_h_o_r(_s):

     Tony Chiang

_E_x_a_m_p_l_e_s:

     #go = getGOInfo(wantAllComplexes = FALSE)
     #mips = getMipsInfo(wantSubComplexes = FALSE)
     #goM = createGOMatrix(go)
     #mipsM = createMipsMatrix(mips)
     #cc = runCompareComplex(mipsM, goM, byWhich="ROW")
     #m = maximizeSimilarity(cc$JC, byWhich = "ROW")
     #m$maximize
     #m$maxComp

