The function calculates the conformity based approximation `A.CF`

of an adjacency matrix and a factorizability measure codeFactorizability. If a module assignment `Cl`

is provided, it also estimates a corresponding intermodular adjacency matrix. In this case, function automatically carries out the module- and conformity based decomposition of the adjacency matrix described in chapter 2 of (Horvath 2011).

1 | ```
conformityDecomposition(adj, Cl = NULL)
``` |

`adj` |
a symmetric numeric matrix (or data frame) whose entries lie between 0 and 1. |

`Cl` |
a vector (or factor variable) of length equal to the number of rows of |

We distinguish two situation depending on whether or not `Cl`

equals `NULL`

.
1) Let us start out assuming that `Cl = NULL`

. In this case,
the function calculates the conformity vector for a general, possibly non-factorizable network `adj`

by minimizing a quadratic (sums of squares) loss function. The conformity and factorizability for an adjacency matrix is defined in (Dong and Horvath 2007, Horvath and Dong 2008) but we briefly describe it in the following. A network is called exactly factorizable if the pairwise connection strength (adjacency) between 2 network nodes can be factored into node specific contributions, named node 'conformity', i.e. if `adj[i,j]=Conformity[i]*Conformity[j]`

. The conformity turns out to be highly related to the network connectivity (aka degree). If `adj`

is not exactly factorizable, then the function `conformityDecomposition`

calculates a conformity vector of the exactly factorizable network that best approximates `adj`

. The factorizability measure `Factorizability`

is a number between 0 and 1. The higher `Factorizability`

, the more factorizable is `adj`

. Warning: the algorithm may only converge to a local optimum and it may not converge at all. Also see the notes below.

2) Let us now assume that `Cl`

is not NULL, i.e. it specifies the module assignment of each node.
Then the function calculates a module- and CF-based approximation of `adj`

(explained in chapter 2 in Horvath 2011). In this case, the function calculates a conformity vector `Conformity`

and a matrix `IntermodularAdjacency`

such that `adj[i,j]`

is approximately equal to
`Conformity[i]*Conformity[j]*IntermodularAdjacency[module.index[i],module.index[j]]`

where `module.index[i]`

is the row of the matrix `IntermodularAdjacency`

that corresponds to the module assigned to node i.
To estimate `Conformity`

and a matrix `IntermodularAdjacency`

, the function attempts to minimize a quadratic loss function (sums of squares).
Currently, the function only implements a heuristic algorithm for optimizing the objective function (chapter 2 of Horvath 2011). Another, more accurate Majorization Minorization (MM) algorithm for the decomposition is implemented in the function `propensityDecomposition`

by Ranola et al (2011).

`A.CF` |
a symmetric matrix that approximates the input matrix |

`Conformity` |
a numeric vector whose entries correspond to the rows of codeadj. If |

`IntermodularAdjacency` |
a symmetric matrix (data frame) whose rows and columns correspond to the number of modules specified in |

`Factorizability` |
is a number between 0 and 1. If |

`Cl.level` |
is a vector of character strings which correspond to the factor levels of the module assignment |

`IntramodularFactorizability` |
is a numeric vector of length equal to the number of modules specified by |

`listConformity` |

Regarding the situation when `Cl=NULL`

.
One can easily show that the conformity vector is not unique if `adj`

contains only 2 nodes. However, for more than 2 nodes the conformity is uniquely defined when dealing with an exactly factorizable weighted network whose entries `adj[i,j]`

are larger than 0. In this case, one can get explicit formulas for the conformity (Dong and Horvath 2007).

Steve Horvath

Dong J, Horvath S (2007) Understanding Network Concepts in Modules. BMC Systems Biology 2007, June 1:24 Horvath S, Dong J (2008) Geometric Interpretation of Gene Co-Expression Network Analysis. PloS Computational Biology. 4(8): e1000117. PMID: 18704157 Horvath S (2011) Weighted Network Analysis. Applications in Genomics and Systems Biology. Springer Book. ISBN: 978-1-4419-8818-8 Ranola JMO, Langfelder P, Song L, Horvath S, Lange K (2011) An MM algorithm for the module- and propensity based decomposition of a network. Currently a draft.

`conformityBasedNetworkConcepts`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ```
# assume the number of nodes can be divided by 2 and by 3
n=6
# here is a perfectly factorizable matrix
A=matrix(1,nrow=n,ncol=n)
# this provides the conformity vector and factorizability measure
conformityDecomposition(adj=A)
# now assume we have a class assignment
Cl=rep(c(1,2),c(n/2,n/2))
conformityDecomposition(adj=A,Cl=Cl)
# here is a block diagonal matrix
blockdiag.A=A
blockdiag.A[1:(n/3),(n/3+1):n]=0
blockdiag.A[(n/3+1):n , 1:(n/3)]=0
block.Cl=rep(c(1,2),c(n/3,2*n/3))
conformityDecomposition(adj= blockdiag.A,Cl=block.Cl)
# another block diagonal matrix
blockdiag.A=A
blockdiag.A[1:(n/3),(n/3+1):n]=0.3
blockdiag.A[(n/3+1):n , 1:(n/3)]=0.3
block.Cl=rep(c(1,2),c(n/3,2*n/3))
conformityDecomposition(adj= blockdiag.A,Cl=block.Cl)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.