Skip to content

Commit de7e37d

Browse files
committed
Implement stage 2, no more generics for the mapping
1 parent 04d1020 commit de7e37d

2 files changed

Lines changed: 11 additions & 14 deletions

File tree

sa-index/src/peptide_search.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use serde::Serialize;
55
use crate::{
66
array::SuffixArrayBackend,
77
sa_searcher::{SearchAllSuffixesResult, Searcher},
8-
suffix_to_protein_index::SuffixToProteinMappingBackend,
98
};
109

1110
#[derive(Debug, Serialize)]
@@ -51,8 +50,8 @@ impl From<ProteinRef<'_>> for ProteinInfo {
5150
/// The second argument is a list of all matching proteins for the peptide
5251
/// Returns None if the peptides does not have any matches, or if the peptide is shorter than the
5352
/// sparseness factor k used in the index
54-
pub fn search_proteins_for_peptide<'a, SA: SuffixArrayBackend, STPM: SuffixToProteinMappingBackend>(
55-
searcher: &'a Searcher<SA, STPM>,
53+
pub fn search_proteins_for_peptide<'a, SA: SuffixArrayBackend>(
54+
searcher: &'a Searcher<SA>,
5655
peptide: &str,
5756
cutoff: usize,
5857
equate_il: bool,
@@ -77,8 +76,8 @@ pub fn search_proteins_for_peptide<'a, SA: SuffixArrayBackend, STPM: SuffixToPro
7776
Some((cutoff_used, proteins))
7877
}
7978

80-
pub fn search_peptide<SA: SuffixArrayBackend, STPM: SuffixToProteinMappingBackend>(
81-
searcher: &Searcher<SA, STPM>,
79+
pub fn search_peptide<SA: SuffixArrayBackend>(
80+
searcher: &Searcher<SA>,
8281
peptide: &str,
8382
cutoff: usize,
8483
equate_il: bool,
@@ -108,8 +107,8 @@ pub fn search_peptide<SA: SuffixArrayBackend, STPM: SuffixToProteinMappingBacken
108107
/// # Returns
109108
///
110109
/// Returns an `OutputData<SearchOnlyResult>` object with the search results for the peptides
111-
pub fn search_all_peptides<SA: SuffixArrayBackend, STPM: SuffixToProteinMappingBackend>(
112-
searcher: &Searcher<SA, STPM>,
110+
pub fn search_all_peptides<SA: SuffixArrayBackend>(
111+
searcher: &Searcher<SA>,
113112
peptides: &Vec<String>,
114113
cutoff: usize,
115114
equate_il: bool,

sa-index/src/sa_searcher.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ use text_compression::{ProteinText, ProteinTextBackend, ProteinTextSlice};
66
use crate::{
77
KmerTable, Nullable, array::SuffixArrayBackend,
88
sa_searcher::BoundSearch::{Maximum, Minimum},
9-
suffix_to_protein_index::{
10-
SuffixToProteinMappingBackend, SuffixToProteinMapping,
11-
},
9+
suffix_to_protein_index::{SuffixToProteinMapping, SuffixToProteinMappingBackend},
1210
};
1311

1412

@@ -76,18 +74,18 @@ impl PartialEq for SearchAllSuffixesResult {
7674
/// taxonomic analysis provided by Unipept
7775
/// * `function_aggregator` - Object used to retrieve the functional annotations and to calculate
7876
/// the functional analysis provided by Unipept
79-
pub struct Searcher<SA: SuffixArrayBackend, STPM: SuffixToProteinMappingBackend = SuffixToProteinMapping> {
77+
pub struct Searcher<SA: SuffixArrayBackend> {
8078
pub sa: SA,
8179
pub proteins: Proteins,
82-
pub suffix_index_to_protein: STPM,
80+
pub suffix_index_to_protein: SuffixToProteinMapping,
8381
pub kmer_table: Option<KmerTable>,
8482
/// Total nanoseconds spent inside `search_bounds()` across all queries (since last drain).
8583
pub search_bounds_ns: AtomicU64,
8684
/// Total nanoseconds spent iterating matches in `search_matching_suffixes()` (since last drain).
8785
pub match_iter_ns: AtomicU64,
8886
}
8987

90-
impl<SA: SuffixArrayBackend, STPM: SuffixToProteinMappingBackend> Searcher<SA, STPM> {
88+
impl<SA: SuffixArrayBackend> Searcher<SA> {
9189
/// Creates a new Searcher object
9290
///
9391
/// # Arguments
@@ -104,7 +102,7 @@ impl<SA: SuffixArrayBackend, STPM: SuffixToProteinMappingBackend> Searcher<SA, S
104102
/// # Returns
105103
///
106104
/// Returns a new Searcher object
107-
pub fn new(sa: SA, proteins: Proteins, suffix_index_to_protein: STPM) -> Self {
105+
pub fn new(sa: SA, proteins: Proteins, suffix_index_to_protein: SuffixToProteinMapping) -> Self {
108106
Self {
109107
sa,
110108
proteins,

0 commit comments

Comments
 (0)