% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/gripui-project.R
\name{gripui_project_from_dir}
\alias{gripui_project_from_dir}
\title{Create a `gripui_project` from a directory of saved artifacts}
\usage{
gripui_project_from_dir(root, graph = NULL, title = NULL, subtitle = NULL)
}
\arguments{
\item{root}{Directory containing either a normalized `gripui` bundle or a
saved search output tree such as the current HMP/U01 layout-selection
outputs. The normalized bundle format is the preferred long-term producer
contract; support for HMP-style run tables and manifests is a compatibility
adapter for older outputs.}

\item{graph}{Optional graph object, named graph list, or path to a graph RDS.}

\item{title}{Optional project title.}

\item{subtitle}{Optional subtitle.}
}
\value{
A `gripui_project`.
}
\description{
Create a `gripui_project` from a directory of saved artifacts
}
\examples{
root <- tempfile("gripui-bundle-")
dir.create(root)
on.exit(unlink(root, recursive = TRUE, force = TRUE), add = TRUE)
dir.create(file.path(root, "catalog"), recursive = TRUE, showWarnings = FALSE)
dir.create(file.path(root, "graph"), recursive = TRUE, showWarnings = FALSE)
dir.create(file.path(root, "artifacts", "layouts"), recursive = TRUE, showWarnings = FALSE)

graph <- list(adj_list = list(2L, c(1L, 3L), 2L))
saveRDS(graph, file.path(root, "graph", "graph.rds"))

coords.path <- file.path(root, "artifacts", "layouts", "toy_embedding.tsv")
utils::write.table(
  data.frame(
    vertex_id = c("v1", "v2", "v3"),
    x = c(1, 2, 3),
    y = c(0, 0, 0),
    stringsAsFactors = FALSE
  ),
  file = coords.path,
  sep = "\t",
  quote = TRUE,
  row.names = FALSE,
  col.names = TRUE
)
utils::write.table(
  data.frame(
    candidate = "toy.layout",
    stage = "bundle",
    seed = 1L,
    status = "ok",
    coords_path = file.path("artifacts", "layouts", "toy_embedding.tsv"),
    stringsAsFactors = FALSE
  ),
  file = file.path(root, "catalog", "layout_catalog.tsv"),
  sep = "\t",
  quote = TRUE,
  row.names = FALSE,
  col.names = TRUE
)

project <- gripui_project_from_dir(root, title = "My project")
project$layouts$availability
}
