uk.ac.ebi.intact.model.util.XrefUtils.getPsiMiIdentityXref()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(87)

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

XrefUtils.getPsiMiIdentityXref介绍

暂无

代码示例

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

public static CvObjectXref getPsiMiIdentityXref(CvObject cvObject) {
  return XrefUtils.getPsiMiIdentityXref(cvObject);    
}

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

/**
 * @deprecated To get the PSI-MI identifier, just invoke CvObject.getMiIdentifier()
 */
@Deprecated
public static CvObjectXref getPsiMiIdentityXref(CvObject cvObject) {
  return XrefUtils.getPsiMiIdentityXref(cvObject);
}

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

/**
 * @deprecated To get the PSI-MI identifier, just invoke CvObject.getMiIdentifier()
 */
@Deprecated
public static CvObjectXref getPsiMiIdentityXref(CvObject cvObject) {
  return XrefUtils.getPsiMiIdentityXref(cvObject);
}

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

public String calculateInstitutionPrimaryId(Institution institution) {
  String institutionPrimaryId = null;
  if (institution != null) {
    InstitutionXref xref = XrefUtils.getPsiMiIdentityXref(institution);
    if (xref != null) {
      institutionPrimaryId = xref.getPrimaryId();
    }
  }
  return institutionPrimaryId;
}

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

/**
 * Collect all children psi-mi identity identifier including the given root term's.
 *
 * @param root         term from which we start traversing children.
 * @param collectedMIs non null collection in which we store collected MIs (if giving a List, you may have
 *                     duplicated in case some terms have multiple parents).
 */
public static void getChildrenMIs(CvDagObject root, Collection<String> collectedMIs) {
  if (root == null) {
    throw new IllegalArgumentException("You must give a non null root term");
  }
  if (collectedMIs == null) {
    throw new IllegalArgumentException("The given collection must not be null");
  }
  // 1. Add the current term
  final CvObjectXref xref = XrefUtils.getPsiMiIdentityXref(root);
  if (xref != null) {
    collectedMIs.add(xref.getPrimaryId());
  }
  // 2. Add children recursively
  for (CvDagObject child : root.getChildren()) {
    getChildrenMIs(child, collectedMIs);
  }
}

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

/**
 * Collect all children psi-mi identity identifier including the given root term's.
 *
 * @param root         term from which we start traversing children.
 * @param collectedMIs non null collection in which we store collected MIs (if giving a List, you may have
 *                     duplicated in case some terms have multiple parents).
 */
public static void getChildrenMIs(CvDagObject root, Collection<String> collectedMIs) {
  if (root == null) {
    throw new IllegalArgumentException("You must give a non null root term");
  }
  if (collectedMIs == null) {
    throw new IllegalArgumentException("The given collection must not be null");
  }
  // 1. Add the current term
  final CvObjectXref xref = XrefUtils.getPsiMiIdentityXref(root);
  if (xref != null) {
    collectedMIs.add(xref.getPrimaryId());
  }
  // 2. Add children recursively
  for (CvDagObject child : root.getChildren()) {
    getChildrenMIs(child, collectedMIs);
  }
}

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

public Institution getDefaultInstitutionForAcs() {
  if (defaultInstitutionForAcs == null && IntactContext.currentInstanceExists()) {
    defaultInstitutionForAcs = IntactContext.getCurrentInstance().getInstitution();
    if (defaultInstitutionForAcs != null) {
      InstitutionXref xref = XrefUtils.getPsiMiIdentityXref(defaultInstitutionForAcs);
      if (xref != null) {
        defaultInstitutionPrimaryIdForAcs = xref.getPrimaryId();
      }
    }
  }
  return defaultInstitutionForAcs;
}

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

/**
 * Finds an institution based on its properties.
 *
 * @param institution the object we are searching an AC for.
 * @return an AC or null if it couldn't be found.
 */
protected String findAcForInstitution( Institution institution ) {
  String ac = null;
  // try to fetch it first using the xref. If not, use the shortlabel
  Xref institutionXref = XrefUtils.getPsiMiIdentityXref( institution );
  if ( institutionXref != null ) {
    Query query = getEntityManager().createQuery( "select distinct institution.ac from Institution institution " +
        "left join institution.xrefs as xref " +
        "where xref.primaryId = :primaryId" );
    query.setParameter( "primaryId", institutionXref.getPrimaryId() );
    ac = getFirstAcForQuery( query, institution );
  }
  if ( ac == null ) {
    Institution fetchedInstitution = getDaoFactory().getInstitutionDao().getByShortLabel( institution.getShortLabel() );
    if ( fetchedInstitution != null ) {
      ac = fetchedInstitution.getAc();
    }
  }
  return ac;
}

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

/**
 * Finds an institution based on its properties.
 *
 * @param institution the object we are searching an AC for.
 * @return an AC or null if it couldn't be found.
 */
protected String findAcForInstitution( Institution institution ) {
  String ac = null;
  // try to fetch it first using the xref. If not, use the shortlabel
  Xref institutionXref = XrefUtils.getPsiMiIdentityXref( institution );
  if ( institutionXref != null ) {
    Query query = getEntityManager().createQuery( "select distinct institution.ac from Institution institution " +
        "left join institution.xrefs as xref " +
        "where xref.primaryId = :primaryId" );
    query.setParameter( "primaryId", institutionXref.getPrimaryId() );
    ac = getFirstAcForQuery( query, institution );
  }
  if ( ac == null ) {
    Institution fetchedInstitution = getDaoFactory().getInstitutionDao().getByShortLabel( institution.getShortLabel() );
    if ( fetchedInstitution != null ) {
      ac = fetchedInstitution.getAc();
    }
  }
  return ac;
}

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

/**
 * Fetches the corresponding CvDatabase for a specific institution.
 *
 * @param context                   The IntactContext to run the queries to the database
 * @param institution               The institution to find a CvDatabase for
 * @param defaultDatabaseIdentifier If the passed institution does not have a PSI-MI identifier, the default identifier to use.
 * @return
 */
public static CvDatabase retrieveCvDatabase(IntactContext context, Institution institution, String defaultDatabaseIdentifier) {
  InstitutionXref identityXref = XrefUtils.getPsiMiIdentityXref(institution);
  if (identityXref == null) return null;
  CvDatabase cvDatabase = context.getDaoFactory().getCvObjectDao(CvDatabase.class).getByIdentifier(identityXref.getPrimaryId());
  if (cvDatabase == null && defaultDatabaseIdentifier != null) {
    cvDatabase = context.getDaoFactory().getCvObjectDao(CvDatabase.class).getByIdentifier(defaultDatabaseIdentifier);
  }
  return cvDatabase;
}

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

/**
 * Fetches the corresponding CvDatabase for a specific institution.
 *
 * @param context                   The IntactContext to run the queries to the database
 * @param institution               The institution to find a CvDatabase for
 * @param defaultDatabaseIdentifier If the passed institution does not have a PSI-MI identifier, the default identifier to use.
 * @return
 */
public static CvDatabase retrieveCvDatabase(IntactContext context, Institution institution, String defaultDatabaseIdentifier) {
  InstitutionXref identityXref = XrefUtils.getPsiMiIdentityXref(institution);
  if (identityXref == null) return null;
  CvDatabase cvDatabase = context.getDaoFactory().getCvObjectDao(CvDatabase.class).getByIdentifier(identityXref.getPrimaryId());
  if (cvDatabase == null && defaultDatabaseIdentifier != null) {
    cvDatabase = context.getDaoFactory().getCvObjectDao(CvDatabase.class).getByIdentifier(defaultDatabaseIdentifier);
  }
  return cvDatabase;
}

相关文章