public void onImexIdentifierUpdate(Publication publication, Xref oldId) { if (oldId == null){ publicationChangeLogger.log(Level.INFO, "The IMEx identifier has been initialised for the publication " + publication.toString()); } else if (publication.getImexId() == null){ publicationChangeLogger.log(Level.INFO, "The IMEx identifier has been reset for the publication " + publication.toString()); } else { publicationChangeLogger.log(Level.INFO, "The IMEx identifier " + oldId + " has been updated with " + publication.getImexId() + " in the publication " + publication.toString()); } }
/** * Make sure that an experiment has a valid IMEX id in its xref. * * @param pub a publication to check on. * @return a collection of validator messages. */ public Collection<ValidatorMessage> check( Publication pub ) throws ValidatorException { // Check xRef return PublicationRuleUtils.checkImexId(pub.getImexId(), pub, this); }
public psidev.psi.mi.jami.model.Publication fetchByIdentifier( String identifier, String source ) throws BridgeFailedException { for ( psidev.psi.mi.jami.model.Publication p : allPublications ) { for (Xref i : p.getIdentifiers()){ if( XrefUtils.doesXrefHaveDatabaseAndId(i, null, source, identifier) ) { return p; } } if (p.getImexId() != null && p.getImexId().equalsIgnoreCase(identifier)){ return p; } } return null; }
protected void writePublicationImexId(Publication pub, boolean writeFieldSeparator) throws IOException { // IMEx as well if (pub.getImexId() != null) { if (writeFieldSeparator){ getWriter().write(MitabUtils.FIELD_SEPARATOR); } getWriter().write(Xref.IMEX); getWriter().write(MitabUtils.XREF_SEPARATOR); escapeAndWriteString(pub.getImexId()); } }
@Override @Transactional(value = "jamiTransactionManager", propagation = Propagation.REQUIRED) public int getNextImexChunkNumberAndFilterValidImexIdsFrom(Publication publication){ if (publication instanceof IntactPublication){ int number = 0; List<String> ids = new ArrayList<String>(collectExistingInteractionImexIdsForPublication((IntactPublication)publication)); for (String id : ids){ Matcher matcher = getInteraction_imex_regexp().matcher(id); if (matcher.find()){ String pubImex = matcher.group(1); // valid imex id in sync with publication if (publication.getImexId() != null && publication.getImexId().equals(pubImex)){ int index = Integer.parseInt(matcher.group(2)); if (number < index){ number = index; } } } } return number+1; } else{ return super.getNextImexChunkNumberAndFilterValidImexIdsFrom(publication); } }
public psidev.psi.mi.jami.model.Publication fetchPublicationImexAccession( String identifier, String source, boolean create ) throws BridgeFailedException { final psidev.psi.mi.jami.model.Publication p = fetchByIdentifier(identifier, source); if (p != null){ if( create ) { if( p.getImexId() != null) { throw new IllegalStateException( "Publication already has an IMEx id: " + p.getImexId() ); } // assigning new IMEx ID p.assignImexId("IM-" + imexIdSequence); imexIdSequence++; } } else { ImexCentralFault imexFault = new ImexCentralFault(); imexFault.setFaultCode(6); IcentralFault fault = new IcentralFault("No publication record found", imexFault); throw new BridgeFailedException(fault); } return p; } }
else if (pub.getImexId() != null) { writePublicationImexId(pub, false);
public void write(Publication object) throws IOException { if (!object.getIdentifiers().isEmpty()){ MIJsonUtils.writePropertyKey("pubid", writer); MIJsonUtils.writeOpenArray(writer); Iterator<Xref> identifierIterator = object.getIdentifiers().iterator(); while (identifierIterator.hasNext()){ getIdentifierWriter().write(identifierIterator.next()); if (identifierIterator.hasNext()){ MIJsonUtils.writeSeparator(writer); } } if (object.getImexId() != null){ MIJsonUtils.writeSeparator(writer); MIJsonUtils.writeProperty("imex", JSONValue.escape(object.getImexId()), writer); } MIJsonUtils.writeEndArray(writer); } else if (object.getImexId() != null){ MIJsonUtils.writePropertyKey("pubid", writer); MIJsonUtils.writeOpenArray(writer); MIJsonUtils.writeProperty("imex", JSONValue.escape(object.getImexId()), writer); MIJsonUtils.writeEndArray(writer); } // publication source if (object.getSource() != null){ MIJsonUtils.writeSeparator(writer); MIJsonUtils.writePropertyKey("sourceDatabase", writer); getCvWriter().write(object.getSource()); } }
Publication pub = new Publication(); pub.setTitle(publication.getTitle()); pub.setImexAccession(publication.getImexId()); for (Xref id : publication.getIdentifiers()){ Identifier identifier = buildIdentifier(id.getId(), id.getDatabase().getShortName());