Skip to content

Commit

Permalink
Merge pull request cBioPortal#123 from cBioPortal/custom-na-shapes
Browse files Browse the repository at this point in the history
Allow passing in custom na shapes for rule sets
  • Loading branch information
adamabeshouse authored and onursumer committed May 27, 2022
1 parent d74cf9f commit e534fa5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/oncoprintjs/src/js/oncoprintruleset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ interface IGeneralRuleSetParams {
exclude_from_legend?: boolean;
na_z?:number; // z index of na shapes (defaults to 1)
na_legend_label?:string; // legend label associated to NA (defaults to 'No data')
na_shapes?:ShapeParams[]; // defaults to single strikethrough line
}

interface ILinearInterpRuleSetParams extends IGeneralRuleSetParams {
Expand Down Expand Up @@ -509,7 +510,7 @@ class ConditionRuleSet extends RuleSet {
return d[NA_STRING] === true;
},
{
shapes: makeNAShapes(params.na_z || 1000),
shapes: params.na_shapes || makeNAShapes(params.na_z || 1000),
legend_label: params.na_legend_label || NA_LABEL,
exclude_from_legend: false,
legend_config: {'type': 'rule', 'target': {'na': true}},
Expand Down Expand Up @@ -551,7 +552,7 @@ class CategoricalRuleSet extends LookupRuleSet {
super(params);
if (!omitNArule) {
this.addRule(NA_STRING, true, {
shapes: makeNAShapes(params.na_z || 1000),
shapes: params.na_shapes || makeNAShapes(params.na_z || 1000),
legend_label: params.na_legend_label || NA_LABEL,
exclude_from_legend: false,
legend_config: {'type': 'rule', 'target': {'na': true}},
Expand Down Expand Up @@ -996,7 +997,7 @@ class GeneticAlterationRuleSet extends LookupRuleSet {
}
})(this);
this.addRule(NA_STRING, true, {
shapes: makeNAShapes(params.na_z || 1),
shapes: params.na_shapes || makeNAShapes(params.na_z || 1),
legend_label: params.na_legend_label || NA_LABEL,
exclude_from_legend: false,
legend_config: {'type': 'rule', 'target': {'na': true}},
Expand Down

0 comments on commit e534fa5

Please sign in to comment.