Skip to content

Commit

Permalink
[Platform]: PPP Sections widgets default size query parameter (#287)
Browse files Browse the repository at this point in the history
  • Loading branch information
carcruz committed Nov 14, 2023
1 parent 67ae7bb commit 6226972
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 118 deletions.
65 changes: 27 additions & 38 deletions packages/sections/src/evidence/OTCRISPR/Body.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import { SectionItem, Link, Tooltip, DataTable, TooltipStyledLabel } from "ui";
import { definition } from ".";
import Description from "./Description";
import { dataTypesMap } from "../../dataTypes";
import { defaultRowsPerPageOptions } from "../../constants";
import { defaultRowsPerPageOptions, sectionsBaseSizeQuery } from "../../constants";

import CRISPR_QUERY from "./OTCrisprQuery.gql";

const useStyles = makeStyles((theme) => ({
const useStyles = makeStyles(theme => ({
significanceIcon: {
color: theme.palette.primary.main,
},
Expand All @@ -19,15 +19,13 @@ const getColumns = () => [
{
id: "disease",
label: "Reported disease",
renderCell: (row) => (
<Link to={`/disease/${row.disease.id}`}>{row.disease.name}</Link>
),
filterValue: (row) => `${row.disease.name}, ${row.disease.id}`,
renderCell: row => <Link to={`/disease/${row.disease.id}`}>{row.disease.name}</Link>,
filterValue: row => `${row.disease.name}, ${row.disease.id}`,
},
{
id: "projectId",
label: "OTAR project code",
renderCell: (row) => (
renderCell: row => (
<Link external to={`http://home.opentargets.org/${row.projectId}`}>
{row.projectId}
</Link>
Expand All @@ -36,17 +34,12 @@ const getColumns = () => [
{
id: "contrast",
label: "Contrast / Study overview",
renderCell: (row) => {
renderCell: row => {
if (row.contrast && row.studyOverview) {
return (
<Tooltip
showHelpIcon
title={
<TooltipStyledLabel
label="Study overview"
description={row.studyOverview}
/>
}
title={<TooltipStyledLabel label="Study overview" description={row.studyOverview} />}
>
<span>{row.contrast}</span>
</Tooltip>
Expand All @@ -61,41 +54,36 @@ const getColumns = () => [
return null;
},
width: "25%",
filterValue: (row) => `${row.contrast}; ${row.studyOverview}`,
filterValue: row => `${row.contrast}; ${row.studyOverview}`,
},
{
id: "cellType",
label: "Cell type",
renderCell: (row) =>
renderCell: row =>
row.cellLineBackground ? (
<Tooltip
showHelpIcon
title={
<TooltipStyledLabel
label="Cell line background"
description={row.cellLineBackground}
/>
<TooltipStyledLabel label="Cell line background" description={row.cellLineBackground} />
}
>
<span>{row.cellType}</span>
</Tooltip>
) : (
row.cellType
),
filterValue: (row) => `${row.cellType}; ${row.cellLineBackground}`,
filterValue: row => `${row.cellType}; ${row.cellLineBackground}`,
},
{
id: "log2FoldChangeValue",
label: "log2 fold change",
renderCell: (row) =>
row.log2FoldChangeValue ? row.log2FoldChangeValue : "N/A",
renderCell: row => (row.log2FoldChangeValue ? row.log2FoldChangeValue : "N/A"),
},
{
id: "resourceScore",
label: "Significance",
filterValue: (row) => `${row.resourceScore}; ${row.statisticalTestTail}`,
renderCell: (row) =>
row.resourceScore ? parseFloat(row.resourceScore.toFixed(6)) : "N/A",
filterValue: row => `${row.resourceScore}; ${row.statisticalTestTail}`,
renderCell: row => (row.resourceScore ? parseFloat(row.resourceScore.toFixed(6)) : "N/A"),
},
{
id: "releaseVersion",
Expand All @@ -106,43 +94,43 @@ const getColumns = () => [
const exportColumns = [
{
label: "disease",
exportValue: (row) => row.disease.name,
exportValue: row => row.disease.name,
},
{
label: "disease id",
exportValue: (row) => row.disease.id,
exportValue: row => row.disease.id,
},
{
label: "OTAR project code",
exportValue: (row) => row.projectId,
exportValue: row => row.projectId,
},
{
label: "contrast",
exportValue: (row) => row.contrast,
exportValue: row => row.contrast,
},
{
label: "study overview",
exportValue: (row) => row.studyOverview,
exportValue: row => row.studyOverview,
},
{
label: "cell type",
exportValue: (row) => row.cellType,
exportValue: row => row.cellType,
},
{
label: "cell line background",
exportValue: (row) => row.cellLineBackground,
exportValue: row => row.cellLineBackground,
},
{
label: "CRISPR screen library",
exportValue: (row) => row.crisprScreenLibrary,
exportValue: row => row.crisprScreenLibrary,
},
{
label: "resource score",
exportValue: (row) => row.resourceScore,
exportValue: row => row.resourceScore,
},
{
label: "statistical test tail",
exportValue: (row) => row.statisticalTestTail,
exportValue: row => row.statisticalTestTail,
},
];

Expand All @@ -152,6 +140,7 @@ function Body({ id, label, entity }) {
variables: {
ensemblId: ensgId,
efoId,
size: sectionsBaseSizeQuery,
},
});
const classes = useStyles();
Expand All @@ -162,8 +151,8 @@ function Body({ id, label, entity }) {
chipText={dataTypesMap.ot_partner}
request={request}
entity={entity}
renderDescription={(data) => (
<Description symbol={label.symbol} name={label.name} data={data}/>
renderDescription={data => (
<Description symbol={label.symbol} name={label.name} data={data} />
)}
renderBody={({ disease }) => {
const { rows } = disease.OtCrisprSummary;
Expand Down
3 changes: 2 additions & 1 deletion packages/sections/src/evidence/OTCRISPR/OTCrisprQuery.gql
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
query CrisprQuery($ensemblId: String!, $efoId: String!) {
query CrisprQuery($ensemblId: String!, $efoId: String!, $size: Int!) {
disease(efoId: $efoId) {
id
OtCrisprSummary: evidences(
ensemblIds: [$ensemblId]
enableIndirect: true
datasourceIds: ["ot_crispr"]
size: $size
) {
count
rows {
Expand Down
Loading

0 comments on commit 6226972

Please sign in to comment.