Skip to content

Commit 0dd271e

Browse files
committed
Add checks for missing data
1 parent e21ab41 commit 0dd271e

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

mGAP/src/org/labkey/mgap/pipeline/mGapReleaseGenerator.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,11 @@ private Double parseCadd(String cadd)
723723
{
724724
if (cadd.contains("|"))
725725
{
726-
return Arrays.stream(cadd.split("\\|")).map(Double::parseDouble).max(Double::compare).get();
726+
return Arrays.stream(cadd.split("\\|")).filter(x -> !".".equals(x)).map(Double::parseDouble).max(Double::compare).orElse(null);
727+
}
728+
else if (".".equals(cadd))
729+
{
730+
return null;
727731
}
728732

729733
return Double.parseDouble(cadd);
@@ -1388,12 +1392,12 @@ private void inspectAndSummarizeVcf(JobContext ctx, File vcfInput, GeneToNameTra
13881392
try
13891393
{
13901394
String as = StringUtils.trimToNull(polyphenScores.get(alleleIdx));
1391-
if (as == null)
1395+
if (as == null || ".".equals(as))
13921396
{
13931397
continue;
13941398
}
13951399

1396-
Double maxScore = Arrays.stream(as.split("\\|")).filter(x -> !x.isEmpty()).map(Double::parseDouble).max(Double::compare).orElse(-1.0);
1400+
double maxScore = Arrays.stream(as.split("\\|")).filter(x -> !x.isEmpty()).filter(x -> !".".equals(x)).map(Double::parseDouble).max(Double::compare).orElse(-1.0);
13971401
if (maxScore == 0.0)
13981402
{
13991403
ctx.getLogger().error("Suspicious values for Polyphen2_HVAR_S: " + maxScore + ", at position: " + vc.toStringWithoutGenotypes());
@@ -1581,7 +1585,7 @@ else if (af != null)
15811585
cadd = Arrays.stream(String.valueOf(cadd).split("\\|")).map(x -> {
15821586
try
15831587
{
1584-
double y = Double.parseDouble(x);
1588+
Double.parseDouble(x);
15851589
}
15861590
catch (Exception e)
15871591
{

0 commit comments

Comments
 (0)