gosling.js icon indicating copy to clipboard operation
gosling.js copied to clipboard

Chromosome position label is sometimes unnecessary "long"

Open flekschas opened this issue 3 years ago • 1 comments

I noticed, sometimes the chromosome position label is getting long. For instance, in the screenshot below the unit is million. Since the view starts at pos 0 or 1 this leads to a long but not so meaningful float value labels:

Screen Shot 2021-04-07 at 6 06 10 PM

This can be an issue when the layout is smaller as it leads to over-plotting:

Screen Shot 2021-04-07 at 5 54 39 PM

flekschas avatar Apr 08 '21 14:04 flekschas

Reproducible using the following spec:

{
  "arrangement": "vertical",
  "views": [
    {
      "static": true,
      "layout": "circular",
      "alignment": "stack",
      // "xDomain": { "chromosome": "5" },
      "tracks": [
        {
          "alignment": "overlay",
          "data": {
            "url": "https://server.gosling-lang.org/api/v1/tileset_info/?d=cistrome-multivec",
            "type": "multivec",
            "row": "sample",
            "column": "position",
            "value": "peak",
            "categories": ["sample 1", "sample 2", "sample 3", "sample 4"],
            "binSize": 4
          },
          "x": {"field": "start", "type": "genomic"},
          "xe": {"field": "end", "type": "genomic"},
          "y": {"field": "peak", "type": "quantitative"},
          "row": {"field": "sample", "type": "nominal"},
          "color": {"field": "sample", "type": "nominal"},
          "stroke": {"value": "black"},
          "strokeWidth": {"value": 0.3},
          "tracks": [
            {"mark": "bar"},
            {
              "mark": "brush",
              "x": {"linkingId": "detail-1"},
              "color": {"value": "blue"}
            },
            {
              "mark": "brush",
              "x": {"linkingId": "detail-2"},
              "color": {"value": "red"}
            }
          ],
          "style": {"outlineWidth": 0},
          "width": 500,
          "height": 100
        },
        {
          "data": {
            "type": "csv",
            "url": "https://raw.githubusercontent.com/sehilyi/gemini-datasets/master/data/rearrangements.bulk.1639.simple.filtered.pub",
            "headerNames": [
              "chr1",
              "p1s",
              "p1e",
              "chr2",
              "p2s",
              "p2e",
              "type",
              "id",
              "f1",
              "f2",
              "f3",
              "f4",
              "f5",
              "f6"
            ],
            "separator": "\t",
            "genomicFieldsToConvert": [
              {"chromosomeField": "chr1", "genomicFields": ["p1s", "p1e"]},
              {"chromosomeField": "chr2", "genomicFields": ["p2s", "p2e"]}
            ]
          },
          "dataTransform": [
            {
              "type": "filter",
              "field": "chr1",
              "oneOf": ["1", "16", "14", "9", "6", "5", "3"]
            },
            {
              "type": "filter",
              "field": "chr2",
              "oneOf": ["1", "16", "14", "9", "6", "5", "3"]
            }
          ],
          "mark": "link",
          "x": {"field": "p1s", "type": "genomic"},
          "xe": {"field": "p1e", "type": "genomic"},
          "x1": {"field": "p2s", "type": "genomic"},
          "x1e": {"field": "p2e", "type": "genomic"},
          "stroke": {
            "field": "type",
            "type": "nominal",
            "domain": [
              "deletion",
              "inversion",
              "translocation",
              "tandem-duplication"
            ]
          },
          "strokeWidth": {"value": 0.8},
          "opacity": {"value": 0.15},
          "width": 500,
          "height": 100
        }
      ]
    },
    {
      "spacing": 10,
      "arrangement": "horizontal",
      "xDomain": { "chromosome": "5" },
      "views": [
        {
          "tracks": [
            {
              "data": {
                "url": "https://server.gosling-lang.org/api/v1/tileset_info/?d=cistrome-multivec",
                "type": "multivec",
                "row": "sample",
                "column": "position",
                "value": "peak",
                "categories": ["sample 1", "sample 2", "sample 3", "sample 4"],
                "binSize": 4
              },
              "mark": "bar",
              "x": {
                "field": "start",
                "type": "genomic",
                "linkingId": "detail-1",
                "domain": {"chromosome": "5"}
              },
              "xe": {"field": "end", "type": "genomic"},
              "y": {"field": "peak", "type": "quantitative"},
              "row": {"field": "sample", "type": "nominal"},
              "color": {"field": "sample", "type": "nominal"},
              "stroke": {"value": "black"},
              "strokeWidth": {"value": 0.3},
              "style": {"background": "blue"},
              "width": 200,
              "height": 100
            }
          ]
        },
        {
          "tracks": [
            {
              "data": {
                "url": "https://server.gosling-lang.org/api/v1/tileset_info/?d=cistrome-multivec",
                "type": "multivec",
                "row": "sample",
                "column": "position",
                "value": "peak",
                "categories": ["sample 1", "sample 2", "sample 3", "sample 4"],
                "binSize": 4
              },
              "mark": "bar",
              "x": {
                "field": "start",
                "type": "genomic",
                "domain": {"chromosome": "16"},
                "linkingId": "detail-2"
              },
              "xe": {"field": "end", "type": "genomic"},
              "y": {"field": "peak", "type": "quantitative"},
              "row": {"field": "sample", "type": "nominal"},
              "color": {"field": "sample", "type": "nominal", "legend": true},
              "stroke": {"value": "black"},
              "strokeWidth": {"value": 0.3},
              "style": {"background": "red"},
              "width": 245,
              "height": 150
            }
          ]
        }
      ],
      "style": {"backgroundOpacity": 0.1}
    }
  ]
}

sehilyi avatar Jun 18 '21 20:06 sehilyi