igvteam / igv-reports

Python application to generate self-contained pages embedding IGV visualizations, with no dependency on original input files.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Export all tracks to image file

jaredbrewer opened this issue · comments

Thank you for this great tool -- it is very powerful and the HTML output is excellent. However, I was wondering if there is any way to use this tool to export the default tracks as SVG or PNG files for each of a list of input variants. Typically, I am running this on ~ dozens of variants and it would be useful to have defined tracks output as images. It seems like this should be possible to implement by iterating through the individual variants in the "variant_table" and then exporting the contents of "igv-column," which is something I will be trying to execute on my end, but I was wanting to know (a) whether this is a feature under consideration and (b) if you know an elegant way of accomplishing this objective, preferably with programmatic naming.

Hi, I don't have time to pursue this right now but I can give you some hints. I assume you are familiar with the "Save SVG" button in the igv.js toolbar. This works by calling the igv "browser" object API function "saveSVG", https://github.com/igvteam/igv.js/wiki/Browser-API-2.0#tosvg. In the generated html this object is assigned to the variable "igvBrowser"

        igv.createBrowser(igvDiv, options)
            .then(function (b) {
                igvBrowser = b;
                initTable();
            })

So I can imagine a script being written that loops through the table rows loading each one, can calling "saveSVG" to generate the SVG. That's a starting idea anyway. I would suggest working from a generated report html file, then when you have a solution update the template html to embed your new code.