eweitz / ideogram

Chromosome visualization for the web
https://eweitz.github.io/ideogram
Other
294 stars 71 forks source link

Simplify reuse and add automated tests for "Related genes" feature #209

Closed eweitz closed 4 years ago

eweitz commented 4 years ago

This encapsulates code for the "Related genes" example by moving code for that feature into a "kit" in the Ideogram library.

Kits are a new concept in Ideogram. They are tailored modules that reduce how much code developers need to maintain to recreate specific Ideogram examples. So while kits are part of the library, they are not in the core and will not be reused elsewhere in Ideogram. Kits also make it easier to verify complex use cases with automated tests.

The related genes kit is exposed through the new initRelatedGenes method. Example:

config = {
  organism: 'human',
  chrWidth: 8,
  chrHeight: 90,
  chrLabelSize: 10,
  annotationHeight: 5
}

let ideogram = Ideogram.initRelatedGenes(config);

That's 9 lines to recreate a minimal "Related genes" example -- about 350 lines less than before.

coveralls commented 4 years ago

Coverage Status

Coverage decreased (-14.9%) to 75.499% when pulling 8d73110f8d0dff8d38ac789caf90d46d699d2eb2 on abstract-related-genes into 33dfdadf781f4629c4cb5a36adff6966d278d6e9 on master.