use of org.nextprot.api.commons.exception.NextProtException in project nextprot-api by calipho-sib.
the class BlastResultUpdaterServiceImpl method update.
@Override
public void update(Report blastReport, String querySequence) {
if (blastReport == null) {
throw new NextProtException("nothing to update: blast result report was not defined");
}
updateReport(blastReport);
updateParams(blastReport.getParams(), querySequence);
Search search = blastReport.getResults().getSearch();
updateSearch(search);
for (Hit hit : search.getHits()) {
updateHit(hit, querySequence.length());
hit.getDescription().forEach(this::updateHitDescription);
hit.getHsps().forEach(this::updateHsp);
}
updateStat(search.getStat());
}
use of org.nextprot.api.commons.exception.NextProtException in project nextprot-api by calipho-sib.
the class BlastResultUpdaterServiceImpl method updateHitDescription.
private void updateHitDescription(Description description) {
description.setId(null);
description.setAccession(null);
Matcher matcher = ISOFORM_ACCESSION_PATTERN.matcher(description.getTitle());
if (matcher.find()) {
String entryAccession = matcher.group(1);
String isoformAccession = entryAccession + matcher.group(2);
updateDescription(description, isoformAccession, entryAccession);
} else {
throw new NextProtException("blast db error: could not extract isoform information from header " + description.getTitle());
}
}
use of org.nextprot.api.commons.exception.NextProtException in project nextprot-api by calipho-sib.
the class BlastProgram method run.
public O run(I input) throws ExceptionWithReason {
try {
// pre process
File fastaFile = constructFastaFile(input);
List<String> commandLine = buildCommandLine(config, fastaFile);
preConfig(input, config);
O out = process(commandLine);
// post process
destroyFastaFile(fastaFile);
postConfig(config);
return out;
} catch (IOException e) {
throw new NextProtException("Internal error: cannot run process " + name, e);
}
}
use of org.nextprot.api.commons.exception.NextProtException in project nextprot-api by calipho-sib.
the class StatementAnnotationBuilder method findPublicationId.
long findPublicationId(Statement statement) {
String referenceDB = statement.getValue(StatementField.REFERENCE_DATABASE);
String referenceAC = statement.getValue(StatementField.REFERENCE_ACCESSION);
Publication publication = publicationService.findPublicationByDatabaseAndAccession(referenceDB, referenceAC);
if (publication == null) {
String message = "can 't find publication db:" + referenceDB + " id:" + referenceAC;
LOGGER.error(message);
throw new NextProtException(message);
}
return publication.getPublicationId();
}
use of org.nextprot.api.commons.exception.NextProtException in project nextprot-api by calipho-sib.
the class StatementExtractorBase method deserialize.
protected Set<Statement> deserialize(InputStream content) {
ObjectMapper mapper = new ObjectMapper();
Set<Statement> obj = null;
try {
obj = mapper.readValue(content, new TypeReference<Set<Statement>>() {
});
} catch (IOException e) {
throw new NextProtException(e);
}
return obj;
}
Aggregations