-
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.
feat: introduce storage of unaligned sequences from either ndjson fil…
…e or fasta file and make them queryable via the Fasta action
- Loading branch information
Showing
38 changed files
with
1,115 additions
and
194 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
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
"testCaseName": "Get the unaligned fasta for many sequences", | ||
"query": { | ||
"action": { | ||
"type": "Fasta", | ||
"sequenceName": "testSecondSequence" | ||
}, | ||
"filterExpression": { | ||
"type": "StringEquals", | ||
"column": "division", | ||
"value": "Vaud" | ||
} | ||
}, | ||
"expectedQueryResult": [ | ||
{ | ||
"gisaid_epi_isl": "EPI_ISL_3259931", | ||
"testSecondSequence": "ACGT" | ||
}, | ||
{ | ||
"gisaid_epi_isl": "EPI_ISL_3465732", | ||
"testSecondSequence": "ACGT" | ||
}, | ||
{ | ||
"gisaid_epi_isl": "EPI_ISL_2367431", | ||
"testSecondSequence": "NCGT" | ||
}, | ||
{ | ||
"gisaid_epi_isl": "EPI_ISL_2359636", | ||
"testSecondSequence": "ACGT" | ||
}, | ||
{ | ||
"gisaid_epi_isl": "EPI_ISL_1597890", | ||
"testSecondSequence": "ACGT" | ||
}, | ||
{ | ||
"gisaid_epi_isl": "EPI_ISL_2405276", | ||
"testSecondSequence": "ACGT" | ||
}, | ||
{ | ||
"gisaid_epi_isl": "EPI_ISL_1001493", | ||
"testSecondSequence": "ACGT" | ||
} | ||
] | ||
} |
21 changes: 21 additions & 0 deletions
21
endToEndTests/test/queries/fasta_oneRowTwoUnalignedSequences.json
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"testCaseName": "Get two unaligned fastas for one row", | ||
"query": { | ||
"action": { | ||
"type": "Fasta", | ||
"sequenceName": ["main", "testSecondSequence"] | ||
}, | ||
"filterExpression": { | ||
"type": "StringEquals", | ||
"column": "gisaid_epi_isl", | ||
"value": "EPI_ISL_1749899" | ||
} | ||
}, | ||
"expectedQueryResult": [ | ||
{ | ||
"gisaid_epi_isl": "EPI_ISL_1749899", | ||
"main": "some_very_short_string", | ||
"testSecondSequence": "AAGN" | ||
} | ||
] | ||
} |
20 changes: 20 additions & 0 deletions
20
endToEndTests/test/queries/fasta_oneSequenceUnaligned.json
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"testCaseName": "Get the unaligned fasta for one sequence", | ||
"query": { | ||
"action": { | ||
"type": "Fasta", | ||
"sequenceName": "main" | ||
}, | ||
"filterExpression": { | ||
"type": "StringEquals", | ||
"column": "gisaid_epi_isl", | ||
"value": "EPI_ISL_1749899" | ||
} | ||
}, | ||
"expectedQueryResult": [ | ||
{ | ||
"gisaid_epi_isl": "EPI_ISL_1749899", | ||
"main": "some_very_short_string" | ||
} | ||
] | ||
} |
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 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 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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#pragma once | ||
|
||
#include <cstdint> | ||
#include <deque> | ||
#include <filesystem> | ||
#include <string> | ||
|
||
namespace boost::serialization { | ||
class access; | ||
} // namespace boost::serialization | ||
|
||
namespace silo { | ||
class ZstdFastaTableReader; | ||
|
||
class UnalignedSequenceStorePartition { | ||
friend class boost::serialization::access; | ||
|
||
template <class Archive> | ||
void serialize(Archive& archive, [[maybe_unused]] const uint32_t version) { | ||
archive & sequence_count; | ||
} | ||
|
||
public: | ||
explicit UnalignedSequenceStorePartition( | ||
std::filesystem::path file_name, | ||
std::string& compression_dictionary | ||
); | ||
|
||
std::filesystem::path file_name; | ||
std::string& compression_dictionary; | ||
uint32_t sequence_count = 0; | ||
|
||
size_t fill(silo::ZstdFastaTableReader& input); | ||
}; | ||
|
||
class UnalignedSequenceStore { | ||
public: | ||
std::deque<UnalignedSequenceStorePartition> partitions; | ||
std::filesystem::path folder_path; | ||
std::string compression_dictionary; | ||
|
||
void saveFolder(const std::filesystem::path& save_location) const; | ||
|
||
explicit UnalignedSequenceStore( | ||
std::filesystem::path folder_path, | ||
std::string&& compression_dictionary | ||
); | ||
|
||
UnalignedSequenceStorePartition& createPartition(); | ||
}; | ||
|
||
} // namespace silo |
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
Oops, something went wrong.