hms-dbmi / chromoscope

Interactive multiscale visualization for structural variation in human genomes
https://chromoscope.bio/
MIT License
60 stars 6 forks source link

Encoding JSON in the URL #133

Open nvnieuwk opened 6 months ago

nvnieuwk commented 6 months ago

Hi would it be possible to encode the JSON file into the URL (using base64encode for example). This would make it a lot easier to redirect users dynamically for only the samples they want instead of having to make a JSON file for every possibility.

Example: This JSON data has been encoded in the URL:

{
    "genome": "hg38",
    "tracks": [
        {
            "type": "alignment",
            "name": "HG00103",
            "url": "https://s3.amazonaws.com/1000genomes/data/HG00103/alignment/HG00103.alt_bwamem_GRCh38DH.20150718.GBR.low_coverage.cram",
            "indexURL": "https://s3.amazonaws.com/1000genomes/data/HG00103/alignment/HG00103.alt_bwamem_GRCh38DH.20150718.GBR.low_coverage.cram.crai",
            "format": "cram"
        }
    ]
}

URL: https://igv.org/app/?sessionURL=blob:xY67DoIwFIZfhXQ2vUiMhFFNYHAicTKGHEsFIm1JW0UlvLsU1FdwOcN__svXo1IoLQWKA1SVYYQWAXIG.NWOyrFH7tlOP2jqUkmhnDcomANpQimjoZduppkqnGttTIgNMUh4aQWdxVxLwiil85IlBTggnyz5FX8VDI3Lz904IfMk21ZhtEvxkrIVXbMIJ5sMN7rLub4LA6XA3ID0ALUqxOOQ7f9H4U_tUS7aSHAeZIIbTsMb

An example python script I used to generate this URL: https://github.com/nvnieuwk/python-scripts/blob/main/encode_igv_session.py

I hope this will be possible to add!

-Nicolas

sehilyi commented 6 months ago

This is a great suggestion! We will discuss the support of this feature with the team this/next week and let you know here when/how we will support this!

nvnieuwk commented 6 months ago

Thank you very much!