本文整理了Java中uk.ac.ebi.intact.model.util.XrefUtils
类的一些代码示例,展示了XrefUtils
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XrefUtils
类的具体详情如下:
包路径:uk.ac.ebi.intact.model.util.XrefUtils
类名称:XrefUtils
[英]Utils with xrefs
[中]带有外部参照的UTIL
代码示例来源:origin: uk.ac.ebi.intact/intact-core
public <X extends Xref> X createIdentityXref(AnnotatedObject<X,?> parent, String primaryId, CvDatabase cvDatabase) {
return XrefUtils.createIdentityXref(parent, primaryId, getIdentityQualifier(), cvDatabase);
}
代码示例来源:origin: uk.ac.ebi.intact.dataexchange/intact-cvutils
protected CvObjectXref createIdentityXref( CvObject parent, String id ) {
CvObjectXref idXref = null;
if (id != null) {
if (id.startsWith("MI")) {
idXref = XrefUtils.createIdentityXrefPsiMi(parent, id);
idXref.prepareParentMi();
} else if (id.startsWith("IA")) {
idXref = XrefUtils.createIdentityXref(parent, id, nonMiCvDatabase);
} else if (id.startsWith("MOD")) {
idXref = XrefUtils.createIdentityXref(parent, id, psimod);
} else {
if (log.isWarnEnabled()) log.warn("Uknown prefix for id: "+id+". Will store as a cross reference to database: "+nonMiCvDatabase.getShortLabel());
idXref = XrefUtils.createIdentityXref(parent, id, nonMiCvDatabase);
}
}
return idXref;
}
代码示例来源:origin: uk.ac.ebi.intact.core/intact-core
/**
* Returns the Xref with MI number for given CV object
*
* @param cvobj the CV to search for MI
*
* @return xref with MI or null if no xref found whose primaryid starts with 'MI:'.
*/
private static Xref getMIXref( CvInteractorType cvobj ) {
final Collection<CvObjectXref> xrefs = XrefUtils.getIdentityXrefs( cvobj );
if( xrefs.size() != 1 ) {
throw new IllegalStateException( "Only a single MI identity expected here, found " + xrefs.size() );
}
return xrefs.iterator().next();
}
}
代码示例来源:origin: uk.ac.ebi.intact.core/intact-core
/**
* Gets the unique identifier of a CvObject. If it has PSI MI Identifier (miIdentifier) return it,
* if not, return the 'CvDatabase.intact' identifier; otherwise return the primaryId of the first identity xref found.
*
* @param cvObject The object to get the identifier from.
* @return The identifier. Will be null if no miIdentifier or identity xref is found.
* @since 1.8.0
*/
public static String getIdentity(CvObject cvObject) {
if (cvObject == null) return null;
// try the PSI MI first
if (cvObject.getIdentifier() != null) {
return cvObject.getIdentifier();
}
// try to get the identity with CvDatabase 'intact'
CvObjectXref idXref = XrefUtils.getIdentityXref(cvObject, CvDatabase.INTACT);
// get the first identity, if any
if (idXref == null) {
Collection<CvObjectXref> idXrefs = XrefUtils.getIdentityXrefs(cvObject);
if (!idXrefs.isEmpty()) {
idXref = idXrefs.iterator().next();
}
}
return (idXref != null) ? idXref.getPrimaryId() : null;
}
代码示例来源:origin: uk.ac.ebi.intact/intact-core
public static CvObjectXref getPsiMiIdentityXref(CvObject cvObject) {
return XrefUtils.getPsiMiIdentityXref(cvObject);
}
代码示例来源:origin: uk.ac.ebi.intact/intact-core
public static <T extends CvObject> T createCvObject(Institution institution, Class<T> cvClass, String primaryId, String shortLabel) {
T cv = ClassUtils.newInstance(cvClass);
cv.setOwner(institution);
cv.setShortLabel(shortLabel);
CvObjectXref idXref = XrefUtils.createIdentityXrefPsiMi(cv, primaryId);
cv.addXref(idXref);
return cv;
}
}
代码示例来源:origin: uk.ac.ebi.intact/intact-core
public static boolean hasIdentity(CvObject cvObject, String psiMi) {
return XrefUtils.hasIdentity(cvObject, psiMi);
}
代码示例来源:origin: uk.ac.ebi.intact.core/intact-core
public static <X extends Xref> X getIdentityXref(AnnotatedObject<X, ?> annotatedObject, CvDatabase cvDatabase) {
String dbMi = cvDatabase.getIdentifier();
return getIdentityXref(annotatedObject, dbMi);
}
代码示例来源:origin: uk.ac.ebi.intact.core/intact-core
public <X extends Xref> X createXref(AnnotatedObject<X,?> parent, String primaryId, CvXrefQualifier cvXrefQualifer, CvDatabase cvDatabase) {
X xref = (X) XrefUtils.newXrefInstanceFor(parent.getClass());
xref.setOwner(parent.getOwner());
xref.setParent(parent);
xref.setPrimaryId(primaryId);
xref.setCvXrefQualifier(cvXrefQualifer);
xref.setCvDatabase(cvDatabase);
return xref;
}
代码示例来源:origin: uk.ac.ebi.intact/intact-core
public <X extends Xref> X createIdentityXrefUniprot(AnnotatedObject<X,?> parent, String primaryId) {
return XrefUtils.createIdentityXrefUniprot(parent, primaryId);
}
代码示例来源:origin: uk.ac.ebi.intact.core/intact-core
public <X extends Xref> X createIdentityXrefChebi(AnnotatedObject<X,?> parent, String chebiId) {
return XrefUtils.createIdentityXrefChebi(parent, chebiId);
}
代码示例来源: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.core/intact-core-readonly
/**
* Gets the unique identifier of a CvObject. If it has PSI MI Identifier (miIdentifier) return it,
* if not, return the 'CvDatabase.intact' identifier; otherwise return the primaryId of the first identity xref found.
*
* @param cvObject The object to get the identifier from.
* @return The identifier. Will be null if no miIdentifier or identity xref is found.
* @since 1.8.0
*/
public static String getIdentity(CvObject cvObject) {
if (cvObject == null) return null;
// try the PSI MI first
if (cvObject.getIdentifier() != null) {
return cvObject.getIdentifier();
}
// try to get the identity with CvDatabase 'intact'
CvObjectXref idXref = XrefUtils.getIdentityXref(cvObject, CvDatabase.INTACT);
// get the first identity, if any
if (idXref == null) {
Collection<CvObjectXref> idXrefs = XrefUtils.getIdentityXrefs(cvObject);
if (!idXrefs.isEmpty()) {
idXref = idXrefs.iterator().next();
}
}
return (idXref != null) ? idXref.getPrimaryId() : null;
}
代码示例来源:origin: uk.ac.ebi.intact.core/intact-core-readonly
public static <T extends CvObject> T createCvObject(Institution institution, Class<T> cvClass, String miIdentifier, String shortLabel) {
T cv = ClassUtils.newInstance(cvClass);
cv.setOwner(institution);
cv.setShortLabel(shortLabel);
cv.setIdentifier(miIdentifier);
if (miIdentifier != null) {
CvObjectXref idXref = XrefUtils.createIdentityXrefPsiMi(cv, miIdentifier);
cv.addXref(idXref);
idXref.prepareParentMi();
}
return cv;
}
代码示例来源:origin: uk.ac.ebi.intact.core/intact-core-readonly
public static boolean hasIdentity(CvObject cvObject, String psiMi) {
if (cvObject.getIdentifier() != null && cvObject.getIdentifier().equals(psiMi)) {
return true;
}
return XrefUtils.hasIdentity(cvObject, psiMi);
}
代码示例来源:origin: uk.ac.ebi.intact.core/intact-core-readonly
public static <X extends Xref> X getIdentityXref(AnnotatedObject<X, ?> annotatedObject, CvDatabase cvDatabase) {
String dbMi = cvDatabase.getIdentifier();
return getIdentityXref(annotatedObject, dbMi);
}
代码示例来源:origin: uk.ac.ebi.intact/intact-core
public <X extends Xref> X createXref(AnnotatedObject<X,?> parent, String primaryId, CvXrefQualifier cvXrefQualifer, CvDatabase cvDatabase) {
X xref = (X) XrefUtils.newXrefInstanceFor(parent.getClass());
xref.setOwner(parent.getOwner());
xref.setParent(parent);
xref.setPrimaryId(primaryId);
xref.setCvXrefQualifier(cvXrefQualifer);
xref.setCvDatabase(cvDatabase);
return xref;
}
代码示例来源:origin: uk.ac.ebi.intact.core/intact-core-readonly
public <X extends Xref> X createIdentityXrefUniprot(AnnotatedObject<X,?> parent, String primaryId) {
return XrefUtils.createIdentityXrefUniprot(parent, primaryId);
}
代码示例来源:origin: uk.ac.ebi.intact.core/intact-core-readonly
public <X extends Xref> X createIdentityXrefChebi(AnnotatedObject<X,?> parent, String chebiId) {
return XrefUtils.createIdentityXrefChebi(parent, chebiId);
}
代码示例来源:origin: uk.ac.ebi.intact.core/intact-core
public <X extends Xref> X createIdentityXref(AnnotatedObject<X,?> parent, String primaryId, CvDatabase cvDatabase) {
return XrefUtils.createIdentityXref(parent, primaryId, getIdentityQualifier(), cvDatabase);
}
内容来源于网络,如有侵权,请联系作者删除!