/** * Finds a publication based on its properties. * * @param publication the object we are searching an AC for. * @return an AC or null if it couldn't be found. */ protected String findAcForPublication( Publication publication ) { // TODO add primary-reference first, then shortlabel Query query = getEntityManager().createQuery( "select pub.ac from Publication pub where pub.shortLabel = :shortLabel" ); query.setParameter( "shortLabel", publication.getShortLabel() ); return getFirstAcForQuery( query, publication ); }
/** * Finds a publication based on its properties. * * @param publication the object we are searching an AC for. * @return an AC or null if it couldn't be found. */ protected String findAcForPublication( Publication publication ) { // TODO add primary-reference first, then shortlabel Query query = getEntityManager().createQuery( "select pub.ac from Publication pub where pub.shortLabel = :shortLabel" ); query.setParameter( "shortLabel", publication.getShortLabel() ); return getFirstAcForQuery( query, publication ); }
private boolean isPublicationEligibleForDataset(Publication p){ // the publication is not excluded by the selector if (this.selector.getPublicationsIdToExclude().contains(p.getShortLabel())){ return false; } // all the experiments must contain less than 100 interactions for (Experiment exp : p.getExperiments()){ if (this.selector.getMaxNumberOfInteractionsPerExperiment() <= exp.getInteractions().size()){ return false; } } return true; }
/** * TODO: check on the primary ref xref first */ protected Publication fetchFromDataSource(Publication intactObject) { return getIntactContext().getDataContext().getDaoFactory() .getPublicationDao().getByShortLabel(intactObject.getShortLabel()); }
log.info("Start processing publication : " + publication.getShortLabel()); log.info("Skip publication " + publication.getShortLabel() + " because does not contain any experiments"); return null; createPublicationEntry(publicationEntries, publication.getCreated(), publication.getShortLabel(), this.currentNegativeStringBuilder, true); createPublicationEntry(publicationEntries, publication.getCreated(), publication.getShortLabel(), this.currentStringBuilder, false);
/** * Add the dataset annotation for each experiment in the list * @param publications : the publications */ private void addDatasetToExperimentsAndPublication(List<Publication> publications) throws IOException, DatasetException { for (Publication p : publications){ if (!processedPublications.contains(p.getAc()) && isPublicationEligibleForDataset(p)){ processedPublications.add(p.getAc()); String pubId = p.getShortLabel(); // if publication has not been processed, we add the dataset to the publication if (this.listOfpublicationUpdated.add(pubId)){ Annotation annotation = createNewDataset(); log.info("Add dataset to " + p.getAc() + ": " + p.getShortLabel()); p.addAnnotation(annotation); for (Experiment exp : p.getExperiments()){ Annotation annotation2 = createNewDataset(); log.info("Add dataset to " + exp.getAc() + ": " + exp.getShortLabel()); exp.addAnnotation(annotation2); IntactContext.getCurrentInstance().getCorePersister().saveOrUpdate(exp); } IntactContext.getCurrentInstance().getCorePersister().saveOrUpdate(p); } } } }
/** * Gets the pubmed ID for an Experiment - whitout hitting the database * @param experiment the experiment to get the pubmed id from * @return the pubmed id */ public static String getPubmedId(Experiment experiment) { String pubmedId = null; Publication publication = experiment.getPublication(); if (publication != null) { pubmedId = publication.getShortLabel(); } if (pubmedId == null) { for (ExperimentXref xref : experiment.getXrefs()) { CvObjectXref idQualXref = CvObjectUtils.getPsiMiIdentityXref(xref.getCvXrefQualifier()); CvObjectXref idCvDatabase = CvObjectUtils.getPsiMiIdentityXref(xref.getCvDatabase()); if (idQualXref.getPrimaryId().equals(CvXrefQualifier.PRIMARY_REFERENCE_MI_REF) && idCvDatabase.getPrimaryId().equals(CvDatabase.PUBMED_MI_REF)) { pubmedId = xref.getPrimaryId(); } } } return pubmedId; }
public Experiment createExperimentEmpty(String shortLabel) { Experiment experiment = new Experiment(getInstitution(), shortLabel, createBioSourceRandom()); experiment.setCvInteraction(createCvObject(CvInteraction.class, CvInteraction.COSEDIMENTATION_MI_REF, CvInteraction.COSEDIMENTATION)); experiment.setCvIdentification(createCvObject(CvIdentification.class, CvIdentification.PREDETERMINED_MI_REF, CvIdentification.PREDETERMINED)); experiment.setPublication(createPublicationRandom()); experiment.addXref(createPrimaryReferenceXref(experiment, experiment.getPublication().getShortLabel())); return experiment; }
public Experiment createExperimentEmpty(String shortLabel) { Experiment experiment = new Experiment(getInstitution(), shortLabel, createBioSourceRandom()); experiment.setCvInteraction(createCvObject(CvInteraction.class, CvInteraction.COSEDIMENTATION_MI_REF, CvInteraction.COSEDIMENTATION)); experiment.setCvIdentification(createCvObject(CvIdentification.class, CvIdentification.PREDETERMINED_MI_REF, CvIdentification.PREDETERMINED)); final Publication publication = createPublicationRandom(); experiment.setPublication(publication); publication.addExperiment(experiment); experiment.addXref(createPrimaryReferenceXref(experiment, experiment.getPublication().getShortLabel())); return experiment; }
public Experiment createExperimentEmpty(String shortLabel) { Experiment experiment = new Experiment(getInstitution(), shortLabel, createBioSourceRandom()); experiment.setCvInteraction(createCvObject(CvInteraction.class, CvInteraction.COSEDIMENTATION_MI_REF, CvInteraction.COSEDIMENTATION)); experiment.setCvIdentification(createCvObject(CvIdentification.class, CvIdentification.PREDETERMINED_MI_REF, CvIdentification.PREDETERMINED)); final Publication publication = createPublicationRandom(); experiment.setPublication(publication); publication.addExperiment(experiment); experiment.addXref(createPrimaryReferenceXref(experiment, experiment.getPublication().getShortLabel())); return experiment; }
if (!isBibRefSet && publication.getXrefs().isEmpty() && publication.getShortLabel() != null){ 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;