jExperimentDescription.setId( mExperimentDescription.getId() ); if ( mExperimentDescription.getNames() != null ) { jExperimentDescription.setNames( namesConverter.toJaxb( mExperimentDescription.getNames() ) ); if ( mExperimentDescription.getBibref() != null ) { jExperimentDescription.setBibref( bibrefConverter.toJaxb( mExperimentDescription.getBibref() ) ); if ( mExperimentDescription.hasXref() ) { jExperimentDescription.setXref( xrefConverter.toJaxb( mExperimentDescription.getXref() ) ); for ( Organism mOrganism : mExperimentDescription.getHostOrganisms() ) { if ( jExperimentDescription.getHostOrganismList() == null ) { jExperimentDescription.setHostOrganismList( new HostOrganismList() ); if ( mExperimentDescription.getInteractionDetectionMethod() != null ) { jExperimentDescription.setInteractionDetectionMethod( cvTypeConverter.toJaxb( mExperimentDescription.getInteractionDetectionMethod() ) ); if ( mExperimentDescription.getParticipantIdentificationMethod() != null ) { jExperimentDescription.setParticipantIdentificationMethod( cvTypeConverter.toJaxb( mExperimentDescription.getParticipantIdentificationMethod() ) ); if ( mExperimentDescription.getFeatureDetectionMethod() != null ) { jExperimentDescription.setFeatureDetectionMethod( cvTypeConverter.toJaxb( mExperimentDescription.getFeatureDetectionMethod() ) ); for ( Confidence mConfidence : mExperimentDescription.getConfidences() ) { if ( jExperimentDescription.getConfidenceList() == null ) {
psidev.psi.mi.xml.model.ExperimentDescription mExperimentDescription = new psidev.psi.mi.xml.model.ExperimentDescription(); mExperimentDescription.setId( jExperimentDescription.getId() ); mExperimentDescription.setNames( namesConverter.fromJaxb( jExperimentDescription.getNames() ) ); mExperimentDescription.setBibref( bibrefConverter.fromJaxb( jExperimentDescription.getBibref() ) ); mExperimentDescription.setXref( xrefConverter.fromJaxb( jExperimentDescription.getXref() ) ); for ( psidev.psi.mi.xml254.jaxb.HostOrganism jHostOrganism : jExperimentDescription.getHostOrganismList().getHostOrganisms() ) { mExperimentDescription.getHostOrganisms().add( organismConverter.fromJaxb( jHostOrganism ) ); mExperimentDescription.setInteractionDetectionMethod( cvTypeConverter.fromJaxb( jExperimentDescription.getInteractionDetectionMethod(), InteractionDetectionMethod.class ) ); mExperimentDescription.setParticipantIdentificationMethod( cvTypeConverter.fromJaxb( jExperimentDescription.getParticipantIdentificationMethod(), ParticipantIdentificationMethod.class ) ); mExperimentDescription.setFeatureDetectionMethod( cvTypeConverter.fromJaxb( jExperimentDescription.getFeatureDetectionMethod(), FeatureDetectionMethod.class ) ); for ( psidev.psi.mi.xml254.jaxb.Confidence jConfidence : jExperimentDescription.getConfidenceList().getConfidences() ) { mExperimentDescription.getConfidences().add( confidenceConverter.fromJaxb( jConfidence ) );
public static ExperimentDescription createExperiment(String name, String publicationId, InteractionDetectionMethod interactionDetectionMethod, ParticipantIdentificationMethod participantIdentificationMethod, Organism hostOrganism) { ExperimentDescription experiment = new ExperimentDescription(); assignNextId(experiment); experiment.setNames(createNames(name, null)); experiment.setBibref(createBibrefPubmed(publicationId)); experiment.setInteractionDetectionMethod(interactionDetectionMethod); experiment.setParticipantIdentificationMethod(participantIdentificationMethod); experiment.getHostOrganisms().add(hostOrganism); return experiment; }
public Collection<Attribute> extractPublicationAttributesFromExperiment(ExperimentDescription expDesc){ if (!expDesc.hasAttributes()){ return Collections.EMPTY_LIST; } Collection<Attribute> attributes = new ArrayList<Attribute>(expDesc.getAttributes().size()); for (Attribute attr : expDesc.getAttributes()){ if (attr.getNameAc() != null){ if (publicationTopicsMi.contains(attr.getNameAc())){ attributes.add(attr); } } else if (attr.getName() != null){ if (publicationTopics.contains(attr.getName().toLowerCase())){ attributes.add(attr); } } } return attributes; }
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; }
interaction.getImexId(), interaction.getId(), experimentDescription.getId()); if (experimentDescription.hasXref()) { for(Xref xref : getXrefs(experimentDescription.getXref())) evidence.addXref(xref); if (experimentDescription.getBibref() != null) { psidev.psi.mi.xml.model.Xref psiXREF = experimentDescription.getBibref().getXref(); if (psiXREF != null) { PublicationXref px = publicationXref(psiXREF.getPrimaryRef().getDb(), psiXREF.getPrimaryRef().getId()); if (experimentDescription.hasNames()) { Names names = experimentDescription.getNames(); if(names.hasFullName()) evidence.addComment(names.getFullName().trim()); if (experimentDescription.hasAttributes()) { for(String attr : getAttributes(experimentDescription.getAttributes())) evidence.addComment(attr.trim()); if(experimentDescription.hasHostOrganisms()) { for(Organism organism : experimentDescription.getHostOrganisms()) evidence.addComment("Host " + organism.toString()); if (experimentDescription.hasConfidences()) { for (Confidence psiConfidence : experimentDescription.getConfidences()) { Score bpScoreOrConfidence = getScoreOrConfidence(psiConfidence); if (bpScoreOrConfidence != null)
String shortLabel = IntactConverterUtils.getShortLabelFromNames(psiObject.getNames()); if (shortLabel == null) { shortLabel = IntactConverterUtils.createExperimentTempShortLabel(); if (psiObject.getNames() != null) { experiment.setFullName(psiObject.getNames().getFullName()); IntactConverterUtils.populateXref(psiObject.getXref(), experiment, this.xrefConverter); IntactConverterUtils.populateAnnotations(psiObject, experiment, getInstitution(), this.annotationConverter); if (psiObject.getHostOrganisms() != null && !psiObject.getHostOrganisms().isEmpty()) { Organism hostOrganism = psiObject.getHostOrganisms().iterator().next(); if (psiObject.getHostOrganisms().size() > 1){ log.error("Experiment with "+psiObject.getHostOrganisms().size()+" host organisms : " + experiment.getShortLabel() + ". Only the first host organism will be converted in Intact."); InteractionDetectionMethod idm = psiObject.getInteractionDetectionMethod(); if (idm != null){ CvInteraction cvInteractionDetectionMethod = this.interactionDetectionMethodConverter.psiToIntact(idm); ParticipantIdentificationMethod pim = psiObject.getParticipantIdentificationMethod(); if (pim != null) { CvIdentification cvParticipantIdentification = this.participantIdentificationMethodConverter.psiToIntact(pim); Bibref bibref = psiObject.getBibref(); DbReference validPubmedPrimaryRef = null; DbReference validDOIPrimaryRef = null; IntactConverterUtils.populateXref(psiObject.getBibref().getXref(), experiment, this.xrefConverter);
experimentDescription = new ExperimentDescription(bibref, detectionMethod); experimentDescription.setId(IdentifierGenerator.getInstance().nextId()); experimentDescription = new ExperimentDescription(new Bibref(imexPrimary), detectionMethod); experimentDescription.setId(IdentifierGenerator.getInstance().nextId()); } else { experimentDescription.setXref(imexPrimary); experimentDescription = new ExperimentDescription(new Bibref(ref), detectionMethod); experimentDescription.setId(IdentifierGenerator.getInstance().nextId()); } else if (imexPrimary == null) { experimentDescription.setXref(ref); } else { experimentDescription.getXref().getSecondaryRef().addAll(ref.getAllDbReferences()); experimentDescription.getAttributes().add(pubYear); experimentDescription.setNames(names); Attribute authorList = new Attribute("author-list", firstAuthor); if (!experimentDescription.getAttributes().contains(authorList)) { experimentDescription.getAttributes().add(authorList); experimentDescription.getHostOrganisms().add(xmlOrganism);
public static Collection<ExperimentDescription> nonRedundantExperimentsFromPsiEntry(Entry psiEntry) { Map<Integer,ExperimentDescription> nonRedundantExps = new HashMap<Integer,ExperimentDescription>(); if( ConverterContext.getInstance().isGenerateCompactXml() ) { for (ExperimentDescription expDesc : psiEntry.getExperiments()) { nonRedundantExps.put(expDesc.getId(), expDesc); } } else { for (psidev.psi.mi.xml.model.Interaction interaction : psiEntry.getInteractions()) { for (ExperimentDescription exp : interaction.getExperiments()) { nonRedundantExps.put(exp.getId(), exp); } } } return nonRedundantExps.values(); }
Attribute attribute = annotationConverter.intactToPsi(attr); if (!expDesc.getAttributes().contains(attribute)){ expDesc.getAttributes().add(attribute); Set<DbReference> convertedRefs = PsiConverterUtils.toDbReferences(pub.getXrefs(), publicationXrefConverter); if (expDesc.getXref() == null){ Set<DbReference> existingDbRefs = new HashSet(); if (expDesc.getBibref() != null && expDesc.getBibref().getXref() != null){ existingDbRefs.addAll(expDesc.getBibref().getXref().getAllDbReferences()); expDesc.setXref(expRef); Xref expRef = expDesc.getXref(); if (expDesc.getBibref() != null && expDesc.getBibref().getXref() != null){ existingDbRefs.addAll(expDesc.getBibref().getXref().getAllDbReferences());
CrossReference detection = cvConverter.toMitab(experiment.getInteractionDetectionMethod()); if (experiment.getBibref() != null) { CrossReference pub = pubConverter.toMitab(experiment.getBibref()); if (pub != null) { bi.getPublications().add(pub); if (experiment.getAttributes() != null) { String authorName = "-"; String pubYear = ""; for (Attribute attribute : experiment.getAttributes()) { if ("author-list".equals(attribute.getName())) { authorName = attribute.getValue();
expDesc.setInteractionDetectionMethod(detMethod); expDesc.setParticipantIdentificationMethod(identMethod); expDesc.getHostOrganisms().add(organism); expDesc.setBibref(bibref); PsiConverterUtils.populateXref(intactObject, bibref, xrefConverter); if (bibref.getXref() != null && bibref.getXref().getPrimaryRef() != null){ expDesc.setBibref(bibref); expDesc.setBibref(bibref);
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; } }
private void mapExperiments(Collection<ExperimentDescription> exp, final CyTable networkTable) { int expCount = 1; for(ExperimentDescription desc: exp) { String prefix = "Experiment " + expCount + ": "; final Names names = desc.getNames(); mapNames(networkTable, network.getSUID(), names, prefix); expCount++; } }
/** * Retrieve an experiment description in an interaction using an experiment ref * @param eref : the experiment reference * @param i : the interaction to look into * @return the experiment which has been found */ private ExperimentDescription findExperimentDescriptionInInteraction(ExperimentRef eref, Interaction i){ for ( ExperimentDescription ed : i.getExperiments() ) { if( ed.getId() == eref.getRef() ) { return ed; } } return null; }
jExperimentDescription.setId( mExperimentDescription.getId() ); if ( mExperimentDescription.getNames() != null ) { jExperimentDescription.setNames( namesConverter.toJaxb( mExperimentDescription.getNames() ) ); if ( mExperimentDescription.getBibref() != null ) { jExperimentDescription.setBibref( bibrefConverter.toJaxb( mExperimentDescription.getBibref() ) ); if ( mExperimentDescription.hasXref() ) { jExperimentDescription.setXref( xrefConverter.toJaxb( mExperimentDescription.getXref() ) ); for ( Organism mOrganism : mExperimentDescription.getHostOrganisms() ) { if ( jExperimentDescription.getHostOrganismList() == null ) { jExperimentDescription.setHostOrganismList( new ExperimentType.HostOrganismList() ); if ( mExperimentDescription.getInteractionDetectionMethod() != null ) { jExperimentDescription.setInteractionDetectionMethod( cvTypeConverter.toJaxb( mExperimentDescription.getInteractionDetectionMethod() ) ); if ( mExperimentDescription.getParticipantIdentificationMethod() != null ) { jExperimentDescription.setParticipantIdentificationMethod( cvTypeConverter.toJaxb( mExperimentDescription.getParticipantIdentificationMethod() ) ); if ( mExperimentDescription.getFeatureDetectionMethod() != null ) { jExperimentDescription.setFeatureDetectionMethod( cvTypeConverter.toJaxb( mExperimentDescription.getFeatureDetectionMethod() ) ); for ( Confidence mConfidence : mExperimentDescription.getConfidences() ) { if ( jExperimentDescription.getConfidenceList() == null ) {
psidev.psi.mi.xml.model.ExperimentDescription mExperimentDescription = new psidev.psi.mi.xml.model.ExperimentDescription(); mExperimentDescription.setId( jExperimentDescription.getId() ); mExperimentDescription.setNames( namesConverter.fromJaxb( jExperimentDescription.getNames() ) ); mExperimentDescription.setBibref( bibrefConverter.fromJaxb( jExperimentDescription.getBibref() ) ); mExperimentDescription.setXref( xrefConverter.fromJaxb( jExperimentDescription.getXref() ) ); for ( ExperimentType.HostOrganismList.HostOrganism jHostOrganism : jExperimentDescription.getHostOrganismList().getHostOrganisms() ) { mExperimentDescription.getHostOrganisms().add( organismConverter.fromJaxb( jHostOrganism ) ); mExperimentDescription.setInteractionDetectionMethod( cvTypeConverter.fromJaxb( jExperimentDescription.getInteractionDetectionMethod(), InteractionDetectionMethod.class ) ); mExperimentDescription.setParticipantIdentificationMethod( cvTypeConverter.fromJaxb( jExperimentDescription.getParticipantIdentificationMethod(), ParticipantIdentificationMethod.class ) ); mExperimentDescription.setFeatureDetectionMethod( cvTypeConverter.fromJaxb( jExperimentDescription.getFeatureDetectionMethod(), FeatureDetectionMethod.class ) ); for ( ConfidenceListType.Confidence jConfidence : jExperimentDescription.getConfidenceList().getConfidences() ) { mExperimentDescription.getConfidences().add( confidenceConverter.fromJaxb( jConfidence ) );
private void normalizeEntry(Entry entry) { if (entry.getExperiments().isEmpty()) { for (Interaction interaction : entry.getInteractions()) { interaction.getExperimentRefs().clear(); for (ExperimentDescription exp : interaction.getExperiments()) { entry.getExperiments().add(exp); interaction.getExperimentRefs().add(new ExperimentRef(exp.getId())); } } } if (entry.getInteractors().isEmpty()) { for (Interaction interaction : entry.getInteractions()) { for(Participant participant : interaction.getParticipants()) { entry.getInteractors().add(participant.getInteractor()); } } } }
public psidev.psi.mi.xml253.jaxb.ParticipantType.ParticipantIdentificationMethodList.ParticipantIdentificationMethod toJaxb( psidev.psi.mi.xml.model.ParticipantIdentificationMethod mParticipantIdentificationMethod ) throws ConverterException { if ( mParticipantIdentificationMethod == null ) { throw new IllegalArgumentException( "You must give a non null model Participant Identification Method." ); } // Initialise the JAXB object reading the model // 1. convert the CvType psidev.psi.mi.xml253.jaxb.ParticipantType.ParticipantIdentificationMethodList.ParticipantIdentificationMethod jParticipantIdentificationMethod = cvTypeConverter.toJaxb( mParticipantIdentificationMethod, psidev.psi.mi.xml253.jaxb.ParticipantType.ParticipantIdentificationMethodList.ParticipantIdentificationMethod.class ); // 2. convert remaining components // experiments if ( mParticipantIdentificationMethod.hasExperiments() ) { for ( ExperimentDescription mExperiment : mParticipantIdentificationMethod.getExperiments() ) { addExperimentRef( jParticipantIdentificationMethod, mExperiment.getId() ); } } else if ( mParticipantIdentificationMethod.hasExperimentRefs() ) { for ( ExperimentRef mExperiment : mParticipantIdentificationMethod.getExperimentRefs() ) { addExperimentRef( jParticipantIdentificationMethod, mExperiment.getRef() ); } } return jParticipantIdentificationMethod; }
public psidev.psi.mi.xml254.jaxb.ParticipantIdentificationMethod toJaxb( psidev.psi.mi.xml.model.ParticipantIdentificationMethod mParticipantIdentificationMethod ) throws ConverterException { if ( mParticipantIdentificationMethod == null ) { throw new IllegalArgumentException( "You must give a non null model Participant Identification Method." ); } // Initialise the JAXB object reading the model // 1. convert the CvType psidev.psi.mi.xml254.jaxb.ParticipantIdentificationMethod jParticipantIdentificationMethod = cvTypeConverter.toJaxb( mParticipantIdentificationMethod, psidev.psi.mi.xml254.jaxb.ParticipantIdentificationMethod.class ); // 2. convert remaining components // experiments if ( mParticipantIdentificationMethod.hasExperiments() ) { for ( ExperimentDescription mExperiment : mParticipantIdentificationMethod.getExperiments() ) { addExperimentRef( jParticipantIdentificationMethod, mExperiment.getId() ); } } else if ( mParticipantIdentificationMethod.hasExperimentRefs() ) { for ( ExperimentRef mExperiment : mParticipantIdentificationMethod.getExperimentRefs() ) { addExperimentRef( jParticipantIdentificationMethod, mExperiment.getRef() ); } } return jParticipantIdentificationMethod; }