Skip to content

Commit 927a789

Browse files
authored
Merge pull request #126 from ginkgobioworks/gfa-diff-command
Add command to call gfa diff
2 parents a398e7e + 2e7dd8b commit 927a789

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

src/main.rs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use gen::config;
44
use gen::config::{get_gen_dir, get_operation_connection};
55

66
use gen::annotations::gff::propagate_gff;
7+
use gen::diffs::gfa::gfa_sample_diff;
78
use gen::exports::fasta::export_fasta;
89
use gen::exports::genbank::export_genbank;
910
use gen::exports::gfa::export_gfa;
@@ -319,6 +320,21 @@ enum Commands {
319320
#[arg(long)]
320321
region: Option<String>,
321322
},
323+
/// Output a file representing the "diff" between two samples
324+
Diff {
325+
/// The name of the collection to diff
326+
#[arg(short, long)]
327+
name: Option<String>,
328+
/// The name of the first sample to diff
329+
#[arg(long)]
330+
sample1: Option<String>,
331+
/// The name of the second sample to diff
332+
#[arg(long)]
333+
sample2: Option<String>,
334+
/// The name of the output GFA file
335+
#[arg(long)]
336+
gfa: String,
337+
},
322338
}
323339

324340
fn main() {
@@ -914,5 +930,22 @@ fn main() {
914930
&sequence[start_coordinate as usize..end_coordinate as usize]
915931
);
916932
}
933+
Some(Commands::Diff {
934+
name,
935+
sample1,
936+
sample2,
937+
gfa,
938+
}) => {
939+
let name = &name
940+
.clone()
941+
.unwrap_or_else(|| get_default_collection(&operation_conn));
942+
gfa_sample_diff(
943+
&conn,
944+
name,
945+
&PathBuf::from(gfa),
946+
sample1.as_deref(),
947+
sample2.as_deref(),
948+
);
949+
}
917950
}
918951
}

0 commit comments

Comments
 (0)