use of org.nextprot.api.core.domain.BioObject in project nextprot-api by calipho-sib.
the class BinaryInteraction2Annotation method newBioObject.
static BioObject newBioObject(Interactant interactant, MainNamesService mainNamesService) {
BioObject.BioType bioType = (interactant.isIsoform()) ? BioObject.BioType.PROTEIN_ISOFORM : BioObject.BioType.PROTEIN;
BioObject be = (interactant.isNextprot()) ? BioObject.internal(bioType) : BioObject.external(bioType, interactant.getDatabase());
be.setId(interactant.getXrefId());
be.setAccession((interactant.isNextprot()) ? interactant.getNextprotAccession() : interactant.getAccession());
if (interactant.getGenename() != null)
be.getProperties().put("geneName", interactant.getGenename());
if (interactant.isNextprot()) {
String ac = interactant.getNextprotAccession();
String masterAc = mainNamesService.findIsoformOrEntryMainName().get(ac).getEntryAccession();
String proteinName = mainNamesService.findIsoformOrEntryMainName().get(masterAc).getName();
be.getProperties().put("proteinName", proteinName);
if (interactant.isIsoform()) {
String isoName = mainNamesService.findIsoformOrEntryMainName().get(ac).getName();
be.getProperties().put("isoformName", isoName);
}
}
if (interactant.getUrl() != null)
be.getProperties().put("url", interactant.getUrl());
return be;
}
use of org.nextprot.api.core.domain.BioObject in project nextprot-api by calipho-sib.
the class AnnotationUpdater method updateDestBioObject.
@Override
protected void updateDestBioObject(Annotation dest, Annotation source) {
BioObject destBioObject = dest.getBioObject();
BioObject srcBioObject = source.getBioObject();
if (srcBioObject != null && srcBioObject.getProperties() != null) {
updateDestBioObjectProperties(destBioObject, srcBioObject.getProperties());
}
}
use of org.nextprot.api.core.domain.BioObject 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.BioObject in project nextprot-api by calipho-sib.
the class ByAnnotationBioObjectComparatorTest method mockBioObject.
private static BioObject mockBioObject(BioObject.BioType bioType, BioObject.ResourceType resourceType, String hash) {
BioObject bgo = Mockito.mock(BioObject.class);
when(bgo.getBioType()).thenReturn(bioType);
when(bgo.getResourceType()).thenReturn(resourceType);
when(bgo.getAnnotationHash()).thenReturn(hash);
return bgo;
}
use of org.nextprot.api.core.domain.BioObject in project nextprot-api by calipho-sib.
the class AnnotationUtilsTest method testConvertEvidenceToExternalBioObject.
// ----------------------------------
@Test
public void testConvertEvidenceToExternalBioObject() {
AnnotationEvidence ev = new AnnotationEvidence();
ev.setResourceAccession("CHEBI:38290");
ev.setResourceAssociationType("relative");
ev.setResourceDb("ChEBI");
ev.setResourceId(39334228);
BioObject bo = AnnotationUtils.newExternalChemicalBioObject(ev);
Assert.assertEquals("CHEBI:38290", bo.getAccession());
Assert.assertEquals("ChEBI", bo.getDatabase());
Assert.assertEquals(39334228, bo.getId());
Assert.assertEquals(BioObject.BioType.CHEMICAL, bo.getBioType());
}
Aggregations