Skip to content

Commit

Permalink
Add support for more params to be used for linking out to data-viz po…
Browse files Browse the repository at this point in the history
…rtal
  • Loading branch information
jimmyzhen committed May 2, 2024
1 parent 6e1f9c0 commit 78bf2f3
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions src/AnalysisPage/GraphicalClustering/components/dataVizLink.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
import React from 'react';
import PropTypes from 'prop-types';

function DataVizLink({ title, tissue, plotType }) {
const url = `https://data-viz.motrpac-data.org/?tissues[${tissue}]=1&plot_type=${plotType}&topk=10`;
function DataVizLink({ title, tissue, plotType, minClusterSize }) {
let topkStr = '';
let minClusterSizeStr = '';

// include 'topk' param for non-trajectory plots
if (plotType !== 'Trajectories') {
topkStr = '&topk=10';
}

// include 'min_cluster_size' param if minClusterSize is provided
if (minClusterSize && typeof (minClusterSize) === 'number') {
minClusterSizeStr = `&min_cluster_size=${minClusterSize}`;
}

const url = `https://data-viz.motrpac-data.org/?tissues[${tissue}]=1&plot_type=${plotType}${topkStr}${minClusterSizeStr}`;

return (
<p className="data-visualization-link-container text-center">
Expand All @@ -23,6 +36,11 @@ DataVizLink.propTypes = {
title: PropTypes.string.isRequired,
tissue: PropTypes.string.isRequired,
plotType: PropTypes.string.isRequired,
minClusterSize: PropTypes.number,
};

DataVizLink.defaultProps = {
minClusterSize: null,
};

export default DataVizLink;

0 comments on commit 78bf2f3

Please sign in to comment.