igvteam / igv-reports

Python application to generate self-contained pages embedding IGV visualizations, with no dependency on original input files.
MIT License
347 stars 51 forks source link

igv-report does not embed igv track #30

Closed alperyilmaz closed 5 years ago

alperyilmaz commented 5 years ago

Hi, I was trying to generate report using conda environment. I downloaded the sample data and run the sample code (I replaced genome URL with local file location). I can generate the html output, when I open the file I can only see variant table but IGV is not embedded. (see image below)

image

When I check the html contents I can see the following (I trimmed to output, shown as ...):


<div id="igvContainer">
    <div id="igvDiv"></div>
</div>

<script type="text/javascript">

    var tableJson = [{"unique_id": 0, "CHROM": "chr5", "POSITION": 474989, "REF": "A", "ALT": "G",...

    var sessionDictionary = {"0": "data:application/gzip;base64,H4sIABLVHF0C...

How can I fix this problem?

jrobinso commented 5 years ago

Actually IGV is embedded, I see it. What do you see if you examine the DOM contents with Google developer tools? I suspect there's an error loading your genomic sequence. Is there anything in the console?

alperyilmaz commented 5 years ago

Sorry, I forgot to mention, when I run the example code from README, the genome was provided as URL (https://s3.amazonaws.com/igv.broadinstitute.org/genomes/seq/hg38/hg38.fa) and create_report gave error, saying it cannot find the file:

OSError: file `https://s3.amazonaws.com/igv.broadinstitute.org/genomes/seq/hg38/hg38.fa` not found

So, I provided a file from my local folder. Do I need to convert that fasta into data-uri?

The console has error (I'm guessing, due to fasta not being data-uri) as shown below:

image

alperyilmaz commented 5 years ago

I tried creating data-uri for my genome but had memory issues:

$ create_datauri /home/user/INDEXES/hg38.fa

Traceback (most recent call last):
  File "/home/alper/tmp/snakemake-igv-reports/.snakemake/conda/0ecd005e/bin/create_datauri", line 10, in <module>
    sys.exit(main())
  File "/home/alper/tmp/snakemake-igv-reports/.snakemake/conda/0ecd005e/lib/python3.7/site-packages/igv_reports/datauri.py", line 52, in main
    uri = file_to_data_uri(args.filename, args.filetype, region)
  File "/home/alper/tmp/snakemake-igv-reports/.snakemake/conda/0ecd005e/lib/python3.7/site-packages/igv_reports/datauri.py", line 35, in file_to_data_uri
    data = reader.slice(region)
  File "/home/alper/tmp/snakemake-igv-reports/.snakemake/conda/0ecd005e/lib/python3.7/site-packages/igv_reports/feature.py", line 36, in slice
    return self.reader.slice(region)
  File "/home/alper/tmp/snakemake-igv-reports/.snakemake/conda/0ecd005e/lib/python3.7/site-packages/igv_reports/feature.py", line 74, in slice
    return f.read()
  File "/home/alper/tmp/snakemake-igv-reports/.snakemake/conda/0ecd005e/lib/python3.7/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
MemoryError

I guess I need to use genomes already available with URL, and I need to fix the issue about create_report not being able to use URL for hg38.fa

jrobinso commented 5 years ago

Hi, I'm not sure why you are trying to create a data-uri for a 3 GB fasta but that is not going to work, the resulting string would be enormous.

Let's stay focused on the original problem. First try updating igv-reports, I just released a new version (0.92). If this does not fix your problem please post the command line you used to create the report, and also if possible zip the resulting html and attach it here.

stevekm commented 3 years ago

looks like this might have actually been the issue I described here; https://github.com/igvteam/igv-reports/issues/49 . Wrong reference genome file.