Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TASK-5027 - NullPointerException executing JUnit tests SampleIndexOnlyVariantQueryExecutor #2340

Merged
merged 1 commit into from
Sep 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,7 @@ private boolean isIncludeCovered(SampleIndexQuery sampleIndexQuery, Query inputQ
return false;
}

List<String> sampleDataKeys = VariantQueryUtils.getIncludeSampleData(inputQuery);
if (sampleDataKeys == null) {
// Undefined, get default sampleDataKeys
sampleDataKeys = HBaseToVariantConverter.getFixedFormat(study.getStudyMetadata());
}
List<String> sampleDataKeys = getSampleDataKeys(inputQuery, study);

if (sampleDataKeys.size() != 1) {
// One and only one sampledatakey
Expand Down Expand Up @@ -490,8 +486,9 @@ private class AddMissingDataTask implements Task<Variant, Variant> {
for (Integer fileId : fileIds) {
filesFromSample.add(metadataManager.getFileName(studyId, fileId));
}
List<String> includeSampleData = VariantQueryUtils.getIncludeSampleData(parsedQuery.getInputQuery());
gtIdx = includeSampleData.indexOf("GT");

List<String> sampleDataKeys = getSampleDataKeys(parsedQuery.getInputQuery(), parsedQuery.getProjection().getStudy(studyId));
gtIdx = sampleDataKeys.indexOf("GT");
}

@Override
Expand Down Expand Up @@ -657,4 +654,13 @@ private void mergeFileEntries(StudyEntry studyEntry, List<FileEntry> newFileEntr
}
}
}

private List<String> getSampleDataKeys(Query parsedQuery, VariantQueryProjection.StudyVariantQueryProjection parsedQuery1) {
List<String> sampleDataKeys = VariantQueryUtils.getIncludeSampleData(parsedQuery);
if (sampleDataKeys == null) {
// Undefined, get default sampleDataKeys
sampleDataKeys = HBaseToVariantConverter.getFixedFormat(parsedQuery1.getStudyMetadata());
}
return sampleDataKeys;
}
}
Loading