use of org.nextprot.api.core.domain.Interaction 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.Interaction 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.Interaction in project nextprot-api by calipho-sib.
the class InteractionFieldBuilder method init.
@Override
protected void init(Entry entry) {
// WAIT FOR BIO OBJECTS !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// String id = entry.getUniqueName();
String recName = "";
String interactantAC = "";
List<Interaction> interactions = entry.getInteractions();
// System.err.println(interactions.size() + " interactions");
for (Interaction currinteraction : interactions) {
// System.err.println(currinteraction.getEvidenceXrefAC()); // EBI-372273,EBI-603319
List<Interactant> interactants = currinteraction.getInteractants();
for (Interactant currinteractant : interactants) {
if (currinteractant.getGenename() != null) {
// otherwise it is the entry itself
interactantAC = currinteractant.getAccession();
if (currinteractant.isNextprot()) {
interactantAC = "NX_" + interactantAC.split("-")[0];
// We need the entryBuilderService to get interactant's recname
recName = entryBuilderService.build(EntryConfig.newConfig(interactantAC).withOverview()).getOverview().getMainProteinName();
} else
// Xeno interaction
recName = "";
if (!this.isGold() || currinteraction.getQuality().equals("GOLD"))
addField(Fields.INTERACTIONS, "AC: " + interactantAC + " gene: " + currinteractant.getGenename() + " name: " + recName + " refs: " + currinteraction.getEvidenceXrefAC());
} else if (currinteraction.isSelfInteraction() == true)
if (!this.isGold() || currinteraction.getQuality().equals("GOLD"))
addField(Fields.INTERACTIONS, "selfInteraction");
}
}
List<Annotation> annots = entry.getAnnotations();
for (Annotation currannot : annots) if (// Always GOLD
currannot.getCategory().equals("subunit"))
addField(Fields.INTERACTIONS, currannot.getDescription());
/*
//Gets interactions using xrefs
List<DbXref> xrefs = entry.getXrefs();
for (DbXref xref : xrefs) {
String acc = xref.getAccession();
String db = xref.getDatabaseName();
// wrong for nextprot gene designation -> protein name
if ((db.equals("UniProt") || db.equals("neXtProt")) && !id.contains(acc)) {
String gen = xref.getPropertyValue("gene designation");
if (gen != null && gen != "-") {
gen = gen.toUpperCase();
addField(Fields.INTERACTIONS, gen);
}
}
}
//WAIT FOR BIO OBJECTS !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
}*/
}
Aggregations