-
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: allow reading segments and genes that are null from ndjson file #…
- Loading branch information
1 parent
c1e96cc
commit a8a9c89
Showing
12 changed files
with
319 additions
and
134 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
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,67 @@ | ||
#include "silo/preprocessing/preprocessor.h" | ||
|
||
#include <gtest/gtest.h> | ||
#include <nlohmann/json.hpp> | ||
|
||
#include "silo/config/config_repository.h" | ||
#include "silo/database.h" | ||
#include "silo/database_info.h" | ||
#include "silo/preprocessing/preprocessing_config_reader.h" | ||
#include "silo/query_engine/query_engine.h" | ||
|
||
using nlohmann::json; | ||
using silo::config::ConfigRepository; | ||
using silo::preprocessing::OptionalPreprocessingConfig; | ||
using silo::preprocessing::PreprocessingConfigReader; | ||
using silo::preprocessing::Preprocessor; | ||
using silo::query_engine::QueryEngine; | ||
|
||
TEST(PreprocessorTest, shouldProcessDataSetWithSequencesThatAreNull) { | ||
const silo::preprocessing::InputDirectory input_directory{ | ||
"./testBaseData/ndjsonWithNullSequences/" | ||
}; | ||
|
||
auto config = PreprocessingConfigReader() | ||
.readConfig(input_directory.directory + "preprocessing_config.yaml") | ||
.mergeValuesFromOrDefault(OptionalPreprocessingConfig()); | ||
|
||
const auto database_config = | ||
ConfigRepository().getValidatedConfig(input_directory.directory + "database_config.yaml"); | ||
|
||
Preprocessor preprocessor(config, database_config); | ||
auto database = preprocessor.preprocess(); | ||
|
||
const auto database_info = database.getDatabaseInfo(); | ||
|
||
EXPECT_GT(database_info.total_size, 0); | ||
EXPECT_EQ(database_info.sequence_count, 5); | ||
|
||
const QueryEngine query_engine(database); | ||
const auto result = query_engine.executeQuery(R"( | ||
{ | ||
"action": { | ||
"type": "FastaAligned", | ||
"sequenceName": ["someShortGene", "secondSegment"], | ||
"orderByFields": ["accessionVersion"] | ||
}, | ||
"filterExpression": { | ||
"type": "True" | ||
} | ||
} | ||
)"); | ||
|
||
const auto actual = nlohmann::json(result.query_result); | ||
const json expected = { | ||
{{"accessionVersion", "1.1"}, {"someShortGene", "MADS"}, {"secondSegment", "NNNNNNNNNNNNNNNN"} | ||
}, | ||
{{"accessionVersion", "1.2"}, {"someShortGene", "MADS"}, {"secondSegment", "NNNNNNNNNNNNNNNN"} | ||
}, | ||
{{"accessionVersion", "1.3"}, {"someShortGene", "XXXX"}, {"secondSegment", "NNNNNNNNNNNNNNNN"} | ||
}, | ||
{{"accessionVersion", "1.4"}, {"someShortGene", "MADS"}, {"secondSegment", "NNNNNNNNNNNNNNNN"} | ||
}, | ||
{{"accessionVersion", "1.5"}, {"someShortGene", "MADS"}, {"secondSegment", "NNNNNNNNNNNNNNNN"} | ||
} | ||
}; | ||
ASSERT_EQ(actual, expected); | ||
} |
Oops, something went wrong.