/*** * This method will copy properties of interactor source in interactor target and will override all the other properties of Target interactor. * @param source * @param target */ public static void copyAndOverrideBasicInteractorProperties(Interactor source, Interactor target){ if (source != null && target != null){ target.setShortName(source.getShortName()); target.setFullName(source.getFullName()); target.setInteractorType(source.getInteractorType()); target.setOrganism(source.getOrganism()); // copy collections target.getAnnotations().clear(); target.getAnnotations().addAll(source.getAnnotations()); target.getIdentifiers().clear(); target.getIdentifiers().addAll(source.getIdentifiers()); target.getAliases().clear(); target.getAliases().addAll(source.getAliases()); target.getXrefs().clear(); target.getXrefs().addAll(source.getXrefs()); target.getChecksums().clear(); target.getChecksums().addAll(source.getChecksums()); } }
public void writeUniqueIdentifier(P participant) throws IOException { if (participant == null){ writer.write(MitabUtils.EMPTY_COLUMN); } else { Interactor interactor = participant.getInteractor(); // write first identifier if (!interactor.getIdentifiers().isEmpty()){ writeIdentifier(interactor.getPreferredIdentifier()); } else{ writer.write(MitabUtils.EMPTY_COLUMN); } } }
if (!interactor1.getIdentifiers().isEmpty() || !interactor2.getIdentifiers().isEmpty()){ Collection<Xref> identifiers1 = interactor1.getIdentifiers(); Collection<Xref> identifiers2 = interactor2.getIdentifiers(); return identifierCollectionComparator.compare(identifiers1, identifiers2); String shortName1 = interactor1.getShortName(); String shortName2 = interactor2.getShortName(); int comp = shortName1.compareTo(shortName2); String fullName1 = interactor1.getFullName(); String fullName2 = interactor2.getFullName(); if (fullName1 == null && fullName2 == null){ comp = 0; Collection<Alias> aliases1 = interactor1.getAliases(); Collection<Alias> aliases2 = interactor2.getAliases();
if (interactor.getOrganism() != null){ checkOrganism(messages, interactor.getOrganism(), interactor, "interactor"); checkCv(messages, interactor.getInteractorType(), interactor, "interactor"); for (Alias alias : interactor.getAliases()){ checkAlias(messages, alias, interactor, "interactor"); for (Xref ref : interactor.getIdentifiers()){ checkXref(messages, ref, interactor, "interactor"); for (Xref ref : interactor.getXrefs()){ checkXref(messages, ref, interactor, "interactor"); for (Annotation a : interactor.getAnnotations()){ checkAnnotation(messages, a, interactor, "interactor"); for (Checksum a : interactor.getChecksums()){ checkChecksum(messages, a, interactor, "interactor");
private void writeInteractorComponent(Interactor object) throws IOException { MIJsonUtils.writeStartObject(writer); MIJsonUtils.writeProperty("label", JSONValue.escape(object.getShortName()), writer); getCvWriter().write(object.getInteractorType()); if (object.getOrganism() != null){ MIJsonUtils.writeSeparator(writer); MIJsonUtils.writePropertyKey("organism", writer); getOrganismWriter().write(object.getOrganism()); if (object.getPreferredIdentifier() != null){ MIJsonUtils.writeSeparator(writer); MIJsonUtils.writePropertyKey("identifier", writer); getIdentifierWriter().write(object.getPreferredIdentifier());
CvTerm type1 = interactor1.getInteractorType(); CvTerm type2 = interactor2.getInteractorType(); Organism organism1 = interactor1.getOrganism(); Organism organism2 = interactor2.getOrganism();
this.ac = (interactor instanceof IntactInteractor) ? ((IntactInteractor)interactor).getAc() : interactor.getShortName(); this.shortName = interactor.getShortName(); for (Xref xref : interactor.getIdentifiers()) { if (XrefUtils.isXrefFromDatabase(xref, Xref.UNIPROTKB_MI, Xref.UNIPROTKB) && XrefUtils.doesXrefHaveQualifier(xref, Xref.IDENTITY_MI, Xref.IDENTITY)){ for (Alias alias : interactor.getAliases()) { if (AliasUtils.doesAliasHaveType(alias, Alias.GENE_NAME_MI, Alias.GENE_NAME)){ this.shortName = alias.getName();
public void onInteractorTypeUpdate(T protein, CvTerm old) { interactorChangeLogger.log(Level.INFO, "The interactor type" + old.toString() + " has been replaced with " + protein.getInteractorType().toString()+ " in the interactor " + protein.toString()); }
escapeAndWriteString(interactor.getShortName()); writer.write("("); writer.write(MitabUtils.DISPLAY_SHORT); if (interactor.getFullName() != null){ writer.write("|"); writer.write(CvTerm.PSI_MI); writer.write(":"); escapeAndWriteString(interactor.getFullName()); writer.write("("); writer.write(MitabUtils.DISPLAY_LONG); if (!interactor.getAliases().isEmpty()){ Iterator<Alias> aliasIterator = interactor.getAliases().iterator();
interactor.setFullName(fullName); interactor.getIdentifiers().addAll(uniqueId); interactor.getChecksums().addAll(checksum); interactor.getXrefs().addAll(xref);
public void onShortNameUpdate(T protein, String oldShortName) { interactorChangeLogger.log(Level.INFO, "The short name " + oldShortName + " has been updated with " + protein.getShortName() + " in the interactor " + protein.toString()); }
if( interactor.getInteractorType() != null && (RuleUtils.isSmallMolecule( ontologyManager, interactor ) || RuleUtils.isPolysaccharide( ontologyManager, interactor ) )) { final Set<String> dbRefs = RuleUtils.collectNames( dbs ); final Collection<Xref> identities = XrefUtils.searchAllXrefsHavingDatabaseAndQualifier(interactor.getIdentifiers(), dbMiRefs, dbRefs, Arrays.asList(Xref.IDENTITY_MI), Arrays.asList(Xref.IDENTITY)); else if( interactor.getInteractorType() != null && RuleUtils.isBiopolymer(ontologyManager, interactor)) { final Set<String> dbRefs = RuleUtils.collectNames( dbs ); final Collection<Xref> identities = XrefUtils.searchAllXrefsHavingDatabaseAndQualifier(interactor.getIdentifiers(), dbMiRefs, dbRefs, Arrays.asList(Xref.IDENTITY_MI), Arrays.asList(Xref.IDENTITY)); if(identities.isEmpty() ) {
Collection<Xref> identifiers = container.getIdentifiers(); Collection<Xref> databaseReferences = container.getXrefs();
protected void createAliasFromAltId(Interactor interactor, MitabXref ref) { // create alias from xref MitabAlias alias = new MitabAlias(ref.getDatabase().getShortName(), ref.getQualifier(), ref.getId(), ref.getSourceLocator()); interactor.getAliases().add(alias); if (listener != null){ listener.onSyntaxWarning(ref, "Found an Alias in the alternative identifiers column. Will load it as a checksum."); } }
public void onOrganismUpdate(T protein, Organism old) { if (old == null){ interactorChangeLogger.log(Level.INFO, "The organism has been initialised for the interactor " + protein.toString()); } else if (protein.getOrganism() == null){ interactorChangeLogger.log(Level.INFO, "The organism has been reset for the interactor " + protein.toString()); } else { interactorChangeLogger.log(Level.INFO, "The organism " + old.toString() + " has been replaced with " + protein.getOrganism() + " in the interactor " + protein.toString()); } }
protected void processInteractorPool(Collection<MitabXref> xref, InteractorPool interactor) { InteractorPool pool = (InteractorPool)interactor; for (Xref ref : xref){ // we have a component of the interactor pool if (XrefUtils.doesXrefHaveQualifier(ref, Xref.INTERACTOR_SET_QUALIFIER_MI, Xref.INTERACTOR_SET_QUALIFIER)){ Interactor subInteractor = interactorFactory.createInteractorFromDatabase(ref.getDatabase(), ref.getId().toLowerCase()); if (subInteractor != null){ subInteractor.getIdentifiers().add(new MitabXref(ref.getDatabase(), ref.getId(), ref.getVersion(), CvTermUtils.createIdentityQualifier())); ((MitabInteractor)subInteractor).setSourceLocator(((MitabXref)ref).getSourceLocator()); } // create a default interactor else{ subInteractor = interactorFactory.createInteractor(ref.getId().toLowerCase(), CvTermUtils.createUnknownInteractorType()); subInteractor.getIdentifiers().add(new MitabXref(ref.getDatabase(), ref.getId(), ref.getVersion(), CvTermUtils.createIdentityQualifier())); ((MitabInteractor)subInteractor).setSourceLocator(((MitabXref)ref).getSourceLocator()); } // add the component to the interactor pool pool.add(subInteractor); } // we have a simple xref else{ pool.getXrefs().add(ref); } } }
public void writeParticipantAnnotations(P participant) throws IOException { if (participant != null){ if (!participant.getInteractor().getAnnotations().isEmpty()){ Iterator<Annotation> interactorAnnotationIterator = participant.getInteractor().getAnnotations().iterator();
if (!participant.getInteractor().getXrefs().isEmpty()){ Iterator<Xref> interactorXrefIterator = participant.getInteractor().getXrefs().iterator(); while (interactorIterator.hasNext()){ Interactor subInteractor = interactorIterator.next(); Xref preferredId = subInteractor.getPreferredIdentifier(); if (preferredId != null){ getWriter().write(MitabUtils.FIELD_SEPARATOR); while (interactorIterator.hasNext()){ Interactor subInteractor = interactorIterator.next(); Xref preferredId = subInteractor.getPreferredIdentifier(); if (preferredId != null){ getWriter().write(MitabUtils.FIELD_SEPARATOR); while (interactorIterator.hasNext()){ Interactor subInteractor = interactorIterator.next(); Xref preferredId = subInteractor.getPreferredIdentifier(); if (preferredId != null){ if (!first){
public void writeParticipantChecksums(P participant) throws IOException { if (participant != null){ if (!participant.getInteractor().getChecksums().isEmpty()){ Iterator<Checksum> checksumIterator = participant.getInteractor().getChecksums().iterator(); while(checksumIterator.hasNext()){ writeChecksum(checksumIterator.next()); if (checksumIterator.hasNext()){ getWriter().write(MitabUtils.FIELD_SEPARATOR); } } } else{ getWriter().write(MitabUtils.EMPTY_COLUMN); } } else { getWriter().write(MitabUtils.EMPTY_COLUMN); } }
Interactor interactor = object.getInteractor(); keyValues = MIJsonUtils.extractInteractionId(interactor.getPreferredIdentifier(), (Complex)interactor); keyValues = MIJsonUtils.extractInteractorId(interactor.getPreferredIdentifier(), interactor);