public int compare( Component p1, Component p2 ) { Interactor i1 = p1.getInteractor(); if ( i1 == null ) { throw new IllegalArgumentException( "Both participant should hold a valid interactor." ); } Interactor i2 = p2.getInteractor(); if ( i2 == null ) { throw new IllegalArgumentException( "Both participant should hold a valid interactor." ); } String name1 = i1.getShortLabel(); String name2 = i2.getShortLabel(); int result; if ( name1 == null ) { result = -1; } else if ( name2 == null ) { result = 1; } else { result = name1.compareTo( name2 ); } return result; } } );
private void synchronizeInteractor( Interactor interactor, boolean synchronizeAnnotatedAtributes ) { if (IntactCore.isInitializedAndDirty(interactor.getActiveInstances())){ Collection<Component> activeInstances = synchronizeCollection(interactor.getActiveInstances()); interactor.getActiveInstances().clear(); interactor.getActiveInstances().addAll(activeInstances); } interactor.setBioSource( synchronize( interactor.getBioSource() ) ); interactor.setCvInteractorType( synchronize( interactor.getCvInteractorType() ) ); if (synchronizeAnnotatedAtributes){ synchronizeAnnotatedObjectCommons( interactor ); } }
/** * Tells if the given IntAct Protein has already been generated in PSI. * * @return true is the protein has already been converted to XML, otherwise false. */ public boolean isAlreadyDefined( Interactor interactor ) { return interactors.containsKey( interactor.getAc() ); }
@Override protected boolean update(T candidateObject, T objectToUpdate) throws PersisterException { Collection<InteractorXref> objToUpdateXrefs = objectToUpdate.getXrefs(); for (InteractorXref xref : candidateObject.getXrefs()) { if (!objToUpdateXrefs.contains(xref)) { objectToUpdate.addXref(xref); } } for (InteractorAlias alias : candidateObject.getAliases()) { objectToUpdate.addAlias(alias); } super.updateCommonAttributes(candidateObject, objectToUpdate); return true; } }
/** * TODO: base this methods on the interactor equals (except AC check) */ @Override protected BehaviourType syncedAndCandidateAreEqual(T synced, T candidate) { if (synced == null) return BehaviourType.NEW; if (synced.getXrefs().size() != candidate.getXrefs().size()) { return BehaviourType.UPDATE; } if (synced.getAliases().size() != candidate.getAliases().size()) { return BehaviourType.UPDATE; } return BehaviourType.IGNORE; }
psidev.psi.mi.tab.model.Alias displayLong = new AliasImpl( CvDatabase.PSI_MI, polymer.getShortLabel(), InteractorConverter.DISPLAY_LONG ); mitabInteractor.getAliases().add(displayLong); if (polymer.getAc() != null){ if(polymer.getAc() != null){ if (!hasFoundDisplayShort){ psidev.psi.mi.tab.model.Alias altId = new AliasImpl( CvDatabase.PSI_MI, polymer.getShortLabel(),InteractorConverter.DISPLAY_SHORT ); mitabInteractor.getAliases().add(altId); psidev.psi.mi.tab.model.Alias displayLong = new AliasImpl( CvDatabase.PSI_MI, polymer.getAc(),InteractorConverter.DISPLAY_LONG ); mitabInteractor.getAliases().add(displayLong); CrossReference id = new CrossReferenceImpl( defaultInstitution, polymer.getShortLabel()); mitabInteractor.getIdentifiers().add(id); psidev.psi.mi.tab.model.Alias altId = new AliasImpl( CvDatabase.PSI_MI, polymer.getShortLabel(),InteractorConverter.DISPLAY_SHORT ); mitabInteractor.getAliases().add(altId); psidev.psi.mi.tab.model.Alias displayLong = new AliasImpl( CvDatabase.PSI_MI, polymer.getShortLabel(),InteractorConverter.DISPLAY_LONG ); mitabInteractor.getAliases().add(displayLong);
String species = interactor.getBioSource().getTaxId(); bait = interactor.getShortLabel(); String prey = interactor.getShortLabel(); stmt.executeUpdate("INSERT INTO ia_payg_current_edge " + "VALUES(\'" + bait + "\',\'" + prey + "\',0,0,\'" + species + "\')"); "AC: " + interactor.getAc() + " Shortlabel:" + interactor.getShortLabel());
final String iii = INDENT + INDENT + INDENT + INDENT; out.write( i + "<entry id=\"" + interactor.getAc() + "\">" + NEW_LINE ); out.write( ii + "<name>" + interactor.getShortLabel() + "</name>" + NEW_LINE ); if ( interactor.getFullName() != null ) { out.write( ii + "<description>" + escapeXml( interactor.getFullName() ) + "</description>" + NEW_LINE ); writeCreationDate( out, interactor.getCreated(), iii ); writeLastUpdateDate( out, interactor.getUpdated(), iii ); out.write( ii + "</dates>" + NEW_LINE ); boolean hasXrefs = !interactor.getXrefs().isEmpty(); boolean hasLinks = !interactor.getActiveInstances().isEmpty(); for ( Xref xref : interactor.getXrefs() ) { Set<String> experimentAcs = new HashSet<String>(); for ( Component c : interactor.getActiveInstances() ) { for ( Alias alias : interactor.getAliases() ) { String aliasName = escapeXml( alias.getName() ); writeField( out, alias.getCvAliasType().getShortLabel(), aliasName, iii ); for ( Component c : interactor.getActiveInstances() ) { Interaction interaction = c.getInteraction(); cvs.add( interaction.getCvInteractionType() );
protected void traverseInteractor(Interactor interactor, IntactVisitor ... visitors) { if (interactor == null) return; for (IntactVisitor visitor : visitors) { visitor.visitInteractor(interactor); } // check if this element has been traversed already, to avoid cyclic recursion if (recursionChecker.isAlreadyTraversed(interactor)) { return; } traverse(interactor.getCvInteractorType(), visitors); traverse(interactor.getBioSource(), visitors); }
clone.setBioSource(clone(interactor.getBioSource())); clone.setCvInteractorType(clone(interactor.getCvInteractorType())); clone.setObjClass(interactor.getObjClass());
if (intactObject.getCvInteractorType() != null){ InteractorType interactorType = this.interactorTypeConverter.intactToPsi(intactObject.getCvInteractorType()); interactor.setInteractorType( interactorType ); log.error("Interactor without interactor type : " + intactObject.getShortLabel()); if (intactObject.getBioSource() != null) { Organism organism = this.organismConverter.intactToPsi(intactObject.getBioSource()); interactor.setOrganism(organism);
return protein.getShortLabel(); for (Alias alias : protein.getAliases()) { CvAliasType aliasType = alias.getCvAliasType(); if (aliasType != null) { geneName = protein.getShortLabel();
@Override protected void saveOrUpdateAttributes(T intactObject) throws PersisterException { super.saveOrUpdateAttributes(intactObject); if (intactObject.getBioSource() != null) { BioSourcePersister.getInstance().saveOrUpdate(intactObject.getBioSource()); } if (intactObject.getCvInteractorType() != null) { CvObjectPersister.getInstance().saveOrUpdate(intactObject.getCvInteractorType()); } if ( intactObject.getActiveInstances() != null ) { for ( Component c : intactObject.getActiveInstances() ) { ComponentPersister.getInstance().saveOrUpdate( c ); } } }
protected void copyInteractorCommons( Interactor source, Interactor target ) { if ( target.getBioSource() != null && source.getBioSource() == null ) { throw new PersisterException( "Operation not permitted: nullifying biosource of a " + target.getClass().getSimpleName() + " (" + target.getShortLabel() + ") - " + " current biosource is " + target.getBioSource().getShortLabel() ); } copyProperty(source, "bioSource", target); copyProperty(source, "cvInteractorType", target); }
public Collection<Field> fieldsForInteractor( Interactor interactor ) { Collection<Field> fields = new ArrayList<Field>(); Field primaryIdField = new Field(); primaryIdField.setName( "Interactor type" ); final String type = ( interactor.getCvInteractorType() == null ? "-" : interactor.getCvInteractorType().getShortLabel() ); primaryIdField.setValue( type ); return fields; }
protected void indexInteractorNames(Interactor interactor, SolrInputDocument solrDocument){ // shortname solrDocument.addField ( ComplexFieldNames.INTERACTOR_ALIAS, interactor.getShortLabel ( ) ) ; // fullname if (interactor.getFullName() != null){ solrDocument.addField ( ComplexFieldNames.INTERACTOR_ALIAS, interactor.getFullName ( ) ) ; } // aliases for ( Alias alias : interactor.getAliases ( ) ) { if (alias.getName() != null){ if (alias.getCvAliasType() != null){ CvAliasType type = alias.getCvAliasType(); solrDocument.addField ( ComplexFieldNames.INTERACTOR_ALIAS, type.getShortLabel() ) ; solrDocument.addField ( ComplexFieldNames.INTERACTOR_ALIAS, alias.getName() ) ; solrDocument.addField ( ComplexFieldNames.INTERACTOR_ALIAS, type.getShortLabel()+":"+alias.getName()) ; } else{ solrDocument.addField ( ComplexFieldNames.INTERACTOR_ALIAS, alias.getName()); } } } }
/** * Return the xref of the protein having as cvQualifier, the CvQualifier with psi-mi equal to * CvXrefQualifier.IDENTITY_MI_REF and as cvDatabase, the CvDatabase with psi-mi equal to CvDatabase.UNIPROT_MI_REF * and returns it. Return null otherwise. * * @param protein a non null Protein object. * @return the uniprotkb identity xref if the protein has one, null otherwise. */ public static InteractorXref getUniprotXref(Interactor protein) { if (protein == null) { throw new NullPointerException("Protein is null, shouldn't be null"); } Collection<InteractorXref> xrefs = protein.getXrefs(); for (InteractorXref xref : xrefs) { CvXrefQualifier qualifier = xref.getCvXrefQualifier(); if (qualifier != null) { String qualifierIdentity = qualifier.getIdentifier(); if (qualifierIdentity != null && CvXrefQualifier.IDENTITY_MI_REF.equals(qualifierIdentity)) { CvDatabase database = xref.getCvDatabase(); String databaseIdentity = database.getIdentifier(); if (databaseIdentity != null && CvDatabase.UNIPROT_MI_REF.equals(databaseIdentity)) { return xref; } } } } return null; }
private void indexFields(SolrInputDocument solrDocument) throws SolrServerException { Interactor interactor = component.getInteractor(); if (interactor != null){ // index interactor ac indexInteractorAC(interactor, solrDocument); // index interactor names indexInteractorNames(interactor, solrDocument); // index interactor type enricher.enrichInteractorType(interactor.getCvInteractorType(), solrDocument); // index and enrich xrefs enricher.enrichInteractorXref(interactor.getXrefs(), solrDocument); } // index biological role if (component.getCvBiologicalRole() != null){ enricher.enrichBiologicalRole(component.getCvBiologicalRole(), solrDocument); } // index features indexfeatures(solrDocument); // enrich sons if necessary if (hasSons()){ for (TreeComponents t : sons){ t.indexFields(solrDocument); } } }
protected Set<SimpleBioSource> getBioSourcesForExperimentInteractions(Experiment experiment) { Set<SimpleBioSource> allBioSources = new HashSet<SimpleBioSource>(); String experimentAc = experiment.getAc(); int firstResult = 0; int maxResults = 50; Collection<Interaction> interactions; do { beginTransaction(); interactions = getDataContext().getDaoFactory() .getExperimentDao().getInteractionsForExperimentWithAc(experimentAc, firstResult, maxResults); for (Interaction interaction : interactions) { for (Component component : interaction.getComponents()) { BioSource bioSource = component.getInteractor().getBioSource(); if (bioSource != null) { allBioSources.add(new SimpleBioSource(bioSource)); } else { if (log.isDebugEnabled()) log.debug("Interactor without biosource: "+component.getInteractor()); } } } commitTransaction(); firstResult += maxResults; } while (!interactions.isEmpty()); return allBioSources; }
interactor.setBioSource(bioSource); log.error("Interactor not considered as polymer but which contains a sequence : " + interactor.getShortLabel() + ". The sequence will be ignored.");