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

Error when specifying URL in file for `--track-config` #59

Closed yeemey closed 2 years ago

yeemey commented 2 years ago

I'm using a Singularity image of igv-reports v.1.0.4, and get this error when I add --track-config.

Traceback (most recent call last):
  File "/usr/local/bin/create_report", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/dist-packages/igv_reports/report.py", line 271, in main
    create_report(args)
  File "/usr/local/lib/python3.9/dist-packages/igv_reports/report.py", line 63, in create_report
    reader = utils.getreader(config["url"])
TypeError: string indices must be integers

This is what the file I pass to --track-config looks like (validated with JSONLint):

{
      "name": "Genes",
      "type": "annotation",
      "format": "gff3",
      "sourceType": "file",
      "url": "data/NC_000962.3.gff3.gz",
      "indexURL": "data/NC_000962.3.gff3.gz.tbi",
      "displayMode": "EXPANDED"
}

This is the command that generated the error:

singularity exec -B $PWD /singularity/igv-reports-1.0.4.sif create_report output/sample/sample_normalized.vcf.gz data/GCF_000195955.2_ASM19595v2_genomic.fna --flanking 1000 --info-columns AF DP MQ QD ANN --tracks data/NC_000962.3.gff3.gz --track-config configs/igv-tracks.config --output output/sample/igv.html

As far as I can tell my JSON config file looks similar to the example given in the igv.js Tracks wiki, except that I added double quotes around the property names, because otherwise, I get a JSONDecodeError.

I also have pysam 0.18.0 installed. Please let me know what further info is needed to help me with this issue, thank you!

jrobinso commented 2 years ago

I don't know anything about singularity. The track-config should be an array of configurations, as noted in the readme, in can have more than one. I suspect that is the issue. Are you able to run our examples?

yeemey commented 2 years ago

Thank you for pointing me to the example, which helped me solve the problem: my JSON file was missing the square brackets at the very beginning and end of the file, as in your trackConfigs.json file here.