Skip to contents

Given a network result object and a single GO term of interest, identifies which Leiden cluster that term belongs to and returns (and optionally writes) a data frame of all GO terms sharing that cluster. This is useful for inspecting the biological theme captured by a particular network community.

Usage

write_cluster_results(net_result, go_term, outdir, label = NULL)

Arguments

net_result

A list returned by generate_overlap_network, which must contain at least the element go_term_df.

go_term

Character string. The GO term description to look up (e.g., "extracellular matrix organization"). Hyphens are internally replaced with underscores to match network node naming conventions.

outdir

Character path to the output directory. If non-NULL, a CSV file is written. The directory is created if it does not exist.

label

Optional character label used in the output filename. If NULL, defaults to "cluster-<id>".

Value

A data frame containing all GO terms in the same Leiden cluster as go_term, with columns go_term, cluster, degree, regulation, avg_log2FC, and leiden_resolution. Returns NULL with a warning if the requested term is not found in the network.