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; }
public psidev.psi.mi.xml.model.Bibref fromJaxb( psidev.psi.mi.xml254.jaxb.Bibref jBibref ) { if ( jBibref == null ) { throw new IllegalArgumentException( "You must give a non null JAXB Bibref." ); } psidev.psi.mi.xml.model.Bibref mBibref = new psidev.psi.mi.xml.model.Bibref(); // 1. set attributes // 2. set encapsulated objects boolean foundAttributeList = false; boolean foundXref = false; if ( jBibref.getAttributeList() != null ) { foundAttributeList = true; for ( psidev.psi.mi.xml254.jaxb.Attribute jAttribute : jBibref.getAttributeList().getAttributes() ) { mBibref.getAttributes().add( attributeConverter.fromJaxb( jAttribute ) ); } } if ( jBibref.getXref() != null ) { foundXref = true; mBibref.setXref( xrefConverter.fromJaxb( jBibref.getXref() ) ); } if( foundAttributeList && foundXref ) { throw new IllegalArgumentException( "When defining a <bibref>, you must give as a child tag either an <xref> or an <attributeList>." ); } return mBibref; }
@Override public boolean equals( Object o ) { if ( this == o ) { return true; } if ( o == null || getClass() != o.getClass() ) { return false; } final ExperimentDescription that = ( ExperimentDescription ) o; if ( id != that.id ) { return false; } if ( bibref != null ? !bibref.equals( that.bibref ) : that.bibref != null ) { return false; } if ( interactionDetectionMethod != null ? !interactionDetectionMethod.equals( that.interactionDetectionMethod ) : that.interactionDetectionMethod != null ) { return false; } return true; }
if (mBibref.getXref() != null){ jBibref.setXref( xrefConverter.toJaxb( mBibref.getXref() ) ); if (!mBibref.getAttributes().isEmpty()){ psidev.psi.mi.xml254.jaxb.AttributeList attributeList = jBibref.getAttributeList(); if (attributeList == null){ for ( psidev.psi.mi.xml.model.Attribute mAttribute : mBibref.getAttributes() ) { attributeList.getAttributes().add( attributeConverter.toJaxb( mAttribute ) );
Bibref bibref = new Bibref(); boolean isBibRefSet = false; expDesc.setBibref(bibref); PsiConverterUtils.populateXref(intactObject, bibref, xrefConverter); if (bibref.getXref() != null && bibref.getXref().getPrimaryRef() != null){ isBibRefSet = true; Xref xref = new Xref(); xref.setPrimaryRef(new DbReference(CvDatabase.PUBMED, CvDatabase.PUBMED_MI_REF, publication.getShortLabel(), CvXrefQualifier.PRIMARY_REFERENCE, CvXrefQualifier.PRIMARY_REFERENCE_MI_REF)); bibref.setXref(xref); isBibRefSet = true; if (bibref.getXref() != null && bibref.getXref().getPrimaryRef() != null){ expDesc.setBibref(bibref); else if (bibref.hasAttributes()){ expDesc.setBibref(bibref);
public static Bibref createBibref(String publicationId, String dbAc, String dbName) { DbReference dbReference = createDbReference(publicationId, dbAc, dbName, "MI:0358", "primary-reference"); Xref xref = new Xref(dbReference); return new Bibref(xref); }
public Bibref( Xref xref ) { setXref( xref ); }
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); if (hasValidPubmedPrimaryRef( ref )){ if (bibref == null){
if (mBibref.getXref() != null){ jBibref.setXref( xrefConverter.toJaxb( mBibref.getXref() ) ); if (!mBibref.getAttributes().isEmpty()){ psidev.psi.mi.xml253.jaxb.AttributeListType attributeList = jBibref.getAttributeList(); if ( attributeList == null ) { for ( psidev.psi.mi.xml.model.Attribute mAttribute : mBibref.getAttributes() ) { attributeList.getAttributes().add( attributeConverter.toJaxb( mAttribute ) );
public Bibref fromMitab( CrossReference ref ) { Bibref bibref = null; if (ref != null && ref.getIdentifier() != null && ref.getDatabase() != null){ String db = ref.getDatabase(); String id = ref.getIdentifier(); DbReference primaryRef = new DbReference(id, db); primaryRef.setRefType("primary-reference"); primaryRef.setRefTypeAc("MI:0358"); if (db.equals("pubmed")) primaryRef.setDbAc("MI:0446"); Xref xref = new Xref(primaryRef); bibref = new Bibref(xref); } return bibref; }
private boolean extractPrimaryRefFromExperiment(Experiment intactObject, Bibref bibref) { if (!intactObject.getXrefs().isEmpty()){ Collection<uk.ac.ebi.intact.model.Xref> primaryRefs = searchXrefs(intactObject, CvDatabase.PUBMED_MI_REF, CvXrefQualifier.PRIMARY_REFERENCE_MI_REF, isCheckInitializedCollections()); if (primaryRefs.isEmpty()){ primaryRefs = searchXrefs(intactObject, CvDatabase.DOI_MI_REF, CvXrefQualifier.PRIMARY_REFERENCE_MI_REF, isCheckInitializedCollections()); } if (!primaryRefs.isEmpty()){ Iterator<uk.ac.ebi.intact.model.Xref> iterator = primaryRefs.iterator(); uk.ac.ebi.intact.model.Xref primaryRef = iterator.next(); Xref xref = new Xref(); xref.setPrimaryRef(new DbReference(primaryRef.getCvDatabase().getShortLabel(), primaryRef.getCvDatabase().getIdentifier(), primaryRef.getPrimaryId(), primaryRef.getCvXrefQualifier().getShortLabel(), primaryRef.getCvXrefQualifier().getIdentifier())); bibref.setXref(xref); while (iterator.hasNext()){ primaryRef = iterator.next(); xref.getSecondaryRef().add(new DbReference(primaryRef.getCvDatabase().getShortLabel(), primaryRef.getCvDatabase().getIdentifier(), primaryRef.getPrimaryId(), primaryRef.getCvXrefQualifier().getShortLabel(), primaryRef.getCvXrefQualifier().getIdentifier())); } return true; } } return false; }
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; } }
public psidev.psi.mi.xml.model.Bibref fromJaxb( psidev.psi.mi.xml253.jaxb.BibrefType jBibref ) { if ( jBibref == null ) { throw new IllegalArgumentException( "You must give a non null JAXB Bibref." ); } psidev.psi.mi.xml.model.Bibref mBibref = new psidev.psi.mi.xml.model.Bibref(); // 1. set attributes // 2. set encapsulated objects boolean foundAttributeList = false; boolean foundXref = false; if ( jBibref.getAttributeList() != null ) { foundAttributeList = true; for ( psidev.psi.mi.xml253.jaxb.AttributeListType.Attribute jAttribute : jBibref.getAttributeList().getAttributes() ) { mBibref.getAttributes().add( attributeConverter.fromJaxb( jAttribute ) ); } } if ( jBibref.getXref() != null ) { foundXref = true; mBibref.setXref( xrefConverter.fromJaxb( jBibref.getXref() ) ); } if( foundAttributeList && foundXref ) { throw new IllegalArgumentException( "When defining a <bibref>, you must give as a child tag either an <xref> or an <attributeList>." ); } return mBibref; }
experimentDescription = new ExperimentDescription(new Bibref(imexPrimary), detectionMethod); experimentDescription.setId(IdentifierGenerator.getInstance().nextId()); } else { experimentDescription = new ExperimentDescription(new Bibref(ref), detectionMethod); experimentDescription.setId(IdentifierGenerator.getInstance().nextId()); } else if (imexPrimary == null) {
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());
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());