Skip to content

Commit

Permalink
Allow genotype colourings for datasets without gene annotations
Browse files Browse the repository at this point in the history
If no annotations are provided, the default geneLength object is `{}` which shouldn't be validated against. This commit changes decodeColorByGenotype to only validates against objects with keys.
  • Loading branch information
jameshadfield committed Feb 27, 2019
1 parent f298337 commit c2bfcb9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/util/getGenotype.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const encodeColorByGenotype = ({ gene, positions }) => {
export const decodeColorByGenotype = (colorBy, geneLengths) => {
// If we're passed a map of gene name → length, then validate the decoded
// gene name and positions. Otherwise, just decode without validation.
const validate = geneLengths != null;
const validate = typeof geneLengths === "object" && Object.keys(geneLengths).length;

// Split the encoded string into tokens of gene and positions.
const match = colorBy.match(/^gt-(.+)_([0-9,]+)$/);
Expand Down

0 comments on commit c2bfcb9

Please sign in to comment.