Ejemplo n.º 1
0
  @Override
  protected void processMethodAndType(
      EncoreInteraction encoreInteraction, EncoreInteraction mappingEncoreInteraction) {
    Map<MethodTypePair, List<String>> existingMethodTypeToPubmed =
        mappingEncoreInteraction.getMethodTypePairListMap();

    for (Map.Entry<MethodTypePair, List<String>> entry :
        encoreInteraction.getMethodTypePairListMap().entrySet()) {
      if (existingMethodTypeToPubmed.containsKey(entry.getKey())) {
        List<String> existingPubmeds = existingMethodTypeToPubmed.get(entry.getKey());
        List<String> newPubmeds = encoreInteraction.getMethodTypePairListMap().get(entry.getKey());

        for (String pub : newPubmeds) {
          if (!existingPubmeds.contains(pub)) {
            existingPubmeds.add(pub);
          }
        }
      } else {
        existingMethodTypeToPubmed.put(entry.getKey(), entry.getValue());
      }
    }
  }
Ejemplo n.º 2
0
 @Override
 protected EncoreInteraction mergeWithExistingEncoreInteraction(
     EncoreInteraction encoreInteraction, int interactionIdFound) {
   EncoreInteraction
       mappingEcoreInteraction; // include additional information about exp, pubmed, ... for this
   // interaction id
   mappingEcoreInteraction = interactionMapping.get(interactionIdFound);
   if (mappingEcoreInteraction == null) {
     throw new IllegalStateException(
         "Could not find an EncoreInteraction with id: " + interactionIdFound);
   }
   /* Check that interactors are in the same order A=A and B=B */
   boolean swapInteractors = true;
   swap_loop:
   for (String acc : mappingEcoreInteraction.getInteractorAccsA().values()) {
     if (encoreInteraction.getInteractorAccsA().containsValue(acc)) {
       swapInteractors = false;
       break swap_loop;
     }
   }
   if (swapInteractors) {
     mappingEcoreInteraction.addInteractorAccsA(encoreInteraction.getInteractorAccsB());
     mappingEcoreInteraction.addInteractorAccsB(encoreInteraction.getInteractorAccsA());
     mappingEcoreInteraction.addOtherInteractorAccsA(encoreInteraction.getOtherInteractorAccsB());
     mappingEcoreInteraction.addOtherInteractorAccsB(encoreInteraction.getOtherInteractorAccsA());
     mappingEcoreInteraction.addOrganismsA(encoreInteraction.getOrganismsB());
     mappingEcoreInteraction.addOrganismsB(encoreInteraction.getOrganismsA());
   } else {
     mappingEcoreInteraction.addInteractorAccsA(encoreInteraction.getInteractorAccsA());
     mappingEcoreInteraction.addInteractorAccsB(encoreInteraction.getInteractorAccsB());
     mappingEcoreInteraction.addOtherInteractorAccsA(encoreInteraction.getOtherInteractorAccsA());
     mappingEcoreInteraction.addOtherInteractorAccsB(encoreInteraction.getOtherInteractorAccsB());
     mappingEcoreInteraction.addOrganismsA(encoreInteraction.getOrganismsA());
     mappingEcoreInteraction.addOrganismsB(encoreInteraction.getOrganismsB());
   }
   mappingEcoreInteraction.addPublicationId(encoreInteraction.getPublicationIds());
   mappingEcoreInteraction.addExperimentToPubmed(encoreInteraction.getExperimentToPubmed());
   mappingEcoreInteraction.addExperimentToDatabase(encoreInteraction.getExperimentToDatabase());
   processMethodAndType(encoreInteraction, mappingEcoreInteraction);
   mappingEcoreInteraction.addAuthors(encoreInteraction.getAuthors());
   mappingEcoreInteraction.addConfidenceValues(encoreInteraction.getConfidenceValues());
   mappingEcoreInteraction.addSourceDatabases(encoreInteraction.getSourceDatabases());
   mappingEcoreInteraction
       .getDistinctPublications()
       .addAll(encoreInteraction.getDistinctPublications());
   return mappingEcoreInteraction;
 }