1use std::fs;
2
3use camino::{Utf8Path, Utf8PathBuf};
4use serde::Deserialize;
5
6mod samplesheet;
7mod xenium;
8
9#[derive(Deserialize)]
10pub struct AppConfig {
11 pub samplesheet: samplesheet::config::Config,
12 pub xenium: xenium::config::Config,
13}
14
15impl AppConfig {
16 pub fn read_toml_file(path: &Utf8Path) -> anyhow::Result<Self> {
17 Ok(toml::from_str(&fs::read_to_string(path)?)?)
18 }
19}
20
21pub async fn stage_xenium_data(
22 config: &xenium::config::Config,
23 data_dirs: &[Utf8PathBuf],
24 skip_confirm: bool,
25) -> anyhow::Result<()> {
26 xenium::stage_data(config, data_dirs, skip_confirm).await
27}
28
29pub fn write_samplesheet(
30 config: &samplesheet::config::Config,
31 fastq_paths: &[Utf8PathBuf],
32 tracking_sheet_dir: &Utf8Path,
33 output_path: &Utf8Path,
34) -> anyhow::Result<()> {
35 samplesheet::write(config, fastq_paths, tracking_sheet_dir, output_path)
36}