uk.ac.ebi.intact.model.Interaction.getExperiments()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(14.3k)|赞(0)|评价(0)|浏览(127)

本文整理了Java中uk.ac.ebi.intact.model.Interaction.getExperiments()方法的一些代码示例,展示了Interaction.getExperiments()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Interaction.getExperiments()方法的具体详情如下:
包路径:uk.ac.ebi.intact.model.Interaction
类名称:Interaction
方法名:getExperiments

Interaction.getExperiments介绍

暂无

代码示例

代码示例来源:origin: uk.ac.ebi.intact.core/intact-persister

/**
 * Used to create a unique chain of experiment labels, used to differenciate interactions
 * that could just have the same short label
 */
private String experimentLabels(Interaction interaction) {
  StringBuilder sb = new StringBuilder( interaction.getExperiments().size() * 21 ); // init to max size
  for (Experiment exp : interaction.getExperiments()) {
    sb.append( exp.getShortLabel() ).append( '_' );
  }
  return sb.toString();
}

代码示例来源:origin: uk.ac.ebi.intact.dataexchange.psimi/intact-psimitab-converters

public void processExperimentParticipantIdentificationMethods(Interaction interaction, Interactor interactor){
  if (interaction != null){
    for (Experiment exp : interaction.getExperiments()){
      this.experimentConverter.addParticipantDetectionMethodForInteractor(exp, interactor);
    }
  }
}

代码示例来源:origin: uk.ac.ebi.intact/intact-core

/**
 * Convenience method to get the experiments - delegates the logic to the interactions
 *
 * @return Experiments
 */
public Collection<Experiment> getExperiments() {
  if (experiments != null) {
    return experiments;
  }
  experiments = new HashSet<Experiment>();
  for (Interaction interaction : getInteractions()) {
    experiments.addAll(interaction.getExperiments());
  }
  return experiments;
}

代码示例来源:origin: uk.ac.ebi.intact.core/intact-persister

protected void syncExperiments(Interaction intactObject)  {
    ExperimentPersister persister = ExperimentPersister.getInstance();

    List<Experiment> experiments = new ArrayList<Experiment>(intactObject.getExperiments().size());

    for (Experiment experiment : intactObject.getExperiments()) {
      Experiment exp = persister.syncIfTransient(experiment);
      experiments.add(exp);
    }

    intactObject.setExperiments(experiments);
  }
}

代码示例来源:origin: uk.ac.ebi.intact.sanity/intact-sanity-rules

public Collection<GeneralMessage> check( Interaction interaction ) throws SanityRuleException {
    Collection<GeneralMessage> messages = new ArrayList<GeneralMessage>();

    final Collection<Experiment> experiments = interaction.getExperiments();
    if ( experiments == null ) {
      messages.add( new GeneralMessage( MessageDefinition.INTERACTION_WITHOUT_EXPERIMENT, interaction ) );
    } else if ( experiments.size() > 1 ) {
      messages.add( new GeneralMessage( MessageDefinition.INTERACTION_WITH_MANY_EXPERIMENTS, interaction ) );
    } else if ( experiments.isEmpty() ) {
      messages.add( new GeneralMessage( MessageDefinition.INTERACTION_WITHOUT_EXPERIMENT, interaction ) );
    }

    return messages;
  }
}

代码示例来源:origin: uk.ac.ebi.intact.dataexchange.uniprotexport/intact-uniprot-export

private boolean isNegative(Interaction interaction) {
  boolean negative = false;
  if (super.isNegative(interaction)) {
    negative = true;
  } else {
    //check its experiments
    for (Iterator iterator = interaction.getExperiments().iterator(); iterator.hasNext() && !negative;) {
      Experiment experiment = (Experiment) iterator.next();
      if (isNegative(experiment)) {
        negative = true;
      }
    }
  }
  return negative;
}

代码示例来源:origin: uk.ac.ebi.intact.util/intact-uniprot-export

private boolean isNegative(Interaction interaction) {
  boolean negative = false;
  if (super.isNegative(interaction)) {
    negative = true;
  } else {
    //check its experiments
    for (Iterator iterator = interaction.getExperiments().iterator(); iterator.hasNext() && !negative;) {
      Experiment experiment = (Experiment) iterator.next();
      if (isNegative(experiment)) {
        negative = true;
      }
    }
  }
  return negative;
}

代码示例来源:origin: uk.ac.ebi.intact.core/intact-persister

protected void saveOrUpdateExperiments(Interaction intactObject) throws PersisterException {
  for (Experiment experiment : intactObject.getExperiments()) {
    ExperimentPersister.getInstance().saveOrUpdate(experiment);
  }
}

代码示例来源:origin: uk.ac.ebi.intact.dataexchange.psimi/intact-solr-core

/**************************/
// 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 ;
}

代码示例来源:origin: uk.ac.ebi.intact.core/intact-core-readonly

/**
 * Retrieves the experiment from an interaction, initializing them if necessary.
 *
 * @param interaction the interaction
 * @return The returned experiments are ensured to be initialized
 * @since 2.4.0
 */
public static Collection<Experiment> ensureInitializedExperiments(Interaction interaction) {
  Collection<Experiment> experiments;
  if (IntactCore.isInitialized(interaction.getExperiments())) {
    experiments = interaction.getExperiments();
  } else {
    experiments = IntactContext.getCurrentInstance().getDaoFactory().getExperimentDao().getByInteractionAc(interaction.getAc());
  }
  return experiments;
}

代码示例来源:origin: uk.ac.ebi.intact.core/intact-core

/**
 * Retrieves the experiment from an interaction, initializing them if necessary.
 *
 * @param interaction the interaction
 * @return The returned experiments are ensured to be initialized
 * @since 2.4.0
 */
public static Collection<Experiment> ensureInitializedExperiments(Interaction interaction) {
  Collection<Experiment> experiments;
  if (IntactCore.isInitialized(interaction.getExperiments())) {
    experiments = interaction.getExperiments();
  } else {
    experiments = IntactContext.getCurrentInstance().getDaoFactory().getExperimentDao().getByInteractionAc(interaction.getAc());
  }
  return experiments;
}

代码示例来源:origin: uk.ac.ebi.intact.dataexchange.psimi/intact-psixml-converters

protected void failIfInconsistentConversion(Interaction intact, psidev.psi.mi.xml.model.Interaction psi, int numberOfAuthorConfAttributes) {
  Collection<Experiment> experiments;
  Collection<Component> participants;
  Collection<Confidence> confidences;
  if (isCheckInitializedCollections()){
    experiments = IntactCore.ensureInitializedExperiments(intact);
    participants = IntactCore.ensureInitializedParticipants(intact);
    confidences = IntactCore.ensureInitializedConfidences(intact);
  }
  else {
    experiments = intact.getExperiments();
    participants = intact.getComponents();
    confidences = intact.getConfidences();
  }
  failIfInconsistentCollectionSize("experiment", experiments, psi.getExperiments());
  failIfInconsistentCollectionSize("participant", participants, psi.getParticipants());
  Collection<Confidence> confs = confidences;
  if (confs.size() > 0 && psi.getConfidences().size() + numberOfAuthorConfAttributes > 0 && confs.size() != (psi.getConfidences().size() + numberOfAuthorConfAttributes)) {
    throw new InconsistentConversionException("Confidence", confs.size(), psi.getConfidences().size() + numberOfAuthorConfAttributes);
  }
}

代码示例来源:origin: uk.ac.ebi.intact.dataexchange.psimi/intact-psixml-converters

protected void failIfInconsistentPsiConversion(Interaction intact, psidev.psi.mi.xml.model.Interaction psi) {
  Collection<Experiment> experiments;
  Collection<Component> participants;
  Collection<Confidence> confidences;
  if (isCheckInitializedCollections()){
    experiments = IntactCore.ensureInitializedExperiments(intact);
    participants = IntactCore.ensureInitializedParticipants(intact);
    confidences = IntactCore.ensureInitializedConfidences(intact);
  }
  else {
    experiments = intact.getExperiments();
    participants = intact.getComponents();
    confidences = intact.getConfidences();
  }
  failIfInconsistentCollectionSize("experiment", experiments, psi.getExperiments());
  failIfInconsistentCollectionSize("participant", participants, psi.getParticipants());
  Collection<Confidence> confs = confidences;
  if (confs.size() > 0 && psi.getConfidences().size() > 0 && (confs.size()) != psi.getConfidences().size()) {
    throw new InconsistentConversionException("Confidence", confs.size(), psi.getConfidences().size());
  }
}

代码示例来源:origin: uk.ac.ebi.intact.core/intact-core-readonly

private void synchronizeInteraction( Interaction interaction, boolean synchronizeAnnotatedAttributes ) {
  interaction.setCvInteractionType( synchronize( interaction.getCvInteractionType() ) );
  interaction.setCvInteractorType( synchronize( interaction.getCvInteractorType() ) );
  if (IntactCore.isInitializedAndDirty(interaction.getComponents())){
    Collection<Component> components = synchronizeCollection(interaction.getComponents());
    interaction.getComponents().clear();
    interaction.getComponents().addAll(components);
  }
  interaction.setBioSource( synchronize( interaction.getBioSource() ) );
  if (IntactCore.isInitializedAndDirty(interaction.getExperiments())){
    Collection<Experiment> experiment = synchronizeCollection(interaction.getExperiments());
    interaction.getExperiments().clear();
    interaction.getExperiments().addAll(experiment);
  }
  // cannot call setConfidences in interaction because of orphan relationship limitation
  if (IntactCore.isInitializedAndDirty(interaction.getConfidences())){
    Collection<Confidence> confidences = synchronizeConfidences(interaction.getConfidences(), interaction);
    interaction.getConfidences().clear();
    interaction.getConfidences().addAll(confidences);
  }
  // cannot call setParameters in interaction because of orphan relationship limitation
  if (IntactCore.isInitializedAndDirty(interaction.getParameters())){
    Collection<InteractionParameter> interactionParameters = synchronizeInteractionParameters(interaction.getParameters(), interaction);
    interaction.getParameters().clear();
    interaction.getParameters().addAll(interactionParameters);
  }
  if (synchronizeAnnotatedAttributes){
    synchronizeAnnotatedObjectCommons( interaction );
  }
}

代码示例来源:origin: uk.ac.ebi.intact.core/intact-core-readonly

protected void copyInteraction( Interaction source, Interaction target ) {
  copyProperty(source, "KD", target);
  copyProperty(source, "crc", target);
  copyProperty(source, "cvInteractionType", target);
  copyCollection( source.getComponents(), target.getComponents() );
  copyCollection( source.getExperiments(), target.getExperiments() );
  copyCollection( source.getConfidences(), target.getConfidences() );
  
  copyCollection( source.getParameters(), target.getParameters() );
  copyInteractorCommons( source, target );
  // we have ommited CRC on purpose
}

代码示例来源:origin: uk.ac.ebi.intact.core/intact-core

protected void copyInteraction( Interaction source, Interaction target ) {
  copyProperty(source, "KD", target);
  copyProperty(source, "crc", target);
  copyProperty(source, "cvInteractionType", target);
  copyCollection( source.getComponents(), target.getComponents() );
  copyCollection( source.getExperiments(), target.getExperiments() );
  copyCollection( source.getConfidences(), target.getConfidences() );
  
  copyCollection( source.getParameters(), target.getParameters() );
  copyInteractorCommons( source, target );
  // we have ommited CRC on purpose
}

代码示例来源:origin: uk.ac.ebi.intact.dataexchange.psimi/intact-psixml-converters

private void updateExperimentParticipantDetectionMethod(Interaction interaction) {
  for (Experiment experiment : interaction.getExperiments()) {
    if (experiment.getCvIdentification() == null) {
      String partDetMethod = calculateParticipantDetMethod(interaction.getComponents());
      if (partDetMethod != null) {
        final String message = "Experiment ("+ experiment.getShortLabel() +") without participant detection method. One was calculated from the components: " + partDetMethod;
        addMessageToContext(MessageLevel.INFO, message, true);
        if (log.isWarnEnabled()) {
          log.warn(message);
        }
        CvIdentification detMethod = CvObjectUtils.createCvObject(experiment.getOwner(), CvIdentification.class, partDetMethod, "undefined");
        experiment.setCvIdentification(detMethod);
      } else {
        final String message = "Neither the Experiment nor its participants have CvIdentification (participant detection method). Using the term \"experimental particp\" (MI:0661).";
        if (log.isWarnEnabled()) log.warn(": Experiment '"+experiment.getShortLabel()+
            "', Interaction '"+interaction.getShortLabel()+"' - Location: "+ConverterContext.getInstance().getLocation().getCurrentLocation().pathFromRootAsString());
        addMessageToContext(MessageLevel.WARN, message, true);
        CvIdentification detMethod = CvObjectUtils.createCvObject(experiment.getOwner(), CvIdentification.class, "MI:0661", "experimental particp");
        experiment.setCvIdentification(detMethod);
      }
    }
  }
}

代码示例来源:origin: uk.ac.ebi.intact.core/intact-core

protected void traverseInteraction(Interaction interaction, IntactVisitor ... visitors) {
  if (interaction == null) return;
  for (IntactVisitor visitor : visitors) {
    visitor.visitInteraction(interaction);
  }
  // check if this element has been traversed already, to avoid cyclic recursion
  if (recursionChecker.isAlreadyTraversed(interaction)) {
    return;
  }
  traverse(interaction.getCvInteractionType(), visitors);
  traverse(interaction.getExperiments(), visitors);
  traverse(interaction.getComponents(), visitors);
  traverse(interaction.getConfidences(), visitors);
  traverse(interaction.getParameters(), visitors);
}

代码示例来源:origin: uk.ac.ebi.intact.core/intact-core-readonly

protected void traverseInteraction(Interaction interaction, IntactVisitor ... visitors) {
  if (interaction == null) return;
  for (IntactVisitor visitor : visitors) {
    visitor.visitInteraction(interaction);
  }
  // check if this element has been traversed already, to avoid cyclic recursion
  if (recursionChecker.isAlreadyTraversed(interaction)) {
    return;
  }
  traverse(interaction.getCvInteractionType(), visitors);
  traverse(interaction.getExperiments(), visitors);
  traverse(interaction.getComponents(), visitors);
  traverse(interaction.getConfidences(), visitors);
  traverse(interaction.getParameters(), visitors);
}

代码示例来源:origin: uk.ac.ebi.intact.dataexchange.psimi/intact-psixml-converters

protected void failIfInconsistentConversion(Interaction intact, psidev.psi.mi.xml.model.Interaction psi) {
  Collection<Experiment> experiments;
  Collection<Component> participants;
  Collection<Confidence> confidences;
  if (isCheckInitializedCollections()){
    experiments = IntactCore.ensureInitializedExperiments(intact);
    participants = IntactCore.ensureInitializedParticipants(intact);
    confidences = IntactCore.ensureInitializedConfidences(intact);
  }
  else {
    experiments = intact.getExperiments();
    participants = intact.getComponents();
    confidences = intact.getConfidences();
  }
  failIfInconsistentCollectionSize("experiment", experiments, psi.getExperiments());
  failIfInconsistentCollectionSize("participant", participants, psi.getParticipants());
  failIfInconsistentCollectionSize( "confidence", confidences, psi.getConfidences());
}

相关文章