Skip to content

Commit

Permalink
Merge pull request #691 from mpi2/idg-page-publications
Browse files Browse the repository at this point in the history
IDG page publications
  • Loading branch information
ficolo authored Jan 13, 2022
2 parents 35e9876 + 56e40cd commit d8ed4c2
Show file tree
Hide file tree
Showing 6 changed files with 130 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ public class Constants {
// PDF thumbnail icon (so PDFs show a PDF icon.
public static final String PDF_THUMBNAIL_RELATIVE_URL = "img/filetype_pdf.png";

public static final List<String> IDG_PUBLICATION_LIST= Arrays.asList("23504326", "23929668", "23934124", "24244016", "24284070", "25242043", "25298527", "25320282", "26197390", "27313209", "27445138", "27677211", "27693579", "27759003", "27866947", "28051178", "28461138", "28702328", "28719620", "28817564", "28894906", "29034508", "29056298", "29098359", "29282304", "29290552", "29386186", "29391390", "29481883", "29625592", "29899413", "30157172", "30291131", "30532139", "30651631", "31050055", "31135881", "31285284", "31480808", "31495563", "31509750", "31621579", "31628323", "31730008", "31941358", "31943058", "32163033", "32242025", "32381600", "32439758", "32576659", "32751134", "32758357", "32868297", "33382037", "33623007", "33753942", "33806166", "34001891", "34026458", "34273979", "34544832", "34615877");



}
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,19 @@
import org.springframework.web.bind.annotation.RequestMethod;
import uk.ac.ebi.phenotype.chart.PieChartCreator;
import uk.ac.ebi.phenotype.chart.UnidimensionalChartAndTableProvider;
import uk.ac.ebi.phenotype.util.PublicationFetcher;
import uk.ac.ebi.phenotype.web.dao.ReferenceService;
import uk.ac.ebi.phenotype.web.dto.AlleleRef;
import uk.ac.ebi.phenotype.web.dto.Publication;

import javax.servlet.http.HttpServletRequest;
import javax.validation.constraints.NotNull;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;

import static org.mousephenotype.cda.common.Constants.IDG_PUBLICATION_LIST;

@Controller
public class SecondaryProjectController {

Expand All @@ -45,13 +51,15 @@ public class SecondaryProjectController {
private GeneService geneService;
private UnidimensionalChartAndTableProvider chartProvider;
private GenesSecondaryProjectServiceIdg idg;
private ReferenceService referenceService;

public SecondaryProjectController(
@NotNull GeneService geneService,
//@NotNull EssentialGeneService essentialGeneService,
@NotNull ReferenceService referenceService,
@NotNull UnidimensionalChartAndTableProvider chartProvider,
@NotNull GenesSecondaryProjectServiceIdg idg) {
this.geneService = geneService;
this.referenceService = referenceService;
this.chartProvider = chartProvider;
this.idg = idg;
}
Expand All @@ -68,6 +76,13 @@ public String idgProjectPage(HttpServletRequest request,
.stream()
.map(GenesSecondaryProject::getMgiGeneAccessionId)
.collect(Collectors.toSet());
List<GeneDTO> geneDTOList = geneService.getGenesByMgiIds(new ArrayList<>(accessions));
Set<String> alleleSymbols = new HashSet<>();
geneDTOList.stream().filter(g -> g.getAlleleName() != null).forEach(g -> g.getAlleleName().forEach(aName -> alleleSymbols.add(g.getMarkerSymbol() + "<" + aName + ">")));
Set<String> symbols = geneDTOList
.stream()
.map(GeneDTO::getMarkerSymbol)
.collect(Collectors.toSet());

Map<String, Long> geneStatus = geneService.getStatusCount(accessions, GeneDTO.ES_CELL_PRODUCTION_STATUS);
Map<String, Long> mouseStatus = geneService.getStatusCount(accessions, GeneDTO.MOUSE_PRODUCTION_STATUS);
Expand Down Expand Up @@ -136,6 +151,14 @@ public String idgProjectPage(HttpServletRequest request,
model.addAttribute("gpcrMiceProduced", gpcrRows.stream().filter(x -> x.getMiceProduced().contains("Mice")).count());
model.addAttribute("gpcrPhenotypesProduced", gpcrRows.stream().filter(x -> x.getMiceProduced().contains("Phenotype data")).count());

/*
PUBLICATIONS
*/

// Filter out publications not directly related to this gene
final List<Publication> publications = referenceService.getReviewedByPmidList(new ArrayList<>(IDG_PUBLICATION_LIST));
model.addAttribute("publications", publications);

return "idg";


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@
import org.springframework.stereotype.Repository;
import uk.ac.ebi.phenotype.web.dto.Publication;

import java.util.List;


@Repository
public interface ReferenceRepository extends MongoRepository<Publication, ObjectId>, ReferenceRepositoryCustom {

Page<Publication> findAllByStatusIs(Pageable pageable, String status);

List<Publication> findPublicationsByPmidIsInOrderByFirstPublicationDate(List<String> pmids);

int countAllByStatusIs(String status);

final String reviewedContainsQuery =
Expand All @@ -32,9 +36,26 @@ public interface ReferenceRepository extends MongoRepository<Publication, Object
+ "{status: 'reviewed'}"
+ "]"
+ " }";

final String reviewedContainsGeneQuery =
" {$and: "
+ "["
+ "{$or: "
+ "["
+ "{'alleles.alleleSymbol': {$regex : ?0, '$options' : 'i' }},"
+ "{'alleles.geneSymbol': {$regex : ?0, '$options' : 'i' }}"
+ "]"
+ "},"
+ "{status: 'reviewed'}"
+ "]"
+ " }";

@Query(reviewedContainsQuery)
Page<Publication> findReviewedContains(String filter, Pageable pageable);

@Query(reviewedContainsGeneQuery)
Page<Publication> findReviewedContainsGene(String genes, Pageable pageable);

@CountQuery(reviewedContainsQuery)
int countReviewedContains(String filter);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
public interface ReferenceService {

List<Publication> getAllReviewed(String filter, int start, int length, String orderBy, String sortOrder);
List<Publication> getReviewedByPmidList(List<String> pmidList);
int countReviewed();
int countFiltered(String filter);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
import uk.ac.ebi.phenotype.web.dto.Publication;
Expand All @@ -10,6 +11,8 @@
import java.util.List;
import java.util.TreeMap;

import static org.mousephenotype.cda.common.Constants.IDG_PUBLICATION_LIST;

@Service
public class ReferenceServiceImpl implements ReferenceService {

Expand All @@ -36,6 +39,16 @@ public List<Publication> getAllReviewed(String filter, int start, int length, St
}
}

@Override
public List<Publication> getReviewedByPmidList(List<String> pmidList) {

if(pmidList == null || pmidList.isEmpty()) {
return referenceRepository.findAllByStatusIs(Pageable.unpaged(), "reviewed").getContent();
} else {
return referenceRepository.findPublicationsByPmidIsInOrderByFirstPublicationDate(IDG_PUBLICATION_LIST);
}
}

@Override
public int countReviewed() {
return referenceRepository.countAllByStatusIs("reviewed");
Expand Down
69 changes: 69 additions & 0 deletions web/src/main/webapp/WEB-INF/views/idg.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="t" tagdir="/WEB-INF/tags" %>
<%@ taglib prefix='fn' uri='http://java.sun.com/jsp/jstl/functions' %>
<%@taglib prefix = "fmt" uri = "http://java.sun.com/jsp/jstl/fmt" %>

<t:genericpage-landing>

Expand Down Expand Up @@ -43,6 +44,7 @@
//$( '#spinner'+ id ).html('');
});
$('#publications_table').bootstrapTable({ classes: 'table'});
</script>

</jsp:attribute>
Expand Down Expand Up @@ -264,6 +266,73 @@
</div>
</div>

<%-- PUBLICATIONS SECTION --%>
<div class="container white-bg-small" id="publications-section">
<div class="row pb-5">
<div class="col-12 col-md-12">
<div class="pre-content clear-bg">
<div class="page-content p-5">
<div class="mb-5">
<h2>
IMPC related publications
<a href="${cmsBaseUrl}/help/data-visualization/gene-pages/publications/" title="Go to publication help">
<i class="fal fa-question-circle fa-xs text-muted align-middle" style="font-size: 20px;"></i>
</a>
</h2>
<p>
The table below lists publications which used either products generated by the IMPC or data produced by the phenotyping efforts of the IMPC. These publications have also been associated to genes listed on the IDG project.
</p>
</div>
<div>
<div class="row">
<div class="col-12">
<c:choose>
<c:when test="${fn:length(publications) != 0}">
<p class="alert alert-info">There are <b>${fn:length(publications)} publication<c:if test="${fn:length(publications)!=1}">s</c:if> which use IMPC produced mice or data.</b></p>
<table id="publications_table"
data-pagination="true"
data-mobile-responsive="true"
data-sortable="true">
<thead>
<tr>
<th data-width="300">Title</th>
<th>Journal</th>
<th>IMPC Allele</th>
<th data-width="160" data-halign="center" data-align="center">PubMed&nbsp;ID</th>
</tr>
</thead>
<tbody>
<c:forEach items="${publications}" var="publication" varStatus="loop">
<tr id="publicationRow${loop.index}" data-link="publication" data-shown="false">
<td><a href="https://www.doi.org/${publication.doi}">${publication.title}</a></td>
<td>${publication.journalInfo.journal.title} (<fmt:formatDate value="${publication.firstPublicationDate}" pattern="MMMM yyyy" />)</td>
<td><c:forEach items="${publication.alleles}" var="allele" varStatus="allele_loop">
<t:formatAllele>${allele.alleleSymbol}</t:formatAllele>
</c:forEach>
</td>
<td><c:choose>
<c:when test="${fn:length(publication.pmcid) > 0}"><a href="https://www.ncbi.nlm.nih.gov/pmc/articles/${publication.pmcid}">${publication.pmcid}</a></c:when>
<c:when test="${fn:length(publication.pmid) > 0}"><a href="https://pubmed.ncbi.nlm.nih.gov/${publication.pmid}/">${publication.pmid}</a></c:when>
</c:choose>
</td>
</tr>
</c:forEach>
</tbody>
</table>
</c:when>
<c:when test="${fn:length(publications) == 0}">No publications found that use IMPC mice or data for ${gene.markerSymbol}.</c:when>
</c:choose>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>



</jsp:body>


Expand Down

0 comments on commit d8ed4c2

Please sign in to comment.