public Collection<Xref> getIdentifiers() { return wrappedInteraction.getIdentifiers(); }
protected boolean hasIdentifiers(I object) { return !object.getIdentifiers().isEmpty(); }
protected void writeAllIdentifiers(I object) throws IOException { if (!object.getIdentifiers().isEmpty()){ MIJsonUtils.writeOpenArray(writer); Iterator<Xref> identifierIterator = object.getIdentifiers().iterator(); while (identifierIterator.hasNext()){ getIdentifierWriter().write(identifierIterator.next()); if (identifierIterator.hasNext()){ MIJsonUtils.writeSeparator(writer); } } writeOtherIdentifiers(object); MIJsonUtils.writeEndArray(writer); } }
protected void initialiseInteractionIdentifiers(Collection<MitabXref> interactionIds, T interaction){ Iterator<MitabXref> refsIterator = interactionIds.iterator(); while (refsIterator.hasNext()){ MitabXref ref = refsIterator.next(); if (XrefUtils.isXrefFromDatabase(ref, Xref.IMEX_MI, Xref.IMEX) && XrefUtils.doesXrefHaveQualifier(ref, Xref.IMEX_PRIMARY_MI, Xref.IMEX_PRIMARY)){ interaction.getXrefs().add(ref); } else if (XrefUtils.isXrefFromDatabase(ref, Checksum.RIGID_MI, Checksum.RIGID) || XrefUtils.isXrefFromDatabase(ref, null, Checksum.IRIGID)){ createChecksumFromId(interaction, ref); } else{ interaction.getIdentifiers().add(ref); } } }
if (!interaction1.getIdentifiers().isEmpty() && !interaction2.getIdentifiers().isEmpty()){ return ComparatorUtils.findAtLeastOneMatchingIdentifier(interaction1.getIdentifiers(), interaction2.getIdentifiers());
if (!interaction1.getIdentifiers().isEmpty() || !interaction2.getIdentifiers().isEmpty()){ Collection<Xref> identifiers1 = interaction1.getIdentifiers(); Collection<Xref> identifiers2 = interaction2.getIdentifiers();
if (!interaction.getIdentifiers().isEmpty()){ List<Xref> list1 = new ArrayList<Xref>(interaction.getIdentifiers());
target.getXrefs().clear(); target.getXrefs().addAll(source.getXrefs()); target.getIdentifiers().clear(); target.getIdentifiers().addAll(source.getIdentifiers());
/** * This method will copy basic properties from the Interaction source in the complex target. * It will erase existing annotations, xrefs, checksums and identifiers * This method does not copy the participants of the source * @param source * @param target */ public static void copyAndOverrideBasicComplexPropertiesWithInteractionProperties(Interaction source, Complex target){ if (source != null && target != null){ target.setInteractionType(source.getInteractionType()); target.setCreatedDate(source.getCreatedDate()); target.setUpdatedDate(source.getUpdatedDate()); if (source.getShortName() != null){ target.setShortName(source.getShortName()); } // copy collections target.getAnnotations().clear(); target.getAnnotations().addAll(source.getAnnotations()); target.getXrefs().clear(); target.getXrefs().addAll(source.getXrefs()); target.getIdentifiers().clear(); target.getIdentifiers().addAll(source.getIdentifiers()); target.getChecksums().clear(); target.getChecksums().addAll(source.getChecksums()); } }
public void write(I object) throws IOException { Xref preferredIdentifier = !object.getIdentifiers().isEmpty() ? (Xref)object.getIdentifiers().iterator().next() : null; String[] keyValues = generateInteractionIdentifier(object, preferredIdentifier); String id = null;
/** * For each cross reference of this XrefContainer, collects all respective cross reference type(s) and * check if the dependencies are correct. * * @param container to check on. * @return a collection of validator messages. * if we fail to retreive the MI Ontology. */ public Collection<ValidatorMessage> check( Interaction container) throws ValidatorException { Collection<ValidatorMessage> messages = new ArrayList<ValidatorMessage>(); // Collect the db references Collection<Xref> databaseReferences = container.getXrefs(); for ( Xref reference : databaseReferences) { MiContext context = RuleUtils.buildContext(reference, "database xref"); context.addAssociatedContext(RuleUtils.buildContext(container, "interaction")); // build a context in case of error messages.addAll( mapping.check( reference.getDatabase(), reference.getQualifier(), context, this ) ); } // Collect the identifiers Collection<Xref> identifiers = container.getIdentifiers(); for ( Xref reference : identifiers) { MiContext context = RuleUtils.buildContext(reference, "database xref"); context.addAssociatedContext(RuleUtils.buildContext(container, "interaction")); // build a context in case of error messages.addAll( mapping.check( reference.getDatabase(), reference.getQualifier(), context, this ) ); } return messages; }