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

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

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

Interaction.getAc介绍

暂无

代码示例

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

public Collection<BinaryInteraction> convert( Collection<Interaction> interactions ) {
  if ( interactions == null ) {
    throw new IllegalArgumentException( "Interactions must not be null" );
  }
  if (expansionStrategy == null) {
    throw new NullPointerException("No expansion strategy defined");
  }
  Collection<BinaryInteraction> result = new ArrayList<BinaryInteraction>(interactions.size());
  for ( Interaction interaction : interactions ) {
    Collection<BinaryInteraction> expandedInteractions = null;
    try {
      expandedInteractions = expansionStrategy.expand(interaction);
    } catch ( NotExpandableInteractionException e ) {
      log.warn( "Interaction " + interaction.getAc() + " could not be expanded. Skipping." );
    }
    if( expandedInteractions != null ) {
      result.addAll(expandedInteractions);
    }
  }
  if ( ! result.isEmpty() ) {
    result = doPostProcessing( result );
  }
  
  return result;
}

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

/**
 * Gets the Interactor Identifiers for that interaction
 *
 * @since 1.7.2
 */
public static List<String> getInteractorPrimaryIDs(Interaction interaction) {
  final Collection<Component> components = interaction.getComponents();
  List<String> ids = new ArrayList<String>(components.size());
  for (Component component : components) {
    Interactor interactor = component.getInteractor();
    final Collection<InteractorXref> idXrefs = XrefUtils.getIdentityXrefs(interactor);
    if (idXrefs.size() > 0) {
      final Iterator<InteractorXref> iterator = idXrefs.iterator();
      ids.add(iterator.next().getPrimaryId());
      if (log.isDebugEnabled()) {
        if (iterator.hasNext()) {
          log.debug("Interaction contains interactor with more than one identities. Interaction: " + interaction.getShortLabel() + "(" + interaction.getAc() + ") " +
              " - Xrefs: " + idXrefs);
        }
      }
    }
  }
  return ids;
}

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

/**
 * Gets the Interactor Identifiers for that interaction
 *
 * @since 1.7.2
 */
public static List<String> getInteractorPrimaryIDs(Interaction interaction) {
  final Collection<Component> components = interaction.getComponents();
  List<String> ids = new ArrayList<String>(components.size());
  for (Component component : components) {
    Interactor interactor = component.getInteractor();
    final Collection<InteractorXref> idXrefs = XrefUtils.getIdentityXrefs(interactor);
    if (idXrefs.size() > 0) {
      final Iterator<InteractorXref> iterator = idXrefs.iterator();
      ids.add(iterator.next().getPrimaryId());
      if (log.isDebugEnabled()) {
        if (iterator.hasNext()) {
          log.debug("Interaction contains interactor with more than one identities. Interaction: " + interaction.getShortLabel() + "(" + interaction.getAc() + ") " +
              " - Xrefs: " + idXrefs);
        }
      }
    }
  }
  return ids;
}

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

/**
 * It takes an interactions Collection and retrieves the ACs for the interactions that have a NucleicAcid or
 * SmallMolecule as component.
 * This is used in case psi version is PSI 1.0 as it does not allow Nucleic Acid as Interaction's participant.
 * @param interactions Collection of interactions
 * @return a list with the ACs which should be filtered
 */
public static List<String> filterInteractions(Collection<Interaction> interactions){
  List<String> filteredAcs = new ArrayList<String>();
  for (Interaction interaction : interactions)
  {
    if ( InteractionUtils.containsNonProteinInteractors(interaction)
       || InteractionUtils.isSelfInteraction(interaction)
       || InteractionUtils.isUnaryInteraction( interaction ) )
    {
      filteredAcs.add(interaction.getAc());
    }
  }
  return filteredAcs;
}

代码示例来源:origin: uk.ac.ebi.intact.app/data-conversion

/**
 * It takes an interactions Collection and retrieves the ACs for the interactions that have a NucleicAcid or
 * SmallMolecule as component.
 * This is used in case psi version is PSI 1.0 as it does not allow Nucleic Acid as Interaction's participant.
 * @param interactions Collection of interactions
 * @return a list with the ACs which should be filtered
 */
public static List<String> filterInteractions(Collection<Interaction> interactions){
  List<String> filteredAcs = new ArrayList<String>();
  for (Interaction interaction : interactions)
  {
    if ( InteractionUtils.containsNonProteinInteractors(interaction)
       || InteractionUtils.isSelfInteraction(interaction)
       || InteractionUtils.isUnaryInteraction( interaction ) )
    {
      filteredAcs.add(interaction.getAc());
    }
  }
  return filteredAcs;
}

代码示例来源:origin: uk.ac.ebi.intact.dataexchange.psimi.legacy/data-conversion

/**
 * It takes an interactions Collection and retrieves the ACs for the interactions that have a NucleicAcid or
 * SmallMolecule as component.
 * This is used in case psi version is PSI 1.0 as it does not allow Nucleic Acid as Interaction's participant.
 * @param interactions Collection of interactions
 * @return a list with the ACs which should be filtered
 */
public static List<String> filterInteractions(Collection<Interaction> interactions){
  List<String> filteredAcs = new ArrayList<String>();
  for (Interaction interaction : interactions)
  {
    if ( InteractionUtils.containsNonProteinInteractors(interaction)
       || InteractionUtils.isSelfInteraction(interaction)
       || InteractionUtils.isUnaryInteraction( interaction ) )
    {
      filteredAcs.add(interaction.getAc());
    }
  }
  return filteredAcs;
}

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

log.info("Processing interaction : " + intactInteraction.getAc());

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

@Override
protected String findAcForInteraction( Interaction interaction ) {
  // replace all this eventually by just using the CRC
  InteractionDao interactionDao = getDaoFactory().getInteractionDao();
  CrcCalculator crcCalculator = new CrcCalculator();
  // Get the interactors where exactly the same interactors are involved
  List<String> interactorPrimaryIDs = InteractionUtils.getInteractorPrimaryIDs( interaction );
  List<Interaction> interactionsWithSameInteractors =
      interactionDao.getByInteractorsPrimaryId( true, interactorPrimaryIDs.toArray( new String[interactorPrimaryIDs.size()] ) );
  for ( Interaction interactionWithSameInteractor : interactionsWithSameInteractors ) {
    String interactionCrc = crcCalculator.crc64( interaction );
    String interactionWithSameInteractorCrc = crcCalculator.crc64( interactionWithSameInteractor );
    if ( interactionCrc.equals( interactionWithSameInteractorCrc ) ) {
      return interactionWithSameInteractor.getAc();
    }
  }
  return null;
}

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

@Override
protected String findAcForInteraction( Interaction interaction ) {
  // replace all this eventually by just using the CRC
  InteractionDao interactionDao = getDaoFactory().getInteractionDao();
  CrcCalculator crcCalculator = new CrcCalculator();
  // Get the interactors where exactly the same interactors are involved
  List<String> interactorPrimaryIDs = InteractionUtils.getInteractorPrimaryIDs( interaction );
  List<Interaction> interactionsWithSameInteractors =
      interactionDao.getByInteractorsPrimaryId( true, interactorPrimaryIDs.toArray( new String[interactorPrimaryIDs.size()] ) );
  for ( Interaction interactionWithSameInteractor : interactionsWithSameInteractors ) {
    String interactionCrc = crcCalculator.crc64( interaction );
    String interactionWithSameInteractorCrc = crcCalculator.crc64( interactionWithSameInteractor );
    if ( interactionCrc.equals( interactionWithSameInteractorCrc ) ) {
      return interactionWithSameInteractor.getAc();
    }
  }
  return null;
}

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

/**
 * Filter the binary interactions of a given list of interactions and return a list composed with only binary interactions
 * @param interactionAcs : the list of interaction accessions
 * @param eligibleInteractions : the list of eligible interactions for uniprot export
 */
private void filterTrueBinaryInteractions(List<String> interactionAcs, List<String> eligibleInteractions) {
  // process each interaction of the list
  final int interactionCount = interactionAcs.size();
  for (int i = 0; i < interactionCount; i++) {
    TransactionStatus status = IntactContext.getCurrentInstance().getDataContext().beginTransaction();
    // get the IntAct interaction object
    String interactionAc = interactionAcs.get(i);
    Interaction interaction = IntactContext.getCurrentInstance().getDaoFactory().getInteractionDao().getByAc(interactionAc);
    // the interaction exists in IntAct
    if (interaction != null){
      logger.info("\t\t Interaction: Shortlabel:" + interaction.getShortLabel() + "  AC: " + interaction.getAc());
      if (InteractionUtils.isBinaryInteraction(interaction)){
        eligibleInteractions.add(interactionAc);
      }
    }
    IntactContext.getCurrentInstance().getDataContext().commitTransaction(status);
  } // i
}

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

private static Collection<Annotation> fetchAnnotations(Interaction interaction) {
  Collection<Annotation> annotations;
  if (IntactCore.isInitialized(interaction.getAnnotations())) {
    annotations = interaction.getAnnotations();
  } else {
    annotations = IntactContext.getCurrentInstance().getDaoFactory().getAnnotationDao().getByParentAc(InteractionImpl.class, interaction.getAc());
  }
  return annotations;
}

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

private static Collection<Annotation> fetchAnnotations(Interaction interaction) {
  Collection<Annotation> annotations;
  if (IntactCore.isInitialized(interaction.getAnnotations())) {
    annotations = interaction.getAnnotations();
  } else {
    annotations = IntactContext.getCurrentInstance().getDaoFactory().getAnnotationDao().getByParentAc(InteractionImpl.class, interaction.getAc());
  }
  return annotations;
}

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

/**
 * Retrieves the confidences from an interaction, initializing them if necessary.
 * Do not set the initialized collection of confidences because confidences cannot be orphan
 * @param interaction the interaction
 * @return The returned confidences are ensured to be initialized
 * @since 2.4.0
 */
public static Collection<Confidence> ensureInitializedConfidences(Interaction interaction) {
  Collection<Confidence> confidences;
  if (IntactCore.isInitialized(interaction.getConfidences())) {
    confidences = interaction.getConfidences();
  } else {
    confidences = IntactContext.getCurrentInstance().getDaoFactory().getConfidenceDao().getByInteractionAc(interaction.getAc());
  }
  return confidences;
}

代码示例来源: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.core/intact-core

/**
 * Retrieves the parameters from an interaction, initializing them if necessary.
 * Do not set the initialized collection of parameters because parameters cannot be orphan
 * @param interaction the interaction
 * @return The returned confidences are ensured to be initialized
 * @since 2.4.0
 */
public static Collection<InteractionParameter> ensureInitializedInteractionParameters(Interaction interaction) {
  Collection<InteractionParameter> parameters;
  if (IntactCore.isInitialized(interaction.getParameters())) {
    parameters = interaction.getParameters();
  } else {
    parameters = IntactContext.getCurrentInstance().getDaoFactory().getInteractionParameterDao().getByInteractionAc(interaction.getAc());
  }
  return parameters;
}

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

/**
 * Retrieves the confidences from an interaction, initializing them if necessary.
 * Do not set the initialized collection of confidences because confidences cannot be orphan
 * @param interaction the interaction
 * @return The returned confidences are ensured to be initialized
 * @since 2.4.0
 */
public static Collection<Confidence> ensureInitializedConfidences(Interaction interaction) {
  Collection<Confidence> confidences;
  if (IntactCore.isInitialized(interaction.getConfidences())) {
    confidences = interaction.getConfidences();
  } else {
    confidences = IntactContext.getCurrentInstance().getDaoFactory().getConfidenceDao().getByInteractionAc(interaction.getAc());
  }
  return confidences;
}

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

/**
 * Retrieves the parameters from an interaction, initializing them if necessary.
 * Do not set the initialized collection of parameters because parameters cannot be orphan
 * @param interaction the interaction
 * @return The returned confidences are ensured to be initialized
 * @since 2.4.0
 */
public static Collection<InteractionParameter> ensureInitializedInteractionParameters(Interaction interaction) {
  Collection<InteractionParameter> parameters;
  if (IntactCore.isInitialized(interaction.getParameters())) {
    parameters = interaction.getParameters();
  } else {
    parameters = IntactContext.getCurrentInstance().getDaoFactory().getInteractionParameterDao().getByInteractionAc(interaction.getAc());
  }
  return parameters;
}

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

/**
 * Retrieves the components from an interaction, initializing them if necessary.
 * Do not set the initialized collection of components because components cannot be orphan
 *
 * @param interaction the interaction
 * @return The returned components are ensured to be initialized
 * @since 2.4.0
 */
public static Collection<Component> ensureInitializedParticipants(Interaction interaction) {
  Collection<Component> components;
  if (IntactCore.isInitialized(interaction.getComponents())) {
    components = interaction.getComponents();
  } else {
    components = IntactContext.getCurrentInstance().getDaoFactory().getComponentDao().getByInteractionAc(interaction.getAc());
  }
  return components;
}

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

/**
 * Retrieves the components from an interaction, initializing them if necessary.
 * Do not set the initialized collection of components because components cannot be orphan
 *
 * @param interaction the interaction
 * @return The returned components are ensured to be initialized
 * @since 2.4.0
 */
public static Collection<Component> ensureInitializedParticipants(Interaction interaction) {
  Collection<Component> components;
  if (IntactCore.isInitialized(interaction.getComponents())) {
    components = interaction.getComponents();
  } else {
    components = IntactContext.getCurrentInstance().getDaoFactory().getComponentDao().getByInteractionAc(interaction.getAc());
  }
  return components;
}

相关文章