Skip to content

Commit

Permalink
fix(reporter): improve text for uncallable genes
Browse files Browse the repository at this point in the history
  • Loading branch information
markwoon committed Aug 1, 2023
1 parent e7e7e55 commit 7e794b3
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 16 deletions.
12 changes: 7 additions & 5 deletions src/main/java/org/pharmgkb/pharmcat/util/VcfHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -296,11 +296,13 @@ public static void printVcfHeaders(PrintWriter writer, String source, @Nullable
if (assemblies.size() > 1) {
throw new IllegalStateException("Multiple assemblies found: " + assemblies);
}
String assembly = assemblies.iterator().next();
SortedSet<String> sortedChr = new TreeSet<>(new ChrNameComparator());
sortedChr.addAll(contigs.keySet());
for (String chr : sortedChr) {
writer.println("##contig=<ID=" + chr + ",assembly=" + assembly + ",species=\"Homo sapiens\">");
if (!assemblies.isEmpty()) {
String assembly = assemblies.iterator().next();
SortedSet<String> sortedChr = new TreeSet<>(new ChrNameComparator());
sortedChr.addAll(contigs.keySet());
for (String chr : sortedChr) {
writer.println("##contig=<ID=" + chr + ",assembly=" + assembly + ",species=\"Homo sapiens\">");
}
}
}

Expand Down
18 changes: 10 additions & 8 deletions src/main/resources/org/pharmgkb/pharmcat/reporter/report.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,19 @@
<h2>Section I: Genotype Summary</h2>

{{#unless (thereAre summaries)}}
<p>
No genotypes called.
</p>
{{#if (thereAre uncallableGenes)}}
<p>
No genotypes called.
</p>
{{> uncallableGenesNote }}
{{/if}}
{{#unless (thereAre uncallableGenes)}}
<p>
No data provided.
</p>
{{/unless}}
<p>
See <a href="#section-iii">Section III</a> for details. For a full list of disclaimers and limitations see <a href="#disclaimer">Section IV</a>.
For a full list of disclaimers and limitations see <a href="#disclaimer">Section IV</a>.
</p>
{{/unless}}
{{#if (thereAre summaries) }}
Expand Down Expand Up @@ -150,11 +155,8 @@
</table>

{{#if (thereAre uncallableGenes)}}
<div class="alert alert-secondary">
<div class="alert alert-warning">
{{> uncallableGenesNote }}
<p class="mb-1">
See <a href="#section-iii">Section III</a> for details.
</p>
</div>
{{/if}}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<p>
The following {{pluralize "gene" uncallableGenes}} could not be called because there were
genetic variations that do not match the allele definition:
genetic variations that do not match the allele definition. There could still be actionable variants in these genes.
See <a href="#section-iii">Section III</a> for details.
</p>
<ul class="mb-2">
{{#each uncallableGenes}}
Expand Down
7 changes: 7 additions & 0 deletions src/test/java/org/pharmgkb/pharmcat/PipelineTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,13 @@ void testAll(TestInfo testInfo) throws Exception {
}


@Test
void testNoData(TestInfo testInfo) throws Exception {
PipelineWrapper testWrapper = new PipelineWrapper(testInfo, false);
testWrapper.execute(null, true);
}


@Test
void testUndocumentedVariation(TestInfo testInfo) throws Exception {
PipelineWrapper testWrapper = new PipelineWrapper(testInfo, false);
Expand Down
6 changes: 5 additions & 1 deletion src/test/java/org/pharmgkb/pharmcat/PipelineWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,14 @@ TestVcfBuilder getVcfBuilder() {
}

@Nullable Path execute(Path outsideCallPath) throws Exception {
return execute(outsideCallPath, false);
}

@Nullable Path execute(Path outsideCallPath, boolean allowNoData) throws Exception {
Path vcfFile = null;
VcfFile vcfFileObj = null;
boolean runMatcher = false;
if (m_vcfBuilder.hasData()) {
if (m_vcfBuilder.hasData() || allowNoData) {
runMatcher = true;
vcfFile = m_vcfBuilder.generate();
vcfFileObj = new VcfFile(vcfFile, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ void testCombinationPhased() throws Exception {
}

@Test
void testCombinationUphased() throws Exception {
void testCombinationUnphased() throws Exception {
Path definitionFile = PathUtils.getPathToResource("org/pharmgkb/pharmcat/haplotype/NamedAlleleMatcher-combination.json");
Path vcfFile = PathUtils.getPathToResource("org/pharmgkb/pharmcat/haplotype/NamedAlleleMatcher-combinationUnphased.vcf");

Expand Down

0 comments on commit 7e794b3

Please sign in to comment.