Skip to content

Support user-supplied mods and colours for multiple DNA/RNA #2069

Description

@sathish-t

Dear IGV team,

Thanks for this nice repo. I am exploring ways of showing two types of DNA modifications on the view. My understanding (after exploring with Claude code) is that a mod that is not hard coded in the code is shown as a teal colour, and multiple mods are all given the same teal colour. I want to allow the user to set their own colours. I am preparing a pull request with Claude code but wanted your opinion first on this change as stated in CONTRIBUTING.md.

Here's how a user would configure it:

igv.createBrowser(div, {
  tracks: [{
    type: "alignment",
    url: "my.bam",
    colorBy: "basemod",          // or "basemod2"
    modificationColors: {
      "m": "rgb(255, 128, 0)",   // override 5mC (normally red)
      "h": "rgb(0, 200, 100)",   // override 5hmC (normally magenta)
      "27552": "rgb(1, 1, 1)"    // set color for a modification by ChEBI id
    }
  }]
})

A few notes:

  • You only need to specify the modifications you want to override — anything not in the map falls through to the built-in colors
  • Known modifications like m and h can be overridden, not just unknown ones

What do you think? The PR suggested by Claude is fairly short but I haven't tested if it works. I am attaching the diff file here. Thanks!

igv_PR_diff.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions