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; }
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; } }
Set<DbReference> existingDbRefs = new HashSet(); if (expDesc.getBibref() != null && expDesc.getBibref().getXref() != null){ existingDbRefs.addAll(expDesc.getBibref().getXref().getAllDbReferences()); if (expDesc.getBibref() != null && expDesc.getBibref().getXref() != null){ existingDbRefs.addAll(expDesc.getBibref().getXref().getAllDbReferences());
if( bibref != null && bibref.getXref() != null ) { IntactConverterUtils.populateXref(psiObject.getBibref().getXref(), experiment, this.xrefConverter); for (DbReference ref : bibref.getXref().getAllDbReferences()){ if (hasValidPubmedPrimaryRef( ref )){ validPubmedPrimaryRef = ref; final String message = "Bibref in ExperimentDescription [PSI Id=" + psiObject.getId() + "] " + "should have a primary-reference (refTypeAc=" + CvXrefQualifier.PRIMARY_REFERENCE_MI_REF + ") " + "with reference to Pubmed (dbAc=" + CvDatabase.PUBMED_MI_REF + ") or a DOI (dbAc=" + CvDatabase.DOI_MI_REF + "): " + bibref.getXref().getPrimaryRef(); log.warn(message); addMessageToContext(MessageLevel.WARN, message, true); if (hasValidPubmedPrimaryRef( ref )){ validPubmedPrimaryRef = ref; if (bibref.getXref().getPrimaryRef() == null){ bibref.getXref().setPrimaryRef(ref); bibref.getXref().getSecondaryRef().add(ref); if (validDOIPrimaryRef != null){ validDOIPrimaryRef = ref; if (bibref.getXref().getPrimaryRef() == null){ bibref.getXref().setPrimaryRef(ref); bibref.getXref().getSecondaryRef().add(ref); else if (bibref.getXref() == null){ bibref.setXref(new Xref(ref));
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; }
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; } }
public Institution psiToIntact(Source psiObject) { Institution institution = super.psiToIntact( psiObject ); setInstitution(institution); if ( !isNewIntactObjectCreated() ) { return institution; } psiStartConversion(psiObject); IntactConverterUtils.populateNames(psiObject.getNames(), institution, aliasConverter); IntactConverterUtils.populateXref(psiObject.getXref(), institution, xrefConverter); if (psiObject.getBibref() != null) { IntactConverterUtils.populateXref(psiObject.getBibref().getXref(), institution, xrefConverter); } IntactConverterUtils.populateAnnotations(psiObject, institution, institution, annotationConverter); setInstitution(institution); psiEndConversion(psiObject); return institution; }
psidev.psi.mi.xml.model.Xref psiXREF = experimentDescription.getBibref().getXref(); if (psiXREF != null) { PublicationXref px = publicationXref(psiXREF.getPrimaryRef().getDb(), psiXREF.getPrimaryRef().getId());
private Publication createUnassignedPublication(Bibref bibRef, Experiment exp) { String pubId = PublicationUtils.nextUnassignedId(IntactContext.getCurrentInstance()); Publication publication = (Publication) ConversionCache.getElement("pub:"+pubId); if (publication != null) { return publication; } publication = new Publication(getInstitution(), pubId); CvDatabase pubmed = CvObjectUtils.createCvObject(getInstitution(), CvDatabase.class, CvDatabase.PUBMED_MI_REF, CvDatabase.PUBMED); CvXrefQualifier primary = CvObjectUtils.createCvObject(getInstitution(), CvXrefQualifier.class, CvXrefQualifier.PRIMARY_REFERENCE_MI_REF, CvXrefQualifier.PRIMARY_REFERENCE); // add unassigned as primary ref publication.addXref(new PublicationXref(getInstitution(), pubmed, pubId, primary)); // add unassigned to exeriment exp.addXref(new ExperimentXref(getInstitution(), pubmed, pubId, primary)); if (bibRef != null){ 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; }
psidev.psi.mi.xml.model.Xref psiXREF = source.getBibref().getXref(); if (psiXREF != null) { px = publicationXref(psiXREF.getPrimaryRef().getDb(), psiXREF.getPrimaryRef().getId());