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

Fix #3838 Tabix based annotator fails if chromosome is not present in the tabix resource #3853

Merged
merged 1 commit into from
Oct 7, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,26 @@ public Iterable<Entity> findAll(Query q)
public synchronized List<Entity> query(String chrom, long posFrom, long posTo)
{
String queryString = String.format("%s:%s-%s", checkNotNull(chrom), checkNotNull(posFrom), checkNotNull(posTo));
Collection<String> lines = getLines(tabixReader.query(queryString));
return lines.stream().map(line -> line.split("\t")).map(vcfToEntitySupplier.get()::toEntity)
.filter(entity -> positionMatches(entity, posFrom, posTo)).collect(Collectors.toList());
try
{
Collection<String> lines = getLines(tabixReader.query(queryString));
return lines.stream().map(line -> line.split("\t")).map(vcfToEntitySupplier.get()::toEntity)
.filter(entity -> positionMatches(entity, posFrom, posTo)).collect(Collectors.toList());
}
catch (NullPointerException e)
{
LOG.warn("Unable to read from tabix resource for query: " + queryString
+ " (Position not present in resource file?)");
LOG.debug("", e);
}
catch (ArrayIndexOutOfBoundsException e)
{
LOG.warn("Unable to read from tabix resource for query: " + queryString
+ " (Chromosome not present in resource file?)");
LOG.debug("", e);
}

return Collections.emptyList();
}

/**
Expand Down