use of org.nextprot.api.core.service.fluent.EntryConfig in project nextprot-api by calipho-sib.
the class PepXServiceImpl method findEntriesWithPeptides.
@Override
public List<Entry> findEntriesWithPeptides(String peptides, boolean modeIsoleucine) {
List<Entry> entries = new ArrayList<>();
PepXResponse pepXResponse = getPepXResponse(peptides, modeIsoleucine);
Set<String> entriesNames = pepXResponse.getEntriesNames();
for (String entryName : entriesNames) {
EntryConfig targetIsoconf = EntryConfig.newConfig(entryName).withTargetIsoforms().with("variant").withOverview().withoutAdditionalReferences().withoutProperties();
Entry entry = entryBuilderService.build(targetIsoconf);
List<Annotation> virtualAnnotations = new ArrayList<>();
Set<String> peptidesForEntry = pepXResponse.getPeptidesForEntry(entryName);
for (String peptide : peptidesForEntry) {
PepXEntryMatch pepxEntryMatch = pepXResponse.getPeptideMatch(peptide).getPepxMatchesForEntry(entryName);
if (pepxEntryMatch != null && pepxEntryMatch.getIsoforms() != null && pepxEntryMatch.getIsoforms().size() > 0) {
virtualAnnotations.addAll(buildEntryWithVirtualAnnotations(peptide, modeIsoleucine, pepxEntryMatch.getIsoforms(), entry.getAnnotations(), entry.getIsoforms()));
}
}
if ((virtualAnnotations != null) && (!virtualAnnotations.isEmpty())) {
Entry resultEntry = new Entry(entry.getUniqueName());
// Adds the overview as well
resultEntry.setOverview(entry.getOverview());
resultEntry.setAnnotations(virtualAnnotations);
entries.add(resultEntry);
}
}
// add peptide unicity extra info required to unicity checker and peptide viewer
updateAnnotationsWithPeptideProperties(entries);
return entries;
}
use of org.nextprot.api.core.service.fluent.EntryConfig in project nextprot-api by calipho-sib.
the class EntryXLSWriter method writeEntry.
@Override
protected void writeEntry(String entryName) throws IOException {
EntryConfig config = EntryConfig.newConfig(entryName);
for (EntryBlock block : entryDataProvider.getSourceEntryBlocks()) {
config.withBlock(block);
}
Entry entry = entryBuilderService.build(config);
for (Record record : entryDataProvider.getRecords(entry)) {
HSSFRow row = worksheet.createRow(rowIndex);
writeRecord(row, record);
rowIndex++;
}
}
use of org.nextprot.api.core.service.fluent.EntryConfig in project nextprot-api by calipho-sib.
the class ServiceEntryValidation method checkValidEntry.
@Around("execution(* org.nextprot.api.*.service.*.*(..))")
public // @Around("execution(* org.nextprot.api.*.service.*.*(.., @aspects.ValidEntry (*), ..))")
Object checkValidEntry(ProceedingJoinPoint pjp) throws Throwable {
Object[] arguments = pjp.getArgs();
for (Object arg : arguments) {
if ((arg != null) && EntryConfig.class.isAssignableFrom(arg.getClass())) {
String argument = ((EntryConfig) arg).getEntryName();
String entryAccession = EntryUtils.getEntryName(argument);
if (!uniqueNames.contains(entryAccession)) {
LOGGER.error("neXtProt entry " + argument + " was not found, throwing EntryNotFoundException");
throw new EntryNotFoundException(argument);
}
}
}
MethodSignature ms = (MethodSignature) pjp.getSignature();
Annotation[][] annotations = ms.getMethod().getParameterAnnotations();
int i = 0;
for (Annotation[] paramAnnotations : annotations) {
for (Annotation annotation : paramAnnotations) {
if (ValidEntry.class.isAssignableFrom(annotation.getClass())) {
if (!uniqueNames.contains(arguments[i])) {
LOGGER.error("neXtProt entry " + arguments[i] + " was not found, throwing EntryNotFoundException");
throw new EntryNotFoundException((String) arguments[i]);
}
break;
}
}
i++;
}
return pjp.proceed();
}
use of org.nextprot.api.core.service.fluent.EntryConfig in project nextprot-api by calipho-sib.
the class EntryVelocityBasedStreamWriter method streamWithVelocityTemplate.
final void streamWithVelocityTemplate(String entryName, String... otherViewNames) throws IOException {
EntryConfig entryConfig = EntryConfig.newConfig(entryName);
entryConfig.with(viewName);
for (String otherName : otherViewNames) {
entryConfig.with(otherName);
}
Entry entry = entryBuilderService.build(entryConfig);
handleTemplateMerge(template, newNXVelocityContext(entry));
}
Aggregations