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

Connects to #384. Customized file download filtering bug. #385

Merged
merged 3 commits into from
Jan 14, 2025
Merged
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
64 changes: 28 additions & 36 deletions src/BrowseDataPage/helper.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -244,59 +244,51 @@ export const transformData = (arr) => {
if (item.assay !== null && item.assay !== undefined) {
let newMetabAssayVal = item.assay;
if (
newMetabAssayVal.indexOf('Targeted') !== -1 &&
newMetabAssayVal.indexOf('Untargeted') !== -1
newMetabAssayVal.includes('Targeted')
&& newMetabAssayVal.includes('Untargeted')
) {
newMetabAssayVal = 'Merged';
item.assay = newMetabAssayVal;
}
}
if (
item.assay !== null &&
item.assay !== undefined &&
item.omics === 'Metabolomics Targeted'
item.assay !== null
&& item.assay !== undefined
&& item.omics === 'Metabolomics Targeted'
) {
let newMetabAssayVal = item.assay;
if (
newMetabAssayVal.indexOf('Acylcarnitines') !== -1 &&
newMetabAssayVal.indexOf('Oxylipins') !== -1
newMetabAssayVal.includes('Acylcarnitines')
&& newMetabAssayVal.includes('Oxylipins')
) {
newMetabAssayVal = 'Merged';
item.assay = newMetabAssayVal;
}
}
if (item.tissue_name !== null && item.tissue_name !== undefined) {
let newTissueVal = item.tissue_name;
const tissueMappings = {
'Human PBMC': 'Blood',
'Human EDTA Packed Cells': 'Blood',
'Human PAXgene RNA': 'Blood',
'Human Adipose': 'Adipose',
'Human Adipose Powder': 'Adipose',
'Humnan Adipose Powder': 'Adipose',
jimmyzhen marked this conversation as resolved.
Show resolved Hide resolved
'Human Muscle': 'Muscle',
'Human Muscle Powder': 'Muscle',
'Human EDTA Plasma': 'Plasma',
};

Object.keys(tissueMappings).forEach((key) => {
if (newTissueVal.indexOf(key) !== -1) {
newTissueVal = tissueMappings[key];
item.tissue_name = newTissueVal;
}
});
if (
newTissueVal.indexOf('Human PBMC') !== -1 ||
newTissueVal.indexOf('Human EDTA Packed Cells') !== -1 ||
newTissueVal.indexOf('Human PAXgene RNA') !== -1
) {
newTissueVal = 'Blood';
item.tissue_name = newTissueVal;
}
if (
newTissueVal.indexOf('Human Adipose') !== -1 ||
newTissueVal.indexOf('Human Adipose Powder') !== -1
) {
newTissueVal = 'Adipose';
item.tissue_name = newTissueVal;
}
if (
newTissueVal.indexOf('Human Muscle') !== -1 ||
newTissueVal.indexOf('Human Muscle Powder') !== -1
) {
newTissueVal = 'Muscle';
item.tissue_name = newTissueVal;
}
if (newTissueVal.indexOf('Human EDTA Plasma') !== -1) {
newTissueVal = 'Plasma';
item.tissue_name = newTissueVal;
}
if (
newTissueVal.indexOf('EDTA Plasma') !== -1 &&
item.omics.indexOf('Metabolomics') !== -1 &&
item.study.indexOf('Acute Exercise') !== -1
newTissueVal.includes('EDTA Plasma')
&& item.omics.includes('Metabolomics')
&& item.study.includes('Acute Exercise')
) {
newTissueVal = 'Plasma';
item.tissue_name = newTissueVal;
Expand Down
50 changes: 48 additions & 2 deletions src/DataStatusPage/dataStatusPage.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React from 'react';
import React, { useState } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { Redirect } from 'react-router-dom';
import { Helmet } from 'react-helmet';
import { Tooltip } from 'react-tooltip';
import StatusReportGetData from './statusReportGetData';
import StatusReportImmunoAssay from './statusReportImmunoAssay';
import QcReportByPhase from './qcReportByPhase.jsx';
Expand All @@ -29,6 +30,8 @@ export function DataStatusPage({
qcReportViewChange,
profile,
}) {
const [isOpen, setIsOpen] = useState(true);

// Send users to default page if they are not consortium members
const userType = profile.user_metadata && profile.user_metadata.userType;
if (userType === 'external') {
Expand Down Expand Up @@ -130,15 +133,58 @@ export function DataStatusPage({
}
}

// Render data transfer guidelines link
function renderDataTransferGuidelinesLink() {
let link = '';

switch (qcReportView) {
case 'metabolomics':
link = 'https://docs.google.com/document/d/13i-EQcZ0LYylhoyaTdI4vf-BgZYAbzcGU4m9GKSJCnA/edit?usp=sharing';
break;
case 'proteomics':
link = 'https://docs.google.com/document/d/1U60mx7Wl0sNKsy_S72lJsRdEdB3HbuXQ86Hw7lLWV-w/edit?usp=sharing';
break;
default:
link = 'https://docs.google.com/document/d/1W1b5PVp2yjam4FU2IidGagqdA7lYpkTaD_LMeaN_n_k/edit?usp=sharing';
}
return link;
}

return (
<div className="dataStatusPage px-3 px-md-4 mb-3 w-100">
<Helmet>
<html lang="en" />
<title>QC Data Monitor - MoTrPAC Data Hub</title>
</Helmet>
<div className="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center mb-4 page-header">
<div className="page-title">
<div className="page-title d-flex align-items-end">
<h1 className="mb-0">QC Data Monitor</h1>
{qcReportView.match(/metabolomics|proteomics|rnaseq|rrbs|methylcapseq|atacseq|immunoassay/) && (
<>
<a
href={renderDataTransferGuidelinesLink()}
target="_blank"
rel="noopener noreferrer"
className="data-transfer-guidelines-link mb-0 ml-2 text-info"
data-tooltip-id="data-transfer-guidelines-link-tooltip"
data-tooltip-content="Data Transfer Guidelines"
data-tooltip-place="right"
onMouseEnter={() => setIsOpen(true)}
onClick={() => setIsOpen(false)}
>
<span className="material-icons">
description
</span>
</a>
<Tooltip
id="data-transfer-guidelines-link-tooltip"
defaultIsOpen={isOpen}
globalCloseEvents={{ clickOutsideAnchor: true }}
>
Data Transfer Guidelines
</Tooltip>
</>
)}
</div>
{renderButtonGroup()}
</div>
Expand Down
8 changes: 8 additions & 0 deletions src/sass/dataStatus/_dataStatusTable.scss
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@
}
}
}

.page-title {
.data-transfer-guidelines-link {
span {
font-size: 1.85rem;
}
}
}
}

.data-qc-status-panel {
Expand Down
Loading