Skip to content

Commit

Permalink
Update types and change gap language
Browse files Browse the repository at this point in the history
  • Loading branch information
alisman committed Sep 19, 2024
1 parent d6e2419 commit 825f7ee
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/oncoprintjs/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ export {
} from './js/oncoprint';

export * from './js/oncoprintruleset';
export { default as OncoprintModel } from './js/oncoprintmodel';
export { default as OncoprintModel, GAP_MODE_ENUM } from './js/oncoprintmodel';
export * from './js/oncoprintmodel';
export { default as shapeToSvg } from './js/oncoprintshapetosvg';
13 changes: 9 additions & 4 deletions packages/oncoprintjs/src/js/oncoprinttrackoptionsview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -455,9 +455,12 @@ export default class OncoprintTrackOptionsView {
const $show_gaps_percent_opt = OncoprintTrackOptionsView.$makeDropdownOption(
model.getTrackShowGaps(track_id) ===
GAP_MODE_ENUM.SHOW_GAPS_PERCENT
? 'Hide gaps (%)'
: 'Show Gaps (%)',
model.getTrackShowGaps(track_id) ? 'bold' : 'normal',
? 'Hide gaps (w/%)'
: 'Show Gaps (w/%)',
model.getTrackShowGaps(track_id) ===
GAP_MODE_ENUM.SHOW_GAPS_PERCENT
? 'bold'
: 'normal',
false,
function(evt) {
evt.stopPropagation();
Expand All @@ -475,7 +478,9 @@ export default class OncoprintTrackOptionsView {
model.getTrackShowGaps(track_id) === GAP_MODE_ENUM.SHOW_GAPS
? 'Hide gaps'
: 'Show Gaps',
model.getTrackShowGaps(track_id) ? 'bold' : 'normal',
model.getTrackShowGaps(track_id) === GAP_MODE_ENUM.SHOW_GAPS
? 'bold'
: 'normal',
false,
function(evt) {
evt.stopPropagation();
Expand Down
5 changes: 3 additions & 2 deletions src/shared/components/oncoprint/Oncoprint.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
} from 'shared/model/AnnotatedMutation';
import { CustomDriverNumericGeneMolecularData } from 'shared/model/CustomDriverNumericGeneMolecularData';
import { ExtendedAlteration } from 'shared/model/ExtendedAlteration';
import { GAP_MODE_ENUM } from 'oncoprintjs';

export type CategoricalTrackDatum = {
entity: string;
Expand Down Expand Up @@ -90,7 +91,7 @@ export class ClinicalTrackConfig {
export type ClinicalTrackConfigChange = {
stableId?: string;
sortOrder?: string;
gapOn?: boolean;
gapMode?: GAP_MODE_ENUM;
};

export type ClinicalTrackConfigMap = {
Expand Down Expand Up @@ -313,7 +314,7 @@ export interface IOncoprintProps {
onDeleteClinicalTrack?: (key: string) => void;
onDeleteGeneticTrack?: (key: string, sublabel: string) => void;
onTrackSortDirectionChange?: (trackId: TrackId, dir: number) => void;
onTrackGapChange?: (trackId: TrackId, gap: boolean) => void;
onTrackGapChange?: (trackId: TrackId, gap: GAP_MODE_ENUM) => void;

trackKeySelectedForEdit?: string | null;
setTrackKeySelectedForEdit?: (key: string | null) => void;
Expand Down
6 changes: 3 additions & 3 deletions src/shared/components/oncoprint/ResultsViewOncoprint.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ import classnames from 'classnames';
import { OncoprintColorModal } from './OncoprintColorModal';
import JupyterNoteBookModal from 'pages/staticPages/tools/oncoprinter/JupyterNotebookModal';
import { convertToCSV } from 'shared/lib/calculation/JSONtoCSV';
import { GAP_MODE_ENUM } from 'oncoprintjs';

interface IResultsViewOncoprintProps {
divId: string;
Expand Down Expand Up @@ -1671,9 +1672,8 @@ export default class ResultsViewOncoprint extends React.Component<
* Called when a track gap is added from within oncoprintjs UI
*/
@action.bound
@action.bound
private onTrackGapChange(trackId: TrackId, gapOn: boolean) {
this.handleClinicalTrackChange(trackId, { gapOn });
private onTrackGapChange(trackId: TrackId, mode: GAP_MODE_ENUM) {
this.handleClinicalTrackChange(trackId, { gapMode: mode });
}

private handleClinicalTrackChange(
Expand Down

0 comments on commit 825f7ee

Please sign in to comment.