diff --git a/client/src/components/GeneFrequencyTable.tsx b/client/src/components/GeneFrequencyTable.tsx index 10377e0..d366116 100644 --- a/client/src/components/GeneFrequencyTable.tsx +++ b/client/src/components/GeneFrequencyTable.tsx @@ -12,6 +12,7 @@ import {renderPercentage} from "./ColumnRenderHelper"; import Gene from "./Gene"; import GeneFrequencyTableComponent from "./GeneFrequencyTableComponent"; import GeneTumorTypeFrequencyDecomposition from "./GeneTumorTypeFrequencyDecomposition"; +import { comparePenetrance } from './Penetrance'; import PenetranceList from "./PenetranceList"; import "react-table/react-table.css"; @@ -40,6 +41,19 @@ function renderPenetrance(cellProps: any) ); } +function sortPenetrance(a: string[], b: string[]) +{ + const aSorted = a.sort(comparePenetrance); + const bSorted = b.sort(comparePenetrance); + for (let i = 0; i < Math.min(aSorted.length, bSorted.length); i++) { + const comparison = -comparePenetrance(aSorted[i], bSorted[i]) + if (comparison !== 0) { + return comparison; + } + } + return Math.sign(a.length - b.length); +} + function renderSubComponent(row: any) { return (