diff --git a/Cargo.lock b/Cargo.lock index b9c78d4..81ae73b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -417,7 +417,7 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "generic_a_star" -version = "3.0.0" +version = "4.0.0" dependencies = [ "binary-heap-plus", "compare", @@ -548,7 +548,7 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "lib_ts_chainalign" -version = "3.0.0" +version = "4.0.0" dependencies = [ "binary-heap-plus", "bincode", @@ -568,7 +568,7 @@ dependencies = [ [[package]] name = "lib_tsalign" -version = "3.0.0" +version = "4.0.0" dependencies = [ "binary-heap-plus", "compact-genome", @@ -589,7 +589,7 @@ dependencies = [ [[package]] name = "lib_tsshow" -version = "3.0.0" +version = "4.0.0" dependencies = [ "ena", "itertools", @@ -804,7 +804,7 @@ dependencies = [ [[package]] name = "py_lib_tsalign" -version = "3.0.0" +version = "4.0.0" dependencies = [ "compact-genome", "lib_tsalign", @@ -1008,7 +1008,7 @@ dependencies = [ [[package]] name = "seed_chain" -version = "3.0.0" +version = "4.0.0" dependencies = [ "compact-genome", "generic_a_star", @@ -1360,7 +1360,7 @@ checksum = "2b939c825d0c4295ac520f7b479927c1e5b458c9107a9d6f5ba65bc867bb93a5" [[package]] name = "tsalign" -version = "3.0.0" +version = "4.0.0" dependencies = [ "anyhow", "bincode", @@ -1381,7 +1381,7 @@ dependencies = [ [[package]] name = "tsalign-tests" -version = "3.0.0" +version = "4.0.0" dependencies = [ "anyhow", "clap", diff --git a/generic_a_star/Cargo.toml b/generic_a_star/Cargo.toml index 16487f9..9344796 100644 --- a/generic_a_star/Cargo.toml +++ b/generic_a_star/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "generic_a_star" description = "A generic implementation of the A* algorithm" -version = "3.0.0" +version = "4.0.0" edition.workspace = true rust-version.workspace = true license.workspace = true diff --git a/lib_ts_chainalign/Cargo.toml b/lib_ts_chainalign/Cargo.toml index db5aa21..d759cba 100644 --- a/lib_ts_chainalign/Cargo.toml +++ b/lib_ts_chainalign/Cargo.toml @@ -2,15 +2,15 @@ name = "lib_ts_chainalign" description = "A chaining-based sequence-to-sequence aligner that accounts for template switches" authors = ["Sebastian Schmidt "] -version = "3.0.0" +version = "4.0.0" license.workspace = true edition.workspace = true rust-version.workspace = true repository.workspace = true [dependencies] -generic_a_star = { version = "3.0.0", path = "../generic_a_star" } -lib_tsalign = { version = "3.0.0", path = "../lib_tsalign" } +generic_a_star = { version = "4.0.0", path = "../generic_a_star" } +lib_tsalign = { version = "4.0.0", path = "../lib_tsalign" } ndarray = { version = "0.17.1", features = ["serde"] } num-traits.workspace = true serde = { workspace = true, features = ["derive"] } diff --git a/lib_tsalign/Cargo.toml b/lib_tsalign/Cargo.toml index 0654247..cb9b2ce 100644 --- a/lib_tsalign/Cargo.toml +++ b/lib_tsalign/Cargo.toml @@ -2,7 +2,7 @@ name = "lib_tsalign" description = "A sequence-to-sequence aligner that accounts for template switches" authors = ["Sebastian Schmidt "] -version = "3.0.0" +version = "4.0.0" license.workspace = true edition.workspace = true rust-version.workspace = true @@ -26,9 +26,9 @@ thiserror = "2.0.3" num-traits.workspace = true serde = { workspace = true, features = ["derive"], optional = true } noisy_float = { version = "0.2.0" } -generic_a_star = { version = "3.0.0", path = "../generic_a_star" } +generic_a_star = { version = "4.0.0", path = "../generic_a_star" } log.workspace = true rustc-hash = "2.1.1" -seed_chain = { version = "3.0.0", path = "../seed_chain" } +seed_chain = { version = "4.0.0", path = "../seed_chain" } extend_map = "0.14.3" template-switch-error-free-inners = "0.1.1" diff --git a/lib_tsshow/Cargo.toml b/lib_tsshow/Cargo.toml index 91b59ce..04f7c91 100644 --- a/lib_tsshow/Cargo.toml +++ b/lib_tsshow/Cargo.toml @@ -3,13 +3,13 @@ name = "lib_tsshow" description = "A visualiser for template-switch alignments" license.workspace = true authors = ["Sebastian Schmidt "] -version = "3.0.0" +version = "4.0.0" edition.workspace = true rust-version.workspace = true repository.workspace = true [dependencies] -lib_tsalign = { version = "3.0.0", path = "../lib_tsalign" } +lib_tsalign = { version = "4.0.0", path = "../lib_tsalign" } log.workspace = true svg = "0.18.0" resvg = "0.45.0" diff --git a/python_bindings/Cargo.toml b/python_bindings/Cargo.toml index 5592ab0..fafb6ee 100644 --- a/python_bindings/Cargo.toml +++ b/python_bindings/Cargo.toml @@ -6,7 +6,7 @@ authors = [ "Sebastian Schmidt ", "Jasper Krauter ", ] -version = "3.0.0" +version = "4.0.0" edition.workspace = true rust-version.workspace = true repository.workspace = true @@ -18,10 +18,10 @@ crate-type = ["cdylib"] [dependencies] pyo3 = "0.26" -lib_tsalign = { version = "3.0.0", path = "../lib_tsalign", features = [ +lib_tsalign = { version = "4.0.0", path = "../lib_tsalign", features = [ "serde", ] } -lib_tsshow = { version = "3.0.0", path = "../lib_tsshow" } +lib_tsshow = { version = "4.0.0", path = "../lib_tsshow" } serde.workspace = true pythonize = "0.26" pyo3-log = "0.13" diff --git a/seed_chain/Cargo.toml b/seed_chain/Cargo.toml index ee3f7b6..d62bcb4 100644 --- a/seed_chain/Cargo.toml +++ b/seed_chain/Cargo.toml @@ -3,7 +3,7 @@ name = "seed_chain" description = "A seeding and generic chaining mechanism for sequence-to-sequence alignment" license.workspace = true authors = ["Sebastian Schmidt "] -version = "3.0.0" +version = "4.0.0" edition.workspace = true rust-version.workspace = true repository.workspace = true @@ -12,5 +12,5 @@ repository.workspace = true [dependencies] compact-genome.workspace = true log.workspace = true -generic_a_star = { version = "3.0.0", path = "../generic_a_star" } +generic_a_star = { version = "4.0.0", path = "../generic_a_star" } num-traits.workspace = true diff --git a/tsalign-tests/Cargo.toml b/tsalign-tests/Cargo.toml index ecc05b0..e068729 100644 --- a/tsalign-tests/Cargo.toml +++ b/tsalign-tests/Cargo.toml @@ -2,7 +2,7 @@ name = "tsalign-tests" license.workspace = true authors = ["Sebastian Schmidt ", "Jasper Krauter "] -version = "3.0.0" +version = "4.0.0" edition.workspace = true rust-version.workspace = true repository.workspace = true diff --git a/tsalign/Cargo.toml b/tsalign/Cargo.toml index c145bc0..2b8289d 100644 --- a/tsalign/Cargo.toml +++ b/tsalign/Cargo.toml @@ -3,18 +3,31 @@ name = "tsalign" description = "A sequence-to-sequence aligner that accounts for template switches" license.workspace = true authors = ["Sebastian Schmidt "] -version = "3.0.0" +version = "4.0.0" edition.workspace = true rust-version.workspace = true repository.workspace = true +[features] +alphabet_dna = [] +alphabet_dna_n = [] +alphabet_dna_iupac = [] +alphabet_rna = [] +alphabet_rna_n = [] +alphabet_rna_iupac = [] + +strategy_total_length_none = [] +strategy_total_length_maximise = [] + +default = ["strategy_total_length_maximise", "alphabet_dna", "alphabet_dna_n"] + [dependencies] -generic_a_star = { version = "3.0.0", path = "../generic_a_star" } -lib_tsalign = { version = "3.0.0", path = "../lib_tsalign", features = [ +generic_a_star = { version = "4.0.0", path = "../generic_a_star" } +lib_tsalign = { version = "4.0.0", path = "../lib_tsalign", features = [ "serde", ] } -lib_ts_chainalign = { version = "3.0.0", path = "../lib_ts_chainalign" } -lib_tsshow = { version = "3.0.0", path = "../lib_tsshow" } +lib_ts_chainalign = { version = "4.0.0", path = "../lib_ts_chainalign" } +lib_tsshow = { version = "4.0.0", path = "../lib_tsshow" } clap.workspace = true compact-genome = { workspace = true, features = ["io"] } traitsequence.workspace = true diff --git a/tsalign/src/align.rs b/tsalign/src/align.rs index ed68109..6c7a327 100644 --- a/tsalign/src/align.rs +++ b/tsalign/src/align.rs @@ -11,16 +11,7 @@ use clap::{ builder::{BoolishValueParser, TypedValueParser}, }; use compact_genome::{ - implementation::{ - alphabets::{ - dna_alphabet::DnaAlphabet, dna_alphabet_or_n::DnaAlphabetOrN, - dna_iupac_nucleic_acid_alphabet::DnaIupacNucleicAcidAlphabet, - rna_alphabet::RnaAlphabet, rna_alphabet_or_n::RnaAlphabetOrN, - rna_iupac_nucleic_acid_alphabet::RnaIupacNucleicAcidAlphabet, - }, - vec_sequence::VectorGenome, - vec_sequence_store::VectorSequenceStore, - }, + implementation::{vec_sequence::VectorGenome, vec_sequence_store::VectorSequenceStore}, interface::{ alphabet::Alphabet, sequence::{GenomeSequence, OwnedGenomeSequence}, @@ -50,6 +41,19 @@ use template_switch_distance_type_selectors::{ align_a_star_template_switch_distance, }; +#[cfg(feature = "alphabet_dna")] +use compact_genome::implementation::alphabets::dna_alphabet::DnaAlphabet; +#[cfg(feature = "alphabet_dna_n")] +use compact_genome::implementation::alphabets::dna_alphabet_or_n::DnaAlphabetOrN; +#[cfg(feature = "alphabet_dna_iupac")] +use compact_genome::implementation::alphabets::dna_iupac_nucleic_acid_alphabet::DnaIupacNucleicAcidAlphabet; +#[cfg(feature = "alphabet_rna")] +use compact_genome::implementation::alphabets::rna_alphabet::RnaAlphabet; +#[cfg(feature = "alphabet_rna_n")] +use compact_genome::implementation::alphabets::rna_alphabet_or_n::RnaAlphabetOrN; +#[cfg(feature = "alphabet_rna_iupac")] +use compact_genome::implementation::alphabets::rna_iupac_nucleic_acid_alphabet::RnaIupacNucleicAcidAlphabet; + use crate::align::{ a_star_chain_ts::align_a_star_chain_ts, fasta_parser::{parse_pair_fasta_file, parse_single_fasta_file}, @@ -282,11 +286,17 @@ enum AlignmentMethod { #[derive(Debug, Clone, Eq, PartialEq, ValueEnum)] enum InputAlphabet { + #[cfg(feature = "alphabet_dna")] Dna, + #[cfg(feature = "alphabet_dna_n")] DnaN, + #[cfg(feature = "alphabet_rna")] Rna, + #[cfg(feature = "alphabet_rna_n")] RnaN, + #[cfg(feature = "alphabet_dna_iupac")] DnaIupac, + #[cfg(feature = "alphabet_rna_iupac")] RnaIupac, } @@ -308,11 +318,17 @@ pub fn cli(cli: Cli) -> Result<()> { } match cli.alphabet { + #[cfg(feature = "alphabet_dna")] InputAlphabet::Dna => execute_with_alphabet::(cli)?, + #[cfg(feature = "alphabet_dna_n")] InputAlphabet::DnaN => execute_with_alphabet::(cli)?, + #[cfg(feature = "alphabet_rna")] InputAlphabet::Rna => execute_with_alphabet::(cli)?, + #[cfg(feature = "alphabet_rna_n")] InputAlphabet::RnaN => execute_with_alphabet::(cli)?, + #[cfg(feature = "alphabet_dna_iupac")] InputAlphabet::DnaIupac => execute_with_alphabet::(cli)?, + #[cfg(feature = "alphabet_rna_iupac")] InputAlphabet::RnaIupac => execute_with_alphabet::(cli)?, } diff --git a/tsalign/src/align/template_switch_distance_type_selectors.rs b/tsalign/src/align/template_switch_distance_type_selectors.rs index 5b5a037..92f3170 100644 --- a/tsalign/src/align/template_switch_distance_type_selectors.rs +++ b/tsalign/src/align/template_switch_distance_type_selectors.rs @@ -29,10 +29,7 @@ use lib_tsalign::{ PreprocessedLookaheadTemplateSwitchMinLengthStrategy, PreprocessedTemplateSwitchMinLengthStrategy, TemplateSwitchMinLengthStrategy, }, - template_switch_total_length::{ - MaxTemplateSwitchTotalLengthStrategy, NoTemplateSwitchTotalLengthStrategy, - TemplateSwitchTotalLengthStrategy, - }, + template_switch_total_length::TemplateSwitchTotalLengthStrategy, }, }, template_switch_distance_a_star_align, @@ -41,6 +38,11 @@ use lib_tsalign::{ }; use log::info; +#[cfg(feature = "strategy_total_length_none")] +use lib_tsalign::a_star_aligner::template_switch_distance::strategies::template_switch_total_length::NoTemplateSwitchTotalLengthStrategy; +#[cfg(feature = "strategy_total_length_maximise")] +use lib_tsalign::a_star_aligner::template_switch_distance::strategies::template_switch_total_length::MaxTemplateSwitchTotalLengthStrategy; + use super::Cli; use crate::util::load_tsa_config; @@ -71,7 +73,9 @@ pub enum TemplateSwitchChainingStrategySelector { #[derive(Clone, ValueEnum)] pub enum TemplateSwitchTotalLengthStrategySelector { + #[cfg(feature = "strategy_total_length_none")] None, + #[cfg(feature = "strategy_total_length_maximise")] Maximise, } @@ -375,6 +379,7 @@ fn align_a_star_template_switch_select_template_switch_total_length_strategy< template_switch_count_memory: ::Memory, ) { match cli.ts_total_length_strategy { + #[cfg(feature = "strategy_total_length_none")] TemplateSwitchTotalLengthStrategySelector::None => { align_a_star_template_switch_select_template_switch_descendant_strategy::< _, @@ -395,6 +400,7 @@ fn align_a_star_template_switch_select_template_switch_total_length_strategy< template_switch_count_memory, ) } + #[cfg(feature = "strategy_total_length_maximise")] TemplateSwitchTotalLengthStrategySelector::Maximise => { align_a_star_template_switch_select_template_switch_descendant_strategy::< _,