public static <X extends Xref> void populateXref(psidev.psi.mi.xml.model.Xref psiXref, AnnotatedObject<X, ?> annotatedObject, XrefConverter<X> xrefConverter) { if (psiXref == null) { return; } if (psiXref.getPrimaryRef() != null) { addXref(psiXref.getPrimaryRef(), annotatedObject, xrefConverter); } for (DbReference secondaryRef : psiXref.getSecondaryRef()) { addXref(secondaryRef, annotatedObject, xrefConverter); } }
/** * Collect all DbReference under an xref. * * @param xref * @return a non null collection. */ public static List<DbReference> getAllDbReferences( Xref xref ) { ArrayList<DbReference> xrefs = new ArrayList<DbReference>(); xrefs.add( xref.getPrimaryRef() ); if ( xref.hasSecondaryRef() ) { for ( DbReference sec : xref.getSecondaryRef() ) { xrefs.add( sec ); } } return xrefs; }
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; }
protected boolean containsRole(Collection<ExperimentalRole> experimentalRoles, String[] rolesToFind) { if (experimentalRoles != null) { for (ExperimentalRole expRole : experimentalRoles) { if (expRole.getXref() != null && expRole.getXref().getPrimaryRef()!=null) { String ac = expRole.getXref().getPrimaryRef().getRefTypeAc(); for (String roleToFind : rolesToFind) { if (roleToFind.equals(ac)) { return true; } } } } } return false; } }
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 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); }
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; }
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; }
public psidev.psi.mi.xml254.jaxb.Xref toJaxb( psidev.psi.mi.xml.model.Xref mXref ) { if ( mXref == null ) { throw new IllegalArgumentException( "You must give a non null model Xref." ); } psidev.psi.mi.xml254.jaxb.Xref jXref = new psidev.psi.mi.xml254.jaxb.Xref(); // Initialise the JAXB object reading the model // 1. set attributes jXref.setPrimaryRef( dbReferenceConverter.toJaxb( mXref.getPrimaryRef() ) ); // 2. set encapsulated objects if ( mXref.hasSecondaryRef() ) { for ( psidev.psi.mi.xml.model.DbReference mRef : mXref.getSecondaryRef() ) { jXref.getSecondaryReves().add( dbReferenceConverter.toJaxb( mRef ) ); } } return jXref; } }
public psidev.psi.mi.xml253.jaxb.XrefType toJaxb( psidev.psi.mi.xml.model.Xref mXref ) { if ( mXref == null ) { throw new IllegalArgumentException( "You must give a non null model Xref." ); } psidev.psi.mi.xml253.jaxb.XrefType jXref = new psidev.psi.mi.xml253.jaxb.XrefType(); // Initialise the JAXB object reading the model // 1. set attributes jXref.setPrimaryRef( dbReferenceConverter.toJaxb( mXref.getPrimaryRef() ) ); // 2. set encapsulated objects if ( mXref.hasSecondaryRef() ) { for ( DbReference mRef : mXref.getSecondaryRef() ) { jXref.getSecondaryReves().add( dbReferenceConverter.toJaxb( mRef ) ); } } return jXref; } }
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; } }
DbReference dbReference = status.getXref().getPrimaryRef(); if (dbReference != null) { String id = dbReference.getId();
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) {
if (expRef.getPrimaryRef() == null){ Iterator<DbReference> iteratorDb = disjunction.iterator(); expRef.setPrimaryRef(iteratorDb.next());
if (psiInteractorType.getXref() != null && psiInteractorType.getXref().getPrimaryRef() != null) { typeId = psiInteractorType.getXref().getPrimaryRef().getId();
if (bibref.getXref() != null && bibref.getXref().getPrimaryRef() != null){ source.setBibref(bibref);
expDesc.setBibref(bibref); PsiConverterUtils.populateXref(intactObject, bibref, xrefConverter); if (bibref.getXref() != null && bibref.getXref().getPrimaryRef() != null){ isBibRefSet = true; if (bibref.getXref() != null && bibref.getXref().getPrimaryRef() != null){ expDesc.setBibref(bibref);
psidev.psi.mi.xml.model.Xref psiXREF = experimentDescription.getBibref().getXref(); if (psiXREF != null) { PublicationXref px = publicationXref(psiXREF.getPrimaryRef().getDb(), psiXREF.getPrimaryRef().getId()); if(px != null) evidence.addXref(px);
psidev.psi.mi.xml.model.Xref psiXREF = source.getBibref().getXref(); if (psiXREF != null) { px = publicationXref(psiXREF.getPrimaryRef().getDb(), psiXREF.getPrimaryRef().getId());