Skip to content

Commit

Permalink
Merge pull request #385 from MoTrPAC/384_JZ_File_Download_Filter_Bug
Browse files Browse the repository at this point in the history
Connects to #384. Customized file download filtering bug.
  • Loading branch information
jimmyzhen authored Jan 14, 2025
2 parents 28440e7 + a7faeee commit f78ca55
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 38 deletions.
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',
'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

0 comments on commit f78ca55

Please sign in to comment.