% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/plotSankey.R
\name{plotSankey}
\alias{plotSankey}
\title{Feature Flow Diagram: Omics Layer to Biomarkers to Outcome}
\usage{
plotSankey(result, n_features = 10L, colours = NULL, node_width = 0.15)
}
\arguments{
\item{result}{A \code{\link{MOBResult}} object from
\code{\link{MultiOmicsBridgeAnalysis}}.}

\item{n_features}{An \code{integer(1)} number of top features to
display per omics layer. Default: \code{10}.}

\item{colours}{A named \code{character} vector with colours for
\code{"host"}, \code{"microbiome"}, and each outcome level.
If \code{NULL}, defaults are used.}

\item{node_width}{A \code{numeric(1)} width of the node rectangles.
Default: \code{0.15}.}
}
\value{
A \code{ggplot2} object.
}
\description{
Produces a Sankey-style flow diagram showing the pipeline from data
source (host or microbiome) through selected top biomarkers to
predicted outcome classes. The width of each connection is proportional
to the feature's loading score, making it easy to see which features
contribute most to separating the outcome groups. The diagram uses
base \code{ggplot2} geometry (no additional Sankey packages required).
}
\examples{
library(S4Vectors)
set.seed(42)
scores <- matrix(rnorm(20), nrow = 10, ncol = 2,
    dimnames = list(paste0("S", 1:10), c("Comp1","Comp2")))
fl <- list(
    host = matrix(abs(rnorm(20)), nrow = 10, ncol = 2,
        dimnames = list(paste0("Gene", 1:10), c("Comp1","Comp2"))),
    microbiome = matrix(abs(rnorm(10)), nrow = 5, ncol = 2,
        dimnames = list(paste0("Taxon", 1:5), c("Comp1","Comp2")))
)
bm <- DataFrame(
    feature = c(paste0("Gene", 1:5), paste0("Taxon", 1:3)),
    omics_layer = c(rep("host", 5), rep("microbiome", 3)),
    loading_score = c(0.9, 0.7, 0.5, 0.4, 0.3, 0.8, 0.6, 0.2),
    rank = 1:8, component = rep(1L, 8)
)
obj <- MOBResult(scores, fl, bm, list(),
    params = list(outcome_levels = c("ctrl","treat")))
plotSankey(obj, n_features = 5)

}
\seealso{
\code{\link{MultiOmicsBridgeAnalysis}},
  \code{\link{plotIntegration}}, \code{\link{plotBiomarkerNetwork}}
}
