Search in sources :

Example 1 with CitationValueObject

use of ubic.gemma.model.common.description.CitationValueObject in project Gemma by PavlidisLab.

the class ShortBibliographicReferenceTag method doStartTag.

@Override
public int doStartTag() throws JspException {
    ShortBibliographicReferenceTag.log.debug("start tag");
    StringBuilder buf = new StringBuilder();
    if (this.citation == null) {
        buf.append("No accession");
    } else {
        String authorList = citation.getAuthorList();
        if (authorList != null) {
            String[] authors = StringUtils.split(authorList, ";");
            // if there are authors, only display the first author
            if (authors.length == 0) {
            } else if (authors.length == 1) {
                buf.append(authors[0]).append(" ");
            } else {
                buf.append(authors[0]).append(" et al. ");
            }
        } else {
            buf.append("Null author list");
        }
        // display the publication year
        Calendar pubDate = new GregorianCalendar();
        Date publicationDate = citation.getPublicationDate();
        if (publicationDate != null) {
            pubDate.setTime(publicationDate);
            buf.append("(").append(pubDate.get(Calendar.YEAR)).append(") ");
        } else {
            buf.append("Null publication date");
        }
        // add pubmed link
        if (citation.getPubAccession() != null) {
            String pubMedId = citation.getPubAccession().getAccession();
            CitationValueObject citationVO = CitationValueObject.convert2CitationValueObject(citation);
            if (StringUtils.isNotBlank(pubMedId)) {
                String link = citationVO.getPubmedURL();
                buf.append("<a target='_blank' href='").append(link).append("' ><img src='").append(Settings.getRootContext()).append("/images/pubmed.gif' /> </a>&nbsp;");
                /*
                     * Add link to edit page within Gemma
                     */
                buf.append("<a target='_blank' href='").append(Settings.getRootContext()).append("/bibRef/bibRefView.html?accession=").append(pubMedId).append("'><img src='").append(Settings.getRootContext()).append("/images/magnifier.png' /></a>");
            }
        }
    }
    try {
        pageContext.getOut().print(buf.toString());
    } catch (Exception ex) {
        throw new JspException(this.getClass().getName() + ex.getMessage());
    }
    return Tag.SKIP_BODY;
}
Also used : JspException(javax.servlet.jsp.JspException) Calendar(java.util.Calendar) GregorianCalendar(java.util.GregorianCalendar) CitationValueObject(ubic.gemma.model.common.description.CitationValueObject) GregorianCalendar(java.util.GregorianCalendar) Date(java.util.Date) JspException(javax.servlet.jsp.JspException)

Example 2 with CitationValueObject

use of ubic.gemma.model.common.description.CitationValueObject in project Gemma by PavlidisLab.

the class PhenotypeAssociationTest method createLiteratureEvidence.

private void createLiteratureEvidence(int geneNCBIid, String uri) {
    this.litEvidence = new LiteratureEvidenceValueObject(-1L);
    this.litEvidence.setDescription("Test Description");
    this.litEvidence.setEvidenceCode("TAS");
    this.litEvidence.setGeneNCBI(geneNCBIid);
    this.litEvidence.setClassName("LiteratureEvidenceValueObject");
    CitationValueObject citationValueObject = new CitationValueObject();
    citationValueObject.setPubmedAccession("1");
    ExternalDatabaseValueObject externalDatabaseValueObject = new ExternalDatabaseValueObject();
    externalDatabaseValueObject.setName(PhenotypeAssociationTest.TEST_EXTERNAL_DATABASE);
    EvidenceSourceValueObject evidenceSourceValueObject = new EvidenceSourceValueObject("url_link", externalDatabaseValueObject);
    SortedSet<CharacteristicValueObject> phenotypes = new TreeSet<>();
    CharacteristicValueObject characteristicValueObject = new CharacteristicValueObject(-1L, uri);
    phenotypes.add(characteristicValueObject);
    this.litEvidence.setPhenotypes(phenotypes);
    SortedSet<PhenotypeAssPubValueObject> phenotypeAssPubVO = new TreeSet<>();
    PhenotypeAssPubValueObject phenotypeAssPubValueObject = new PhenotypeAssPubValueObject();
    phenotypeAssPubValueObject.setType("Primary");
    phenotypeAssPubValueObject.setCitationValueObject(citationValueObject);
    phenotypeAssPubVO.add(phenotypeAssPubValueObject);
    this.litEvidence.setPhenotypeAssPubVO(phenotypeAssPubVO);
    this.litEvidence.setEvidenceSource(evidenceSourceValueObject);
    // those extra fields tell us where the phenotype came from if different than the one given
    this.litEvidence.setPhenotypeMapping(PhenotypeMappingType.INFERRED_CURATED.toString());
    this.litEvidence.setOriginalPhenotype("Original Value Test");
    ValidateEvidenceValueObject e = this.phenotypeAssociationManagerService.makeEvidence(this.litEvidence);
    assertNull(e);
}
Also used : ExternalDatabaseValueObject(ubic.gemma.model.common.description.ExternalDatabaseValueObject) CitationValueObject(ubic.gemma.model.common.description.CitationValueObject)

Example 3 with CitationValueObject

use of ubic.gemma.model.common.description.CitationValueObject in project Gemma by PavlidisLab.

the class BibliographicReferenceControllerImpl method showAllForExperiments.

@Override
public ModelAndView showAllForExperiments(HttpServletRequest request, HttpServletResponse response) {
    Map<ExpressionExperiment, BibliographicReference> eeToBibRefs = bibliographicReferenceService.getAllExperimentLinkedReferences();
    // map sorted in natural order of the keys
    SortedMap<CitationValueObject, Collection<ExpressionExperimentValueObject>> citationToEEs = new TreeMap<>();
    for (Entry<ExpressionExperiment, BibliographicReference> entry : eeToBibRefs.entrySet()) {
        if (entry.getValue().getTitle() == null || entry.getValue().getTitle().isEmpty() || entry.getValue().getAuthorList() == null || entry.getValue().getAuthorList().isEmpty()) {
            continue;
        }
        CitationValueObject cvo = CitationValueObject.convert2CitationValueObject(entry.getValue());
        if (!citationToEEs.containsKey(cvo)) {
            citationToEEs.put(cvo, new ArrayList<ExpressionExperimentValueObject>());
        }
        ExpressionExperiment ee = entry.getKey();
        ee.setBioAssays(null);
        ee.setAccession(null);
        ee.setExperimentalDesign(null);
        citationToEEs.get(cvo).add(new ExpressionExperimentValueObject(ee));
    }
    return new ModelAndView("bibRefAllExperiments").addObject("citationToEEs", citationToEEs);
}
Also used : ExpressionExperimentValueObject(ubic.gemma.model.expression.experiment.ExpressionExperimentValueObject) CitationValueObject(ubic.gemma.model.common.description.CitationValueObject) ModelAndView(org.springframework.web.servlet.ModelAndView) ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment) BibliographicReference(ubic.gemma.model.common.description.BibliographicReference)

Example 4 with CitationValueObject

use of ubic.gemma.model.common.description.CitationValueObject in project Gemma by PavlidisLab.

the class PhenotypeAssPubValueObject method createRelevantPublication.

public static PhenotypeAssPubValueObject createRelevantPublication(String accession) {
    CitationValueObject citationValueObject = new CitationValueObject();
    citationValueObject.setPubmedAccession(accession);
    PhenotypeAssPubValueObject phenotypeAssPubValueObject = new PhenotypeAssPubValueObject();
    phenotypeAssPubValueObject.setType(PhenotypeAssPubValueObject.RELEVANT);
    phenotypeAssPubValueObject.setCitationValueObject(citationValueObject);
    return phenotypeAssPubValueObject;
}
Also used : CitationValueObject(ubic.gemma.model.common.description.CitationValueObject)

Example 5 with CitationValueObject

use of ubic.gemma.model.common.description.CitationValueObject in project Gemma by PavlidisLab.

the class PhenotypeAssPubValueObject method createPrimaryPublication.

public static PhenotypeAssPubValueObject createPrimaryPublication(String accession) {
    CitationValueObject citationValueObject = new CitationValueObject();
    citationValueObject.setPubmedAccession(accession);
    PhenotypeAssPubValueObject phenotypeAssPubValueObject = new PhenotypeAssPubValueObject();
    phenotypeAssPubValueObject.setType(PhenotypeAssPubValueObject.PRIMARY);
    phenotypeAssPubValueObject.setCitationValueObject(citationValueObject);
    return phenotypeAssPubValueObject;
}
Also used : CitationValueObject(ubic.gemma.model.common.description.CitationValueObject)

Aggregations

CitationValueObject (ubic.gemma.model.common.description.CitationValueObject)7 ModelAndView (org.springframework.web.servlet.ModelAndView)2 ExpressionExperimentValueObject (ubic.gemma.model.expression.experiment.ExpressionExperimentValueObject)2 Calendar (java.util.Calendar)1 Collection (java.util.Collection)1 Date (java.util.Date)1 GregorianCalendar (java.util.GregorianCalendar)1 Map (java.util.Map)1 JspException (javax.servlet.jsp.JspException)1 Test (org.junit.Test)1 BibliographicReference (ubic.gemma.model.common.description.BibliographicReference)1 ExternalDatabaseValueObject (ubic.gemma.model.common.description.ExternalDatabaseValueObject)1 ExpressionExperiment (ubic.gemma.model.expression.experiment.ExpressionExperiment)1 BaseSpringWebTest (ubic.gemma.web.util.BaseSpringWebTest)1