% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/export.R
\name{export_cytoscape}
\alias{export_cytoscape}
\title{Export a fancy result for Cytoscape}
\usage{
export_cytoscape(
  fancy_result,
  taxonomy,
  file_prefix = "fancy_network",
  edges = "thresholded"
)
}
\arguments{
\item{fancy_result}{An object of class \code{"fancy"} as returned by
\code{\link[=fancy]{fancy()}}.}

\item{taxonomy}{A data.frame with MAG IDs as row names and at least a
\code{Phyla} column. Additional taxonomy ranks (Domain, Class, Order,
Family, Genus, Species) are included when present.}

\item{file_prefix}{Character; path prefix for the output files
(default \code{"fancy_network"}). Two files are written:
\verb{\{prefix\}_edges.tsv} and \verb{\{prefix\}_nodes.tsv}.}

\item{edges}{Character; which edge set to export. \code{"thresholded"}
(default) uses \code{fancy_result$edges}; \code{"all"} uses
\code{fancy_result$all_edges}.}
}
\value{
Invisibly, a list with elements \verb{$nodes} and \verb{$edges}
(data.frames matching the written files).
}
\description{
Writes node and edge tables as tab-separated files suitable for import
into Cytoscape. The node table includes taxonomy columns and a hex
colour derived from \code{\link[=phyla_palette]{phyla_palette()}}.
}
\examples{
mock <- structure(list(
  edges = data.frame(
    source = c("MAG1", "MAG2"), target = c("MAG2", "MAG3"),
    HybridScore = c(0.9, 0.7)
  )
), class = "fancy")
tax <- data.frame(
  Phyla = c("Bacillota", "Pseudomonadota", "Bacteroidota"),
  Genus = c("Genus_A", "Genus_B", "Genus_C"),
  row.names = c("MAG1", "MAG2", "MAG3")
)
out <- export_cytoscape(mock, tax,
                        file_prefix = file.path(tempdir(), "ex"))
head(out$edges)
}
