public Collection<GeneralMessage> check(Experiment experiment) throws SanityRuleException { Collection<GeneralMessage> messages = new ArrayList<GeneralMessage>(); if(experiment.getBioSource() == null){ messages.add(new GeneralMessage( MessageDefinition.EXPERIMENT_WITHOUT_BIOSOURCE, experiment )); } return messages; } }
@Override public String toString() { StringBuffer result = new StringBuffer( 512 ); result.append( "Experiment [AC: " + this.getAc() + " Shortlabel: " + getShortLabel() ); result.append( " BioSource: " + ( getBioSource() == null ? "-" : getBioSource().getShortLabel() ) ); result.append( NEW_LINE ); result.append( "CvIdentification: " + ( cvIdentification == null ? "-" : cvIdentification.getShortLabel() ) ); result.append( NEW_LINE ); result.append( "CvInteraction: " + ( cvInteraction == null ? "NOT SPECIFIED" : cvInteraction.getShortLabel() ) ); result.append( NEW_LINE ); result.append( ']' ); return result.toString(); } }
@Override public String toString() { StringBuffer result = new StringBuffer( 512 ); result.append( "Experiment [AC: " + this.getAc() + " Shortlabel: " + getShortLabel() ); result.append( " BioSource: " + ( getBioSource() == null ? "-" : getBioSource().getShortLabel() ) ); result.append( NEW_LINE ); result.append( "CvIdentification: " + ( cvIdentification == null ? "-" : cvIdentification.getShortLabel() ) ); result.append( NEW_LINE ); result.append( "CvInteraction: " + ( cvInteraction == null ? "NOT SPECIFIED" : cvInteraction.getShortLabel() ) ); result.append( NEW_LINE ); result.append( ']' ); return result.toString(); } }
public static String getSpeciesTaxId(InteractionImpl complex) { if (!complex.getExperiments().isEmpty()) { Experiment exp = complex.getExperiments().iterator().next(); BioSource bioSource = exp.getBioSource(); if (bioSource != null) { return bioSource.getTaxId(); } } return null; }
public static String getSpeciesTaxId(InteractionImpl complex) { if (!complex.getExperiments().isEmpty()) { Experiment exp = complex.getExperiments().iterator().next(); BioSource bioSource = exp.getBioSource(); if (bioSource != null) { return bioSource.getTaxId(); } } return null; }
@Override public String toString() { StringBuffer result = new StringBuffer( 128 ); result.append( "Experiment [AC: " + this.getAc() + " Shortlabel: " + getShortLabel() ); result.append( " BioSource: " + ( getBioSource() == null ? "-" : getBioSource().getShortLabel() ) ); result.append( NEW_LINE ); result.append( "CvIdentification: " + ( cvIdentification == null ? "-" : cvIdentification.getShortLabel() ) ); result.append( NEW_LINE ); result.append( "CvInteraction: " + ( cvInteraction == null ? "NOT SPECIFIED" : cvInteraction.getShortLabel() ) ); result.append( NEW_LINE ); // TODO in experiments with many interactions this can throw OutOfMemoryErrors // result.append( "Interactions (" ); // if( null != getInteractions() ) { // for( Iterator iterator = interactions.iterator(); iterator.hasNext(); ) { // Interaction interaction = (Interaction) iterator.next(); // result.append( interaction.getShortLabel() ).append( ", " ); // } // } // result.append( ')' ); // result.append( NEW_LINE ); result.append( ']' ); return result.toString(); }
public static String getSpeciesName(InteractionImpl complex) { if (!complex.getExperiments().isEmpty()) { Experiment exp = complex.getExperiments().iterator().next(); BioSource bioSource = exp.getBioSource(); if (bioSource != null) { return bioSource.getFullName() != null ? bioSource.getFullName() : bioSource.getShortLabel(); } } return null; }
/**************************/ // is for find the ontology term for a specific interaction. Needs to take the host organism coming from experiment public OntologyTerm findOrganism(Interaction interaction) throws SolrServerException { // get BioSource information from interaction Collection<Experiment> exps = interaction.getExperiments(); if (exps.isEmpty()){ return null; } // TODO what do we do when we have several experiments? Experiment experiment = exps.iterator().next(); BioSource biosource = experiment.getBioSource(); // return an OntologyTerm using tax id and short label return biosource != null ? findOntologyTerm(biosource.getTaxId(), biosource.getShortLabel()) : null ; }
public static String getSpeciesName(InteractionImpl complex) { if (!complex.getExperiments().isEmpty()) { Experiment exp = complex.getExperiments().iterator().next(); BioSource bioSource = exp.getBioSource(); if (bioSource != null) { return bioSource.getFullName() != null ? bioSource.getFullName() : bioSource.getShortLabel(); } } return null; }
private void synchronizeExperiment( Experiment experiment, boolean synchronizeAnnotatedAttributes ) { experiment.setPublication( synchronize( experiment.getPublication() ) ); if (IntactCore.isInitializedAndDirty(experiment.getInteractions())){ Collection<Interaction> interactions = synchronizeCollection(experiment.getInteractions()); experiment.getInteractions().clear(); experiment.getInteractions().addAll(interactions); } experiment.setCvIdentification(synchronize(experiment.getCvIdentification())); experiment.setCvInteraction( synchronize( experiment.getCvInteraction() ) ); experiment.setBioSource( synchronize( experiment.getBioSource() ) ); if (synchronizeAnnotatedAttributes){ synchronizeAnnotatedObjectCommons( experiment ); } }
private void synchronizeExperiment( Experiment experiment, boolean synchronizeAnnotatedAttributes ) { experiment.setPublication( synchronize( experiment.getPublication() ) ); if (IntactCore.isInitializedAndDirty(experiment.getInteractions())){ Collection<Interaction> interactions = synchronizeCollection(experiment.getInteractions()); experiment.getInteractions().clear(); experiment.getInteractions().addAll(interactions); } experiment.setCvIdentification(synchronize(experiment.getCvIdentification())); experiment.setCvInteraction( synchronize( experiment.getCvInteraction() ) ); experiment.setBioSource( synchronize( experiment.getBioSource() ) ); if (synchronizeAnnotatedAttributes){ synchronizeAnnotatedObjectCommons( experiment ); } }
@Override protected void saveOrUpdateAttributes(Experiment intactObject) throws PersisterException { super.saveOrUpdateAttributes(intactObject); if (intactObject.getBioSource() != null) { BioSourcePersister.getInstance().saveOrUpdate(intactObject.getBioSource()); } if (intactObject.getCvInteraction() != null) { CvObjectPersister.getInstance().saveOrUpdate(intactObject.getCvInteraction()); } else { throw new NullPointerException("Experiment without CvInteraction: " + intactObject.getShortLabel()); } if (intactObject.getCvIdentification() != null) { CvObjectPersister.getInstance().saveOrUpdate(intactObject.getCvIdentification()); } if (intactObject.getPublication() != null) { PublicationPersister.getInstance().saveOrUpdate(intactObject.getPublication()); } for (Interaction interaction : intactObject.getInteractions()) { InteractionPersister.getInstance().saveOrUpdate(interaction); } }
@Override protected Experiment syncAttributes(Experiment intactObject) { if (intactObject.getBioSource() != null) { BioSource bioSource = BioSourcePersister.getInstance().syncIfTransient(intactObject.getBioSource()); intactObject.setBioSource(bioSource); } intactObject.setCvInteraction((CvInteraction) CvObjectPersister.getInstance().syncIfTransient(intactObject.getCvInteraction())); if (intactObject.getCvIdentification() != null) { CvIdentification cvIdentification = ( CvIdentification ) CvObjectPersister.getInstance().syncIfTransient( intactObject.getCvIdentification() ); intactObject.setCvIdentification( cvIdentification ); } if (intactObject.getPublication() != null) { Publication publication = PublicationPersister.getInstance().syncIfTransient( intactObject.getPublication() ); intactObject.setPublication( publication ); } return super.syncAttributes(intactObject); }
protected void traverseExperiment(Experiment experiment, IntactVisitor ... visitors) { if (experiment == null) return; for (IntactVisitor visitor : visitors) { visitor.visitExperiment(experiment); } // check if this element has been traversed already, to avoid cyclic recursion if (recursionChecker.isAlreadyTraversed(experiment)) { return; } traverse(experiment.getCvIdentification(), visitors); traverse(experiment.getCvInteraction(), visitors); traverse(experiment.getBioSource(), visitors); traverse(experiment.getPublication(), visitors); traverse(experiment.getInteractions(), visitors); }
protected void traverseExperiment(Experiment experiment, IntactVisitor ... visitors) { if (experiment == null) return; for (IntactVisitor visitor : visitors) { visitor.visitExperiment(experiment); } // check if this element has been traversed already, to avoid cyclic recursion if (recursionChecker.isAlreadyTraversed(experiment)) { return; } traverse(experiment.getCvIdentification(), visitors); traverse(experiment.getCvInteraction(), visitors); traverse(experiment.getBioSource(), visitors); traverse(experiment.getPublication(), visitors); traverse(experiment.getInteractions(), visitors); }
public Experiment cloneExperiment(Experiment experiment) throws IntactClonerException { if (experiment == null) return null; Experiment clone = new Experiment(); clonerManager.addClone(experiment, clone); clone.setCvIdentification(clone(experiment.getCvIdentification())); clone.setCvInteraction(clone(experiment.getCvInteraction())); clone.setBioSource(clone(experiment.getBioSource())); clone.setPublication(clone(experiment.getPublication())); if (isCollectionClonable(experiment.getInteractions())) { Collection<Interaction> interactions = IntactCore.ensureInitializedInteractions(experiment); for (Interaction i : interactions) { clone.addInteraction(clone(i)); } } return clone; }
public Experiment cloneExperiment(Experiment experiment) throws IntactClonerException { if (experiment == null) return null; Experiment clone = new Experiment(); clonerManager.addClone(experiment, clone); clone.setCvIdentification(clone(experiment.getCvIdentification())); clone.setCvInteraction(clone(experiment.getCvInteraction())); clone.setBioSource(clone(experiment.getBioSource())); clone.setPublication(clone(experiment.getPublication())); if (isCollectionClonable(experiment.getInteractions())) { Collection<Interaction> interactions = IntactCore.ensureInitializedInteractions(experiment); for (Interaction i : interactions) { clone.addInteraction(clone(i)); } } return clone; }
/** * Builds a SHALLOW copy of the Experiment parameter. This means that a new Experiment instance is returned, but you * should be aware that the object references it contains <b>point to the objects referenced in the original object * </b>. * * @param experiment The Experiment you want a shallow copy of * * @return Experiment a new Experiment instance containing new references to the parameter object's attributes. * * @throws NullPointerException thrown if required items are not present in the parameter Experiment instance. */ public static Experiment getShallowCopy( Experiment experiment ) { Experiment ex = new Experiment( experiment.getOwner(), experiment.getShortLabel(), experiment.getBioSource() ); ex.ac = ( experiment.getAc() ); ex.setAnnotations( experiment.getAnnotations() ); ex.setCvInteraction( experiment.getCvInteraction() ); ex.setCvIdentification( experiment.getCvIdentification() ); ex.setFullName( experiment.getFullName() ); ex.setRelatedExperiment( experiment.getRelatedExperiment() ); ex.setXrefs( experiment.getXrefs() ); ex.setPublication( experiment.getPublication() ); return ex; }
/** * Builds a SHALLOW copy of the Experiment parameter. This means that a new Experiment instance is returned, but you * should be aware that the object references it contains <b>point to the objects referenced in the original object * </b>. * * @param experiment The Experiment you want a shallow copy of * * @return Experiment a new Experiment instance containing new references to the parameter object's attributes. * * @throws NullPointerException thrown if required items are not present in the parameter Experiment instance. */ public static Experiment getShallowCopy( Experiment experiment ) { Experiment ex = new Experiment( experiment.getOwner(), experiment.getShortLabel(), experiment.getBioSource() ); ex.ac = ( experiment.getAc() ); ex.setAnnotations( experiment.getAnnotations() ); ex.setCvInteraction( experiment.getCvInteraction() ); ex.setCvIdentification( experiment.getCvIdentification() ); ex.setFullName( experiment.getFullName() ); ex.setRelatedExperiment( experiment.getRelatedExperiment() ); ex.setXrefs( experiment.getXrefs() ); ex.setPublication( experiment.getPublication() ); return ex; }
/** * Builds a SHALLOW copy of the Experiment parameter. This means that a new Experiment instance is returned, but you * should be aware that the object references it contains <b>point to the objects referenced in the original object * </b>. * * @param experiment The Experiment you want a shallow copy of * * @return Experiment a new Experiment instance containing new references to the parameter object's attributes. * * @throws NullPointerException thrown if required items are not present in the parameter Experiment instance. */ public static Experiment getShallowCopy( Experiment experiment ) { Experiment ex = new Experiment( experiment.getOwner(), experiment.getShortLabel(), experiment.getBioSource() ); ex.ac = ( experiment.getAc() ); ex.setAnnotations( experiment.getAnnotations() ); ex.setCvInteraction( experiment.getCvInteraction() ); ex.setCvIdentification( experiment.getCvIdentification() ); ex.setFullName( experiment.getFullName() ); ex.setRelatedExperiment( experiment.getRelatedExperiment() ); ex.setXrefs( experiment.getXrefs() ); ex.setPublication( experiment.getPublication() ); return ex; }