public void writeComplexExpansion(T binary) throws IOException { if (binary.getComplexExpansion() != null){ writeCvTerm(binary.getComplexExpansion()); } else { getWriter().write(MitabUtils.EMPTY_COLUMN); } }
public BinaryInteraction createBasicBinaryInteractionFrom(Interaction interaction, Participant p1, Participant p2, CvTerm expansionMethod){ BinaryInteraction binary = instantiateNewBinaryInteraction(); binary.setComplexExpansion(expansionMethod); InteractionCloner.copyAndOverrideBasicInteractionProperties(interaction, binary, false, true); binary.setParticipantA(p1); binary.setParticipantB(p2); return binary; }
public void writeInteractionChecksums(T interaction) throws IOException { if (!interaction.getChecksums().isEmpty()){ Iterator<Checksum> checksumIterator = interaction.getChecksums().iterator(); while(checksumIterator.hasNext()){ writeChecksum(checksumIterator.next()); if (checksumIterator.hasNext()){ getWriter().write(MitabUtils.FIELD_SEPARATOR); } } } else{ getWriter().write(MitabUtils.EMPTY_COLUMN); } }
@Override protected void addParticipant(Participant participant, BinaryInteraction interaction) { if (interaction.getParticipantA() != null){ interaction.setParticipantB(participant); } else { interaction.setParticipantA(participant); } } }
target.setParticipantA(null); target.setParticipantB(null); target.setParticipantA(first); if (self){ Participant clone = new DefaultParticipant(first.getInteractor()); clone.setStoichiometry(0); target.setParticipantB(clone); target.setParticipantB(iterator.next()); target.setParticipantB(null); Participant clone = new DefaultParticipant(first.getInteractor()); ParticipantCloner.copyAndOverrideBasicParticipantProperties(first, clone, true); target.setParticipantA(clone); clone2.setStoichiometry(0); target.setParticipantB(clone2); Participant clone2 = new DefaultParticipant(second.getInteractor()); ParticipantCloner.copyAndOverrideBasicParticipantProperties(second, clone2, true); target.setParticipantB(clone2); target.setParticipantB(null);
@Override protected void initialiseExpansionMethod(Collection<MitabCvTerm> expansion, BinaryInteraction interaction) { if (expansion.size() > 1){ if (getParserListener() != null){ getParserListener().onSeveralCvTermsFound(expansion, expansion.iterator().next(), expansion.size()+" complex expansions found. Only the first one will be loaded."); } interaction.setComplexExpansion(expansion.iterator().next()); } else if (!expansion.isEmpty()){ interaction.setComplexExpansion(expansion.iterator().next()); } }
/** * Writes a binary interaction. * Does not write any extended properties from participants, interaction and features * This method will write empty columns for interaction detection method, publication author and identifier, * source and confidences. * It will also ignore experimental roles, host organism, interaction parameters and participant identification methods * @param interaction * @throws MIIOException */ public void write(T interaction) throws MIIOException { if (!isInitialised){ throw new IllegalStateException("The mitab writer was not initialised. The options for the Mitab25Writer should contain at least "+ InteractionWriterOptions.OUTPUT_OPTION_KEY + " to know where to write the interactions."); } try{ P A = (P) interaction.getParticipantA(); P B = (P) interaction.getParticipantB(); writeBinary(interaction, A, B); } catch (IOException e) { throw new MIIOException("Impossible to write " +interaction.toString(), e); } }
public void writeInteractionIdentifiers(BinaryInteraction interaction) throws IOException { Collection<Xref> imexId = XrefUtils.collectAllXrefsHavingDatabaseAndQualifier(interaction.getXrefs(), Xref.IMEX_MI, Xref.IMEX, Xref.IMEX_PRIMARY_MI, Xref.IMEX_PRIMARY); if (!interaction.getIdentifiers().isEmpty()){ Iterator<Xref> identifierIterator = interaction.getIdentifiers().iterator();
getWriter().write(MitabUtils.COLUMN_SEPARATOR); columnFeeder.writeDate(interaction.getCreatedDate()); getWriter().write(MitabUtils.COLUMN_SEPARATOR); columnFeeder.writeDate(interaction.getUpdatedDate()); getWriter().write(MitabUtils.COLUMN_SEPARATOR);
public void writeInteractionType(T interaction) throws IOException { writeCvTerm(interaction.getInteractionType()); }
public void writeInteractionAnnotations(BinaryInteraction interaction) throws IOException { // writes interaction annotations first if (!interaction.getAnnotations().isEmpty()){ Iterator<Annotation> interactionAnnotationIterator = interaction.getAnnotations().iterator(); while (interactionAnnotationIterator.hasNext()){ Annotation annot = interactionAnnotationIterator.next(); writeAnnotation(annot); if(interactionAnnotationIterator.hasNext()){ getWriter().write(MitabUtils.FIELD_SEPARATOR); } } } else{ getWriter().write(MitabUtils.EMPTY_COLUMN); } }
if (binary.getComplexExpansion() != null){ MIJsonUtils.writeSeparator(writer); MIJsonUtils.writePropertyKey("expansion", writer); writeExpansionMethod(binary.getComplexExpansion());