Skip to content

Commit

Permalink
Updated types of constants
Browse files Browse the repository at this point in the history
  • Loading branch information
TJMKuijpers committed May 31, 2023
1 parent e322ec6 commit e1f1d4b
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
getxScalePoint,
legendLabelsType,
drawRectInfo,
labelInfo,
getLengthLabelEntries,
createLegendLabelObjects,
formatLegendObjectsForRectangles,
Expand Down Expand Up @@ -79,21 +80,6 @@ export default class MutationalBarChart extends React.Component<
super(props);
}

/* @action formatLegendColor(data: colorMapProps[]) {
const labels = getColorsForSignatures(this.props.data);
const labelsPresent = labels.map((item: IColorLegend) => item.group);
const dataLegend = data.filter((colorMapItem: colorMapProps) => {
if (labelsPresent.includes(colorMapItem.name)) {
return colorMapItem;
}
});
return dataLegend.map((obj: colorMapProps) => ({
name: obj.category,
symbol: { fill: obj.color }
}));
}*/

@computed get xTickLabels(): string[] {
return getColorsForSignatures(this.props.data).map(item => item.label);
}
Expand Down Expand Up @@ -136,8 +122,9 @@ export default class MutationalBarChart extends React.Component<
);
const centerOfBoxes = this.formatColorBoxLegend;
const xScale = getxScalePoint(labelObjects, 60, 1040);
const legendLabelsChart = legendOjbectsToAdd.map((item, i) => {
return (
const legendLabelsChart: JSX.Element[] = [];
legendOjbectsToAdd.forEach((item, i) => {
legendLabelsChart.push(
<VictoryLabel
x={
this.props.version != 'ID'
Expand Down Expand Up @@ -178,25 +165,22 @@ export default class MutationalBarChart extends React.Component<
labels,
this.props.version
);
const legendLabelBoxes = legendInfoBoxes.map((item: drawRectInfo) => {
return (
const legendLabelBoxes: JSX.Element[] = [];
legendInfoBoxes.forEach((item: drawRectInfo) => {
legendLabelBoxes.push(
<rect
x={xScale(item.start.toString())}
x={xScale(item.start)}
y={15}
fill={item.color}
width={
xScale(item.end.toString())! -
xScale(item.start.toString())! >
0
? xScale(item.end.toString())! -
xScale(item.start.toString())!
xScale(item.end)! - xScale(item.start)! > 0
? xScale(item.end)! - xScale(item.start)!
: 6
}
height="15px"
/>
);
});

return legendLabelBoxes;
}

Expand Down Expand Up @@ -232,23 +216,22 @@ export default class MutationalBarChart extends React.Component<
uniqueSubLabels.map(item => item.subcategory!),
this.props.version
);
const legendLabelsChart = subLabelsForBoxes.map(
(item: drawRectInfo, i: number) => {
return (
<VictoryLabel
x={
centerOfBoxes[i].props.x +
0.5 * centerOfBoxes[i].props.width
}
y={35}
width={this.props.width}
text={item.category}
style={{ fontSize: '10px' }}
textAnchor={'middle'}
/>
);
}
);
const legendLabelsChart: JSX.Element[] = [];
subLabelsForBoxes.forEach((item: labelInfo, i: number) => {
legendLabelsChart.push(
<VictoryLabel
x={
centerOfBoxes[i].props.x +
0.5 * centerOfBoxes[i].props.width
}
y={35}
width={this.props.width}
text={item.category}
style={{ fontSize: '10px' }}
textAnchor={'middle'}
/>
);
});
return legendLabelsChart;
}
@action getLabelsForTooltip(data: IMutationalCounts[]): string[] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,15 @@ export interface legendLabelsType {
}
export interface drawRectInfo {
color: string;
start: number;
end: number;
start: string;
end: string;
}
export interface labelInfo {
color: string;
start: string;
end: string;
category: string;
group: string;
category?: string;
}
export interface legendEntriesType {
group: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export enum MutationalSignaturesVersion {
export enum MutationalSignatureStableIdKeyWord {
MutationalSignatureContributionKeyWord = 'contribution',
MutationalSignatureConfidenceKeyWord = 'pvalue',
MutationalSignatureCountKeyWord = 'counts',
MutationalSignatureCountKeyWord = 'matrix',
}

export const MUTATIONAL_SIGNATURES_SIGNIFICANT_PVALUE_THRESHOLD = 0.05;
Expand Down

0 comments on commit e1f1d4b

Please sign in to comment.