private boolean hasValidPubmedPrimaryRef( DbReference primaryRef ) { if ( (primaryRef.getRefTypeAc() != null && !CvXrefQualifier.PRIMARY_REFERENCE_MI_REF.equals(primaryRef.getRefTypeAc())) || (primaryRef.getRefTypeAc() == null && !CvXrefQualifier.PRIMARY_REFERENCE.equals(primaryRef.getRefType().toLowerCase())) || (primaryRef.getDbAc() != null && !CvDatabase.PUBMED_MI_REF.equals(primaryRef.getDbAc())) || (primaryRef.getDbAc() == null && !CvDatabase.PUBMED.equals(primaryRef.getDb().toLowerCase())) ) { return false; } return true; }
public static CvXrefQualifier createCvXrefQualifier(Institution institution, DbReference dbReference) { String xrefType = dbReference.getRefType(); CvXrefQualifier xrefQual = null; if (xrefType != null) { xrefQual = new CvXrefQualifier(institution, xrefType); } return xrefQual; }
private boolean hasValidDOIPrimaryRef( DbReference primaryRef ) { if ( (primaryRef.getRefTypeAc() != null && !CvXrefQualifier.PRIMARY_REFERENCE_MI_REF.equals(primaryRef.getRefTypeAc())) || (primaryRef.getRefTypeAc() == null && !CvXrefQualifier.PRIMARY_REFERENCE.equals(primaryRef.getRefType().toLowerCase())) || (primaryRef.getDbAc() != null && !CvDatabase.DOI_MI_REF.equals(primaryRef.getDbAc())) || (primaryRef.getDbAc() == null && !CvDatabase.DOI.equals(primaryRef.getDb().toLowerCase())) ) { return false; } return true; }
private Set<Xref> getXrefs(psidev.psi.mi.xml.model.Xref psiXREF) { // set to return Set<Xref> toReturn = new HashSet<Xref>(); // check args if (psiXREF == null) return toReturn; // create the list of all other psimi xrefs List<DbReference> psiDBRefList = new ArrayList<DbReference>(); DbReference primaryRef = psiXREF.getPrimaryRef(); if(primaryRef != null) { //looks, it should never be null in a valid PSI-MI model if ("identity".equals(primaryRef.getRefType()) || "identical object".equals(primaryRef.getRefType())) { UnificationXref bpXref = unificationXref(primaryRef.getDb(), primaryRef.getId()); toReturn.add(bpXref); } else { psiDBRefList.add(psiXREF.getPrimaryRef()); } } if (psiXREF.hasSecondaryRef()) { psiDBRefList.addAll(psiXREF.getSecondaryRef()); } for (DbReference psiref : psiDBRefList) { if(psiref==null) continue; xref(psiref, toReturn); } return toReturn; }
private boolean hasValidPrimaryRef( DbReference primaryRef ) { if ( (primaryRef.getRefTypeAc() != null && !CvXrefQualifier.PRIMARY_REFERENCE_MI_REF.equals(primaryRef.getRefTypeAc())) || (primaryRef.getRefTypeAc() == null && !CvXrefQualifier.PRIMARY_REFERENCE.equals(primaryRef.getRefType().toLowerCase())) || (primaryRef.getDbAc() != null && !CvDatabase.PUBMED_MI_REF.equals(primaryRef.getDbAc()) && !CvDatabase.DOI_MI_REF.equals(primaryRef.getDbAc())) || (primaryRef.getDbAc() == null && !CvDatabase.PUBMED.equals(primaryRef.getDb().toLowerCase()) && !CvDatabase.DOI.equals(primaryRef.getDb().toLowerCase())) ) { return false; } return true; }
private UnificationXref getPrimaryUnificationXref(psidev.psi.mi.xml.model.Xref psiXref) { if (psiXref==null || psiXref.getPrimaryRef() == null) return null; UnificationXref toReturn = null; DbReference psiDBRef = psiXref.getPrimaryRef(); String refType = (psiDBRef.hasRefType()) ? psiDBRef.getRefType() : null; // If multiple ids given with comma separated values, then split them. if (refType==null || "identity".equals(refType) || "identical object".equals(refType)) { toReturn = unificationXref(psiDBRef.getDb(), psiDBRef.getId()); } return toReturn; }
/** * Collect DbReference that match the given database criteria. * * @param xref * @param name * @param miRef * @return a non null collection. */ public static Collection<DbReference> searchByType( Xref xref, String name, String miRef ) { if ( name == null && miRef == null ) { throw new IllegalArgumentException( "You must give either a name of an MI reference (or both)." ); } List<DbReference> collected = new ArrayList<DbReference>( 2 ); List<DbReference> xrefs = getAllDbReferences( xref ); for ( DbReference reference : xrefs ) { // Priority to the MI ref is available. if ( miRef != null ) { if ( miRef.equalsIgnoreCase( reference.getRefTypeAc() ) ) { collected.add( reference ); } } else if ( name != null ) { if ( name.equalsIgnoreCase( reference.getRefType() ) ) { collected.add( reference ); } } } return collected; }
if (!ref.hasRefType() ||(ref.hasRefType() && !ref.getRefType().equalsIgnoreCase("identity"))) { CrossReference cr = buildCrossReference(ref); if (!xrefs.contains(cr)) {
protected void fixPubmedReferenceAsIdentityToPrimaryRef(DbReference dbRef) { if (((dbRef.getDbAc() != null && CvDatabase.PUBMED_MI_REF.equals(dbRef.getDbAc())) || (dbRef.getDbAc() == null && CvDatabase.PUBMED.equals(dbRef.getDb().toLowerCase()))) && (( dbRef.getRefTypeAc() != null && CvXrefQualifier.IDENTITY_MI_REF.equals(dbRef.getRefTypeAc())) || ( dbRef.getRefTypeAc() == null && CvXrefQualifier.IDENTITY.equals(dbRef.getRefType().toLowerCase())))) { dbRef.setRefTypeAc(CvXrefQualifier.PRIMARY_REFERENCE_MI_REF); dbRef.setRefType(CvXrefQualifier.PRIMARY_REFERENCE); final ConverterMessage converterMessage = new ConverterMessage(MessageLevel.WARN, "Incorrect cross refernece to Pubmed that had qualifier 'identity'. Changed to 'primary-reference", ConverterContext.getInstance().getLocation().getCurrentLocation()); converterMessage.setAutoFixed(true); ConverterContext.getInstance().getReport().getMessages().add(converterMessage); } }
private void xref(DbReference psiref, Set<Xref> bpXrefs) { // process ref type String refType = (psiref.hasRefType()) ? psiref.getRefType() : null; String refTypeAc = (psiref.hasRefTypeAc()) ? psiref.getRefTypeAc() : null; String psiDBRefId = psiref.getId(); String psiDBRefDb = psiref.getDb(); // If multiple ids given with comma separated values, then split them. for (String dbRefId : psiDBRefId.split(",")) { Xref bpXref = null; // Let's not make UnificationXrefs. RelationshipXref is more safe. // Often, a gene or omim ID (can be another species') is a protein's xref id with 'identity' type... if(!"pubmed".equalsIgnoreCase(psiDBRefDb)) { bpXref = relationshipXref(psiDBRefDb, dbRefId, refType, refTypeAc); } else { //TODO shall we skip PublicationXref here (IntAct puts the same PSIMI paper pmid everywhere...)? bpXref = publicationXref(psiDBRefDb, dbRefId); } if (bpXref != null) bpXrefs.add(bpXref); } }
private RelationshipXref getInteractorPrimaryRef(psidev.psi.mi.xml.model.Xref psiXref) { if (psiXref==null || psiXref.getPrimaryRef() == null) return null; DbReference psiDBRef = psiXref.getPrimaryRef(); String refType = (psiDBRef.hasRefType()) ? psiDBRef.getRefType() : null; String refTypeAc = (psiDBRef.hasRefType()) ? psiDBRef.getRefTypeAc() : null; return relationshipXref(psiDBRef.getDb(), psiDBRef.getId(), refType, refTypeAc); }
public psidev.psi.mi.xml254.jaxb.DbReference toJaxb( psidev.psi.mi.xml.model.DbReference mDbReference ) { if ( mDbReference == null ) { throw new IllegalArgumentException( "You must give a non null model DbReference." ); } psidev.psi.mi.xml254.jaxb.DbReference jDbReference = new psidev.psi.mi.xml254.jaxb.DbReference(); // Initialise the JAXB object reading the model // 1. set attributes jDbReference.setDb( mDbReference.getDb() ); jDbReference.setDbAc( mDbReference.getDbAc() ); jDbReference.setId( mDbReference.getId() ); jDbReference.setRefType( mDbReference.getRefType() ); jDbReference.setRefTypeAc( mDbReference.getRefTypeAc() ); jDbReference.setSecondary( mDbReference.getSecondary() ); jDbReference.setVersion( mDbReference.getVersion() ); return jDbReference; } }
public psidev.psi.mi.xml253.jaxb.DbReferenceType toJaxb( psidev.psi.mi.xml.model.DbReference mDbReference ) { if ( mDbReference == null ) { throw new IllegalArgumentException( "You must give a non null model DbReference." ); } psidev.psi.mi.xml253.jaxb.DbReferenceType jDbReference = new psidev.psi.mi.xml253.jaxb.DbReferenceType(); // Initialise the JAXB object reading the model // 1. set attributes jDbReference.setDb( mDbReference.getDb() ); jDbReference.setDbAc( mDbReference.getDbAc() ); jDbReference.setId( mDbReference.getId() ); jDbReference.setRefType( mDbReference.getRefType() ); jDbReference.setRefTypeAc( mDbReference.getRefTypeAc() ); jDbReference.setSecondary( mDbReference.getSecondary() ); jDbReference.setVersion( mDbReference.getVersion() ); return jDbReference; } }
if (ref1.getRefType() != null && ref2.getRefType() == null){ return false; else if (ref1.getRefType() == null && ref2.getRefType() != null){ return false; else if (ref1.getRefType() != null && ref2.getRefType() != null && !ref1.getRefType().equalsIgnoreCase(ref2.getRefType())) { return false;
String refType = psiObject.getRefType(); String refTypeAc = psiObject.getRefTypeAc();