use of uk.ac.ebi.spot.goci.pussycat.exception.DataIntegrityViolationException in project goci by EBISPOT.
the class SparqlAssociationRenderlet method getLocationOfPreviousAssociation.
protected SVGArea getLocationOfPreviousAssociation(RenderletNexus nexus, SparqlTemplate sparqlTemplate, URI association) throws DataIntegrityViolationException {
BandInformation band = getBandInformation(sparqlTemplate, association);
if (band != null) {
BandInformation current = band;
boolean done = false;
while (!done) {
BandInformation previousBand = getPreviousBandMap(nexus, sparqlTemplate).get(current);
if (previousBand == null) {
done = true;
return null;
}
if (!previousBand.getChromosome().equals(current.getChromosome())) {
done = true;
return null;
}
// now find the traits in the previous band
Set<URI> previousBandAssociations = QueryManager.getCachingInstance().getAssociationsLocatedInCytogeneticBand(sparqlTemplate, previousBand.getBandName(), nexus.getRenderingContext());
// get first not-null location for an association in the previous band
for (URI previousBandAssociation : previousBandAssociations) {
SVGArea prevLocation = nexus.getLocationOfRenderedEntity(previousBandAssociation);
if (prevLocation != null) {
done = true;
return prevLocation;
}
}
// if we get to here, no associations are located in the previous region so return null
getLog().trace("Unable to identify any associations in the previous cytogenetic region '" + previousBand.getBandName() + "'");
current = previousBand;
}
return null;
} else {
throw new DataIntegrityViolationException("Unable to identify the cytogenetic region where association '" + association + "' is located");
}
}
Aggregations