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