Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add links to projects, restructure table #57

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
227 changes: 80 additions & 147 deletions components/AtlasTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,123 +25,77 @@ interface IAtlasTableProps {
filteredBiospecimens: Entity[];
}

const MinervaStoryViewerLink = (props: { url: string; count: number }) => (
<Tooltip overlay="Minerva Story">
<a
href={props.url}
target="_blank"
style={{
paddingRight: 8,
fontFamily: 'monospace',
textDecoration: 'none',
}}
>
{props.count < 100 && '\u00A0'}
{props.count < 10 && '\u00A0'}
{props.count}{' '}
<img
width={20}
src="https://user-images.githubusercontent.com/1334004/156241219-a3062991-ba9d-4201-ad87-3c9c1f0c61d8.png"
/>
</a>
const ViewerLink = (props: { url: string; tooltip: string; children: React.ReactNode }) => (
<Tooltip overlay={props.tooltip} placement="top">
<a
href={props.url}
target="_blank"
style={{
paddingRight: 8,
textDecoration: 'none',
}}
>
{props.children}
</a>
</Tooltip>
);

// Create specific ViewerLink components
const MinervaStoryViewerLink = (props: { url: string }) => (
<ViewerLink url={props.url} tooltip="Minerva Story">
<div style={{ padding: '10px' }}>
<img
width={40}
src="https://user-images.githubusercontent.com/1334004/156241219-a3062991-ba9d-4201-ad87-3c9c1f0c61d8.png"
/>
</div>
</ViewerLink>
);

const AutoMinervaViewerLink = (props: { url: string; count: number }) => (
<Tooltip overlay="Autominerva">
<a
href={props.url}
style={{
paddingRight: 8,
fontFamily: 'monospace',
textDecoration: 'none',
}}
>
{props.count < 100 && '\u00A0'}
{props.count < 10 && '\u00A0'}
{props.count}{' '}
<img
width={20}
src="https://user-images.githubusercontent.com/1334004/159789346-b647c772-48fe-4652-8d2b-3eecf6690f1f.png"
/>
</a>
</Tooltip>
const AutoMinervaViewerLink = (props: { url: string }) => (
<ViewerLink url={props.url} tooltip="Autominerva">
<img
width={40}
src="https://user-images.githubusercontent.com/1334004/159789346-b647c772-48fe-4652-8d2b-3eecf6690f1f.png"
/>
</ViewerLink>
);

const CBioPortalViewerLink = (props: { url: string; count: number }) => (
<Tooltip overlay="cBioPortal">
<a
href={props.url}
target="_blank"
style={{
paddingRight: 8,
fontFamily: 'monospace',
textDecoration: 'none',
}}
>
{props.count < 100 && '\u00A0'}
{props.count < 10 && '\u00A0'}
{props.count}{' '}
<img
width={20}
src={'https://avatars.githubusercontent.com/u/9876251?s=20&v=4'}
/>
</a>
</Tooltip>
const CBioPortalViewerLink = (props: { url: string }) => (
<ViewerLink url={props.url} tooltip="cBioPortal">
<div style={{ padding: '30px' }}>
<img
width={50}
src={'https://docs.cbioportal.org/images/cbio-logo.png'}
/>
</div>
</ViewerLink>
);

const CellxgeneViewerLink = (props: { url: string; count: number }) => (
<Tooltip overlay="cellxgene">
<a
href={props.url}
target="_blank"
style={{
paddingRight: 8,
fontFamily: 'monospace',
textDecoration: 'none',
}}
>
{props.count < 100 && '\u00A0'}
{props.count < 10 && '\u00A0'}
{props.count}{' '}
<img
width={20}
src={
'https://pbs.twimg.com/profile_images/1285714433981812736/-wuBO62N_400x400.jpg'
}
/>
</a>
</Tooltip>
const CellxgeneViewerLink = (props: { url: string }) => (
<ViewerLink url={props.url} tooltip="cellxgene">
<div style={{ padding: '30px' }}>
<img
width={40}
src={
'https://pbs.twimg.com/profile_images/1285714433981812736/-wuBO62N_400x400.jpg'
}
/>
</div>
</ViewerLink>
);

const BroadSingleCellPortalViewerLink = (props: {
url: string;
count: number;
}) => (
<Tooltip overlay="Broad Single Cell Portal">
<a
href={props.url}
target="_blank"
style={{
paddingRight: 8,
fontFamily: 'monospace',
textDecoration: 'none',
}}
>
{props.count < 100 && '\u00A0'}
{props.count < 10 && '\u00A0'}
{props.count}{' '}
<img
width={20}
src={
'https://user-images.githubusercontent.com/1334004/171445636-2458ddf6-ce48-4f1f-ab7d-d56487b34ef0.png'
}
/>
</a>
</Tooltip>
const BroadSingleCellPortalViewerLink = (props: { url: string }) => (
<ViewerLink url={props.url} tooltip="Broad Single Cell Portal">
<img
width={40}
src={
'https://user-images.githubusercontent.com/1334004/171445636-2458ddf6-ce48-4f1f-ab7d-d56487b34ef0.png'
}
/>
</ViewerLink>
);


type AtlasTableData = AtlasX & { isSelected: boolean };

@observer
Expand Down Expand Up @@ -196,46 +150,48 @@ export default class AtlasTable extends React.Component<IAtlasTableProps> {
get columns() {
return [
{
name: 'Project Title',
selector: (atlas: AtlasX) => atlas.atlas_name,
grow: 1.25,
name: 'Project',
selector: (atlas: AtlasX) => (
<a
href={`https://synapse.org/#!Synapse:${atlas.atlas_id}`}
target="_blank"
rel="noopener noreferrer"
>
{atlas.atlas_name}
</a>
),
grow: 2,
wrap: true,
sortable: true,
},
{
name: 'Project ID',
selector: (atlas: AtlasX) => atlas.atlas_id,
wrap: true,
sortable: false,
},
{
name: 'Lead Research Teams',
name: 'Investigator',
selector: (atlas: AtlasX) => atlas.team_name,
grow: 1.25,
wrap: true,
sortable: true,
},
{
name: 'Status',
name: 'Project Status',
selector: (atlas: AtlasX) => atlas.status,
grow: 1,
wrap: true,
grow: 1.5,
wrap: false,
sortable: true,
},
// We don't have multiple publications per project yet
{
name: 'Publication',
selector: 'publication',
cell: (atlas: AtlasX) => (
atlas.publication? <><a target="_blank" href={atlas.publication[0]}><FontAwesomeIcon icon={faBook} /></a></> : ''
atlas.publication? <><a target="_blank" href={atlas.publication[0]}><FontAwesomeIcon icon={faBook} size="2x"/></a></> : ''
),
grow: 0.75,
grow: 1,
wrap: true,
sortable: true,
},
// TODO include names of datasets
{
name: 'Dataset Accessions',
name: 'Data Types',
selector: '',
cell: (atlas: AtlasX) => {
return (
Expand All @@ -247,7 +203,7 @@ export default class AtlasTable extends React.Component<IAtlasTableProps> {
sortable: false,
},
{
name: 'Cases',
name: 'Patients',
grow: 0.5,
selector: 'num_cases',
cell: (atlas: AtlasX) => (
Expand All @@ -267,26 +223,7 @@ export default class AtlasTable extends React.Component<IAtlasTableProps> {
sortable: true,
},
{
name: 'Biospecimens',
selector: 'num_biospecimens',
cell: (atlas: AtlasX) => (
<span className="ml-auto">
{this.shouldShowFilteredFractions
? `${
(
this.filteredBiospecimensByAtlas[
atlas.atlas_id
] || []
).length
}/`
: ''}
{atlas.num_biospecimens}
</span>
),
sortable: true,
},
{
name: 'Viewers',
name: 'External Tools',
selector: 'atlas_id', // dummy selector - you need to put something or else nothing will render
grow: 1.5,
cell: (atlas: AtlasX) => {
Expand All @@ -297,13 +234,11 @@ export default class AtlasTable extends React.Component<IAtlasTableProps> {
url={
'https://cellxgene.cziscience.com/collections/99f1515b-46a2-4bc4-94c3-f62659dc1eb4'
}
count={1}
/>
<BroadSingleCellPortalViewerLink
url={
'https://singlecell.broadinstitute.org/single_cell/study/SCP1731/'
}
count={1}
/>
</>
);
Expand All @@ -313,7 +248,6 @@ export default class AtlasTable extends React.Component<IAtlasTableProps> {
url={
'https://triage.cbioportal.mskcc.org/study/summary?id=ovarian_drapkin_2022'
}
count={1}
/>
);
} else if (atlas.atlas_id === 'syn52047509') {
Expand All @@ -322,7 +256,6 @@ export default class AtlasTable extends React.Component<IAtlasTableProps> {
url={
'https://triage.cbioportal.mskcc.org/study/summary?id=brca_ellisen_2022'
}
count={1}
/>
);
} else {
Expand Down
8 changes: 1 addition & 7 deletions components/ExploreSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ export const ExploreSummary: React.FunctionComponent<IExploreSummaryProps> = (
props.getGroupsByPropertyFiltered[AttributeNames.AtlasName]
).length;

const organCount = _.keys(
props.getGroupsByPropertyFiltered[AttributeNames.TissueorOrganofOrigin]
).length;

const cancerTypeCount = _.keys(
props.getGroupsByPropertyFiltered[AttributeNames.PrimaryDiagnosis]
).length;
Expand All @@ -43,9 +39,7 @@ export const ExploreSummary: React.FunctionComponent<IExploreSummaryProps> = (
</div>

<div>{pluralize('Team', atlasCount, true)}</div>
<div>{pluralize('Organ', organCount, true)}</div>
<div>{pluralize('Cancer Type', cancerTypeCount, true)}</div>
<div>{pluralize('Case', props.filteredCaseCount, true)}</div>
<div>{pluralize('Patient', props.filteredCaseCount, true)}</div>
<div>
{props.filteredBiospecimenCount === 1
? 'Biospecimen'
Expand Down
11 changes: 0 additions & 11 deletions components/FileTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -389,17 +389,6 @@ export default class FileTable extends React.Component<IFileTableProps> {
wrap: true,
sortable: true,
},
{
name: 'Organ',
selector: (file: Entity) => {
return _.uniq(
file.diagnosis.map((d) => d.TissueorOrganofOrigin)
).join(', ');
},
cell: truncatedTableCell,
wrap: true,
sortable: true,
},
{
name: 'Diagnosis',
selector: (file: Entity) => {
Expand Down
4 changes: 2 additions & 2 deletions components/PortalNavbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ const PortalNavbar = () => (
<Navbar.Brand href="/">
<img
src="/gray_logo.png"
className={'htanlogo'}
alt="HTAN Data Portal"
className={'graylogo'}
alt="Gray Foundation Data Portal"
/>
</Navbar.Brand>
<Navbar.Toggle aria-controls="basic-navbar-nav" />
Expand Down
Loading