|
|
|
@ -21,20 +21,6 @@ use rolling_hash::RollingHasher;
|
|
|
|
|
#[derive(FromArgs, PartialEq, Debug)]
|
|
|
|
|
/// Strumento CLI per il progetto di Algoritmi e Strutture Dati 2024
|
|
|
|
|
struct CliTool {
|
|
|
|
|
#[argh(subcommand)]
|
|
|
|
|
nested: CliSubcommands,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(FromArgs, PartialEq, Debug)]
|
|
|
|
|
#[argh(subcommand)]
|
|
|
|
|
enum CliSubcommands {
|
|
|
|
|
Show(CommandShow),
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(FromArgs, PartialEq, Debug)]
|
|
|
|
|
/// Parse and show the content of a file
|
|
|
|
|
#[argh(subcommand, name = "show")]
|
|
|
|
|
struct CommandShow {
|
|
|
|
|
#[argh(option, short = 'i')]
|
|
|
|
|
/// file to read
|
|
|
|
|
input: String,
|
|
|
|
@ -55,8 +41,6 @@ struct CommandShow {
|
|
|
|
|
fn main() -> std::io::Result<()> {
|
|
|
|
|
let opts = argh::from_env::<CliTool>();
|
|
|
|
|
|
|
|
|
|
match opts.nested {
|
|
|
|
|
CliSubcommands::Show(opts) => {
|
|
|
|
|
// validate opts.pattern is a valid DNA sequence
|
|
|
|
|
if opts.pattern.chars().any(|c| !"ACGT".contains(c)) {
|
|
|
|
|
eprintln!("Invalid pattern: {:?}", opts.pattern);
|
|
|
|
@ -70,8 +54,7 @@ fn main() -> std::io::Result<()> {
|
|
|
|
|
.progress_with(indicatif::ProgressBar::new_spinner())
|
|
|
|
|
.count() as u64;
|
|
|
|
|
|
|
|
|
|
let entries =
|
|
|
|
|
gfa::parser::parse_source(std::fs::File::open(opts.input)?, file_lines_count)?;
|
|
|
|
|
let entries = gfa::parser::parse_source(std::fs::File::open(opts.input)?, file_lines_count)?;
|
|
|
|
|
|
|
|
|
|
println!("Number of entries: {}", entries.len());
|
|
|
|
|
|
|
|
|
@ -172,8 +155,6 @@ fn main() -> std::io::Result<()> {
|
|
|
|
|
|
|
|
|
|
println!("Cleaning up...");
|
|
|
|
|
process::exit(0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn compute_kmer_histogram_lb(
|
|
|
|
|