% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/trans_TOM_in_WGCNA.R
\name{trans_TOM_in_WGCNA}
\alias{trans_TOM_in_WGCNA}
\title{Translate TOM matrin to create graph object}
\usage{
trans_TOM_in_WGCNA(TOM, mat, threshold = NULL, top_k = NULL)
}
\arguments{
\item{TOM}{matrix
TOM matrix from WGCNA result}

\item{mat}{matrix
matrox to WGCNA analysis}

\item{threshold}{numeric
Absolute-weight cutoff.  Edges with \code{abs(weight) <= threshold}
are dropped.  Set to \code{NULL} (default) to skip.}

\item{top_k}{integer
Per-node top-\code{k} nearest-neighbour sparsification.  For each
node, only its \code{k} strongest TOM neighbours are eligible to
contribute edges.  An undirected edge (i, j) survives if j is in
i's top-\code{k} \strong{or} i is in j's top-\code{k}
(mutual-kNN \emph{union}, the standard choice for WGCNA
visualization).  Set to \code{NULL} (default) to skip.  Typical
values for WGCNA plots are 10 - 30.}
}
\value{
A Data frame contain from, to and weight
}
\description{
Translate TOM matrin to create graph object
}
\examples{
\dontrun{
# `TOM` is a topological overlap matrix from WGCNA and `mat` is the
# expression matrix used to compute it.

# Simple absolute-weight threshold:
edge_df <- trans_TOM_in_WGCNA(TOM = TOM, mat = mat, threshold = 0.1)

# Per-node top-20 neighbours (recommended for visualization):
edge_df <- trans_TOM_in_WGCNA(TOM = TOM, mat = mat, top_k = 20)

# Combine: top-20 per node, then drop anything below 0.05 globally.
edge_df <- trans_TOM_in_WGCNA(TOM = TOM, mat = mat,
                              threshold = 0.05, top_k = 20)
head(edge_df)
}
}
