Skip to content

Commit

Permalink
Merge branch 'optimize-display'
Browse files Browse the repository at this point in the history
  • Loading branch information
pierrepeterlongo committed Nov 6, 2024
2 parents 423cd83 + ad4b798 commit 231b0f2
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 13 deletions.
Binary file modified paper/paper.pdf
Binary file not shown.
5 changes: 4 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,10 @@ pub fn back_to_multiple_sequences(
.unwrap();

if input_files.len() != output_files.len() {
anyhow::bail!("Error: the number of input files and output files must be the same");
// anyhow::bail!("The number of input files and output files must be the same");
eprintln!("Error: the number of input files and output files must be the same");
// exit the program
std::process::exit(1);
}

let (kmer_set, kmer_size) = kmer_hash::index_kmers::<RelaxedCounter>(
Expand Down
14 changes: 9 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ fn main() -> anyhow::Result<()> {

// If out_sequences and out_kmers are not provided, we do nothing, we can quit
if args.out_sequences.is_empty() && args.out_filelist.is_empty() && args.out_kmers.is_empty() {
anyhow::bail!("no output file provided, nothing to do");
eprintln!("Error: no output file provided, nothing to do");
std::process::exit(1);
}

// If out_kmers is not provided but output_kmer_positions is true, warn that it has no effect
Expand All @@ -42,18 +43,21 @@ fn main() -> anyhow::Result<()> {
}

if args.min_threshold > args.max_threshold {
anyhow::bail!("--min-threshold must be <= --max-threshold");
eprintln!("Error: --min-threshold must be <= --max-threshold");
std::process::exit(1);
}

if args.in_sequences.is_empty() && !args.in_filelist.is_empty() {
if args.out_filelist.is_empty() {
anyhow::bail!("--in-filelist requires --out-filelist");
eprintln!("Error: --in-filelist requires --out-filelist");
std::process::exit(1);
}

if args.output_kmer_positions {
anyhow::bail!(
"--in-filelist and --output-kmer-positions are mutually exclusive (for now)"
eprintln!(
"Error: --in-filelist and --output-kmer-positions are mutually exclusive (for now)"
);
std::process::exit(1);
}
back_to_multiple_sequences(
args.in_filelist,
Expand Down
14 changes: 7 additions & 7 deletions tests/functional.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ kmers with their number of occurrences in the original sequences are in file {}
kmers_out_path.display(),
);

let assert = cmd.assert().stdout(out);
let assert = cmd.assert().stderr(out);

assert.success();

Expand Down Expand Up @@ -273,7 +273,7 @@ kmers with their number of occurrences in the original sequences are in file {}
kmers_out_path.display(),
);

let assert = cmd.assert().stdout(out);
let assert = cmd.assert().stderr(out);

assert.success();

Expand Down Expand Up @@ -330,7 +330,7 @@ kmers with their number of occurrences in the original sequences are in file {}
kmers_out_path.display(),
);

let assert = cmd.assert().stdout(out);
let assert = cmd.assert().stderr(out);

assert.success();

Expand Down Expand Up @@ -396,7 +396,7 @@ kmers with their number of occurrences in the original sequences are in file {}
kmers_out_path.display(),
);

let assert = cmd.assert().stdout(out);
let assert = cmd.assert().stderr(out);

assert.success();

Expand Down Expand Up @@ -446,7 +446,7 @@ fn multi_inout_not_same_length() -> std::result::Result<(), anyhow::Error> {

let assert = cmd
.assert()
.stderr("Error: Error: the number of input files and output files must be the same\n");
.stderr("Error: the number of input files and output files must be the same\n");

assert.failure();

Expand Down Expand Up @@ -513,7 +513,7 @@ kmers with their number of occurrences in the original sequences are in file {}
kmers_out_path.display(),
);

let assert = cmd.assert().stdout(out);
let assert = cmd.assert().stderr(out);

assert.success();

Expand Down Expand Up @@ -601,7 +601,7 @@ kmers with their number of occurrences in the original sequences are in file {}
kmers_out_path.display(),
);

let assert = cmd.assert().stdout(out);
let assert = cmd.assert().stderr(out);

assert.success();

Expand Down

0 comments on commit 231b0f2

Please sign in to comment.