-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Try to pass query segment parameters in shopping carts
- Loading branch information
Showing
9 changed files
with
85 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,36 @@ | ||
#pragma once | ||
|
||
#include <dream_stellar/stellar_index.hpp> | ||
#include <dream_stellar/stellar_query_segment.hpp> | ||
#include <dream_stellar/stellar_types.hpp> | ||
|
||
#include <valik/search/query_record.hpp> | ||
|
||
namespace dream_stellar | ||
{ | ||
|
||
template <typename alphabet_t, typename sequence_reference_t, typename TId = std::string> | ||
struct QueryIDMap | ||
template <typename alphabet_t, typename sequence_container_t = std::vector<alphabet_t>, | ||
typename sequence_reference_t = std::span<const alphabet_t>> | ||
class QueryIDMap | ||
{ | ||
size_t recordID(sequence_reference_t const & query) const | ||
{ | ||
sequence_reference_t const * begin = &queries[0]; | ||
sequence_reference_t const * current = std::addressof(query); | ||
return current - begin; | ||
} | ||
|
||
std::vector<sequence_reference_t> const & queries; | ||
std::vector<valik::shared_query_record<sequence_reference_t>> queries; | ||
|
||
public: | ||
|
||
QueryIDMap(std::vector<valik::shared_query_record<sequence_container_t>> const & records) | ||
{ | ||
for (auto & record : records) | ||
queries.emplace_back(record.id, record.get_start(), record.get_len(), record.underlyingData); | ||
} | ||
|
||
dream_stellar::StellarQuerySegment<sequence_reference_t> segment_from_id(unsigned const & query_id) const | ||
{ | ||
if (query_id >= queries.size()) | ||
throw std::runtime_error("Query index " + std::to_string(query_id) + " is out of range [0, " | ||
+ std::to_string(queries.size() - 1) + "]"); | ||
valik::shared_query_record<sequence_reference_t> & shared_rec = queries[query_id]; | ||
|
||
return shared_rec.get_seqan_segment(); | ||
} | ||
|
||
}; | ||
|
||
} // namespace dream_stellar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters