private CrossReference buildCrossReference(DbReference ref) { return new CrossReferenceImpl(ref.getDb(), ref.getId()); }
/** * Checks if an Xref has the given PSI-MI reference * * @param xref * @param psiRef * @return */ public static boolean hasPsiId( Xref xref, String psiRef ) { if ( psiRef == null || "".equals( psiRef.trim() ) ) { throw new IllegalArgumentException( "You must give a non null/empty PSI-MI id." ); } if ( xref == null ) { return false; } List<DbReference> list = getAllDbReferences( xref ); for ( DbReference ref : list ) { if ( PSI_MI.equalsIgnoreCase( ref.getDb() ) || PSI_MI_REF.equalsIgnoreCase( ref.getDbAc() ) ) { if ( psiRef.equalsIgnoreCase( ref.getId() ) ) { log.debug( "Found Xref( psi-mi, " + psiRef + " )" ); return true; } } } return false; }
db = PSI_MI; Iterator<DbReference> iterator = refs.iterator(); id = iterator.next().getId(); if (iterator.hasNext()) { log.warn(cv + " has " + refs.size() + " references to PSI-MI to choose from, picked the first one."); while (iterator.hasNext()) { DbReference dbReference = iterator.next(); log.warn((++i) + ": " + dbReference.getId());
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; }
private Set<EvidenceCodeVocabulary> getEvidenceCodes(ExperimentDescription experimentDescription) { Set<EvidenceCodeVocabulary> toReturn = new HashSet<EvidenceCodeVocabulary>(); // get experiment methods Set<CvType> cvTypeSet = new HashSet<CvType>(3); //skip if "unspecified method" (MI:0686) is the interaction detection method if(experimentDescription.getInteractionDetectionMethod() != null && !"MI:0686".equalsIgnoreCase(experimentDescription.getInteractionDetectionMethod().getXref().getPrimaryRef().getId())) cvTypeSet.add(experimentDescription.getInteractionDetectionMethod()); if(experimentDescription.getParticipantIdentificationMethod() != null && !"MI:0686".equalsIgnoreCase(experimentDescription.getParticipantIdentificationMethod().getXref().getPrimaryRef().getId())) cvTypeSet.add(experimentDescription.getParticipantIdentificationMethod()); if(experimentDescription.getFeatureDetectionMethod() != null && !"MI:0686".equalsIgnoreCase(experimentDescription.getFeatureDetectionMethod().getXref().getPrimaryRef().getId())) cvTypeSet.add(experimentDescription.getFeatureDetectionMethod()); // create openControlledVocabulary objects for each detection method for (CvType cvtype : cvTypeSet) { EvidenceCodeVocabulary ecv = findOrCreateControlledVocabulary(cvtype, EvidenceCodeVocabulary.class); if (ecv != null) toReturn.add(ecv); } return toReturn; }
public CrossReference toMitab( Bibref bibref ) { CrossReference cr = null; if ( bibref != null && bibref.getXref() != null ) { Collection<DbReference> refs = XrefUtils.searchByType( bibref.getXref(), PRIMARY_REFERENCE, PRIMARY_REFERENCE_REF ); for ( DbReference ref : refs ) { if ( cr == null ) { cr = new CrossReferenceImpl( ref.getDb(), ref.getId() ); } else { log.warn( "More than once " + PRIMARY_REFERENCE + " found, first one was chosen." ); } } } return cr; }
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 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); } }
DbReference dbReference = status.getXref().getPrimaryRef(); if (dbReference != null) { String id = dbReference.getId();
protected RepoEntry entryToRepoEntry(Entry entry) { RepoEntry repoEntry = new RepoEntry(); normalizeEntry(entry); String name = entry.getExperiments().iterator().next() .getBibref().getXref().getPrimaryRef().getId(); repoEntry.setPmid(name); repoEntry.setReleaseDate(PsiExchange.getReleaseDate(entry)); return repoEntry; } }
protected Object psiElementKey(Source psiObject) { String key; if (psiObject.getNames() != null) { key = "source:"+psiObject.getNames().getShortLabel(); } else if (psiObject.getXref() != null) { key = "source:xref:"+psiObject.getXref().getPrimaryRef().getId(); } else if (psiObject.getBibref() != null) { key = "source:bibref:"+psiObject.getBibref().getXref().getPrimaryRef().getId(); } else { throw new PsiConversionException("Could not create key to cache the source: "+psiObject); } return key; } }
if(role.getXref() != null && !"MI:0499".equalsIgnoreCase(role.getXref().getPrimaryRef().getId())) { efv = findOrCreateControlledVocabulary(role, ExperimentalFormVocabulary.class); if(efv != null) {
private boolean isStatusOfType( RangeStatus status, String psimiName, String psimiIdentifier ) { boolean hasMiNumber = false; if (status.getXref() != null){ if (status.getXref().getPrimaryRef() != null){ final DbReference ref = status.getXref().getPrimaryRef(); if (ref.getDbAc() != null){ if (ref.getDbAc().equals(CvDatabase.PSI_MI_MI_REF)){ hasMiNumber = true; } else if (ref.getDb().equalsIgnoreCase(CvDatabase.PSI_MI)){ hasMiNumber = true; } } } } if ( status.getXref() != null && psimiIdentifier != null && hasMiNumber) { final DbReference ref = status.getXref().getPrimaryRef(); return psimiIdentifier.equalsIgnoreCase( ref.getId() ); } else if (status.getNames() != null){ final Names names = status.getNames(); return psimiName.equalsIgnoreCase(names.getShortLabel()) || psimiName.equalsIgnoreCase(names.getFullName()); } return false; }
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.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; } }
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; } }
private Publication createPublication(Bibref bibref, DbReference validPrimaryRef) { String pubId = validPrimaryRef.getId(); Publication publication = (Publication) ConversionCache.getElement("pub:"+pubId); if (publication != null) { return publication; } publication = new Publication(getInstitution(), pubId); IntactConverterUtils.populateXref(bibref.getXref(), publication, this.publicationXrefConverter); IntactConverterUtils.populateAnnotations(bibref, publication, getInstitution(), this.annotationConverter); IntactContext.getCurrentInstance().getLifecycleManager().getStartStatus().create(publication, "created by xml import"); ConversionCache.putElement("pub:"+pubId, publication); return publication; }
public X psiToIntact(DbReference psiObject) { String primaryId = psiObject.getId(); String secondaryId = psiObject.getSecondary(); String dbRelease = psiObject.getVersion();
psidev.psi.mi.xml.model.Xref psiXREF = source.getBibref().getXref(); if (psiXREF != null) { px = publicationXref(psiXREF.getPrimaryRef().getDb(), psiXREF.getPrimaryRef().getId());