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

