use of org.nextprot.api.core.domain.Isoform in project nextprot-api by calipho-sib.
the class BlastServiceImpl method blastIsoformSequence.
@Override
public BlastProgramOutput blastIsoformSequence(BlastIsoformInput params) {
String isoformAccession = params.getIsoformAccession();
String entryAccession = isoformAccession.split("-")[0];
try {
Isoform isoform = getIsoform(isoformAccession, entryAccession);
params.setSequence(isoform.getSequence());
params.validateSequencePositions();
params.setSequence(params.getSequence().substring(params.getBeginPos() - 1, params.getEndPos()));
params.setTitle(buildTitle(params, isoform, entryAccession));
params.setEntryAccession(entryAccession);
Description queryDescription = new Description();
blastResultUpdaterService.updateDescription(queryDescription, isoformAccession, entryAccession);
params.setDescription(queryDescription);
return blastProteinSequence(params);
} catch (ExceptionWithReason exceptionWithReason) {
return new BlastProgramFailure(params, exceptionWithReason);
}
}
use of org.nextprot.api.core.domain.Isoform in project nextprot-api by calipho-sib.
the class AnnotationUtilsTest method exportAnnotationsAsTsvString.
private String exportAnnotationsAsTsvString(Entry entry, List<Annotation> mergedAnnotations) {
Isoform canonical = IsoformUtils.getCanonicalIsoform(entry);
StringBuilder sb = new StringBuilder();
for (Annotation annotation : mergedAnnotations) {
List<String> row = Arrays.asList(entry.getUniqueName(), annotation.getUniqueName(), annotation.getAPICategory().getApiTypeName(), annotation.getAnnotationName(), annotation.getAnnotationHash(), String.valueOf(computeMasterPos(canonical, annotation.getTargetingIsoformsMap().get(canonical.getIsoformAccession()).getFirstPosition())));
// write annotation line
sb.append(row.stream().collect(Collectors.joining("\t"))).append("\n");
}
return sb.toString();
}
use of org.nextprot.api.core.domain.Isoform in project nextprot-api by calipho-sib.
the class InteractionServiceImpl method findInteractionsAsAnnotationsByEntry.
@Override
@Cacheable("interactions-as-annot")
public List<Annotation> findInteractionsAsAnnotationsByEntry(String entryName) {
List<Annotation> annots = new ArrayList<>();
List<Isoform> isoforms = this.isoService.findIsoformsByEntryName(entryName);
List<Interaction> interactions = this.interactionDAO.findInteractionsByEntry(entryName);
for (Interaction inter : interactions) {
Annotation annot = BinaryInteraction2Annotation.transform(inter, entryName, isoforms, mainNamesService);
annots.add(annot);
}
// returns a immutable list when the result is cacheable (this prevents modifying the cache, since the cache returns a reference) copy on read and copy on write is too much time consuming
return new ImmutableList.Builder<Annotation>().addAll(annots).build();
}
use of org.nextprot.api.core.domain.Isoform in project nextprot-api by calipho-sib.
the class InteractionServiceIntegrationTest method shouldWork.
@Ignore
@Test
public void shouldWork() {
String entryName = "NX_P38398";
List<Annotation> annots = new ArrayList<>();
List<Isoform> isoforms = this.isoformService.findIsoformsByEntryName(entryName);
List<Interaction> interactions = this.interactionService.findInteractionsByEntry(entryName);
System.out.println("Interaction count:" + interactions.size());
for (Interaction inter : interactions) {
Annotation annot = BinaryInteraction2Annotation.transform(inter, entryName, isoforms, mainNamesService);
annots.add(annot);
BioObject bo = annot.getBioObject();
if (bo != null && (bo.getAccession().equals("NX_Q92560") || bo.getAccession().equals("Q99PU7"))) {
System.out.print(inter.getEvidenceXrefAC() + ": ");
System.out.print(inter.getInteractants().get(0).getAccession());
if (inter.getInteractants().size() == 2)
System.out.print(" <==> " + inter.getInteractants().get(1));
System.out.println("");
System.out.println(bo);
}
}
System.out.println("Annot count:" + annots.size());
}
use of org.nextprot.api.core.domain.Isoform in project nextprot-api by calipho-sib.
the class ByIsoformPositionComparatorTest method mockIsoform.
private static Isoform mockIsoform(String accession, boolean isCanonical) {
Isoform isoform = Mockito.mock(Isoform.class);
when(isoform.isCanonicalIsoform()).thenReturn(isCanonical);
when(isoform.getIsoformAccession()).thenReturn(accession);
return isoform;
}
Aggregations