igvteam / igv-reports

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

Multiple BAM files in --track-config json? #119

Closed phillip-richmond-alamya closed 2 weeks ago

phillip-richmond-alamya commented 2 weeks ago

Hello,

Is it possible to get multiple BAM files to appear while using the --track-config option?

My code chunk looks like this:

    create_report \
        --fasta $genome_fasta \
        --output "${output_filename}" \
        --tracks $genome_gtf $target_regions \
        --track-config $igv_report_bam_config_template \
        --flanking 5000 \
        $target_regions

I'm passing a case and a control sample within my json like this:

[
    {
      "type": "alignment",
      "format": "bam",
      "url":      "bam_path",
      "indexURL": "bam_index_path",
      "height": 400,
      "name": "sample_id",
      "colorBy": "basemod2",
      "groupBy": "tag:HP",
      "showSoftClips": "true"
    },

    {
      "type": "alignment",
      "format": "bam",
      "url":      "control_bam_path",
      "indexURL": "control_bam_index_path",
      "height": 400,
      "name": "control_sample_id",
      "colorBy": "basemod2",
      "groupBy": "tag:HP",
      "showSoftClips": "true"
    }
  ]

Note, the "bam_path", bam_index_path, etc. get changed to actual full filepaths.

It doesn't throw an error, but only the first BAM appears in my IGV report. Any tips?

Thanks, Phil

jrobinso commented 2 weeks ago

I don't see anything obviously wrong with your json.

I tried to reproduce your issue but was not successful. You can try this yourself from the root of the repository

create_report \
 test/data/variants/variants.vcf.gz \
--twobit https://igv.org/genomes/data/hg38/hg38.2bit \
--ideogram test/data/hg38/cytoBandIdeo.txt \
--flanking 1000 \
--info-columns GENE TISSUE TUMOR COSMIC_ID GENE SOMATIC \
--tracks test/data/variants/variants.vcf.gz  \
--track-config test/data/variants/trackConfigs.json \
--output docs/examples/example_config.html

Where trackConfigs.json contains this. Note this is modified from the version in the repository

[

  {
    "name": "Alignments - 1",
    "url": "test/data/variants/recalibrated.bam",
    "samplingDepth": 500,
    "color": "rgb(0,150,150)"
  },
  {
    "name": "Alignments - 2",
    "url": "test/data/variants/recalibrated.bam",
    "samplingDepth": 500,
    "color": "rgb(0,150,150)"
  },
  {
    "name": "Genes",
    "type": "",
    "url": "test/data/hg38/refGene.txt.gz",
    "indexURL": "test/data/hg38/refGene.txt.gz.tbi"
  }
]

The resulting report is attached

example_config.html.zip

phillip-richmond-alamya commented 2 weeks ago

ACK! User error...apologies. It does work fine but I was providing the wrong json template to my nextflow module. Good to know multiple tracks in the config is no problem.

Can I pass multiple config jsons? E.g. would this work?

    create_report \
        --fasta $genome_fasta \
        --output "${output_filename}" \
        --tracks $genome_gtf $target_regions \
        --track-config $igv_report_bam_config_template \
                 --track-config $igv_report_bam_control_config_template \
        --flanking 5000 \
        $target_regions

Or best to keep a single json?

Thanks! Phil

jrobinso commented 2 weeks ago

Multiple configs will not work.