Closed phillip-richmond-alamya closed 1 month ago
Is the BAM tagged with base modifications (MM/ML tags)? I'm not clear on what you mean by "BAM CpG coloring".
Or perhaps you are referring to bisulfite sequencing data?
Yes they are nanopore BAMs with MM/ML tags.
Yes, you can use "colorBy > base modification..." from the track menu. If you have more than one modification you can choose to color by all or a specific one. You can also choose mono-color or two-color. To emulate the bisulfite sequencing red/blue scheme choose 2 color.
But this being igv-reports, I assume you want the coloring to come up by default. For that you will need to use the track configuration option (--track-config) as described in the readme, as opposed to just listing the bam files. An example is below. See the igv.js documentation for more details. The important property is "colorBy" and the possible values are "basemod" (for monocolor) and "basemod2" (for 2-color)
I am assuming you are using the latest version of igv-reports.
[
{
"type": "alignment",
"format": "bam",
"url": "https://www.dropbox.com/s/q32hk7tvsejryjt/HG002_chr11_119076212_119102218_2.bam?dl=0",
"indexURL": "https://www.dropbox.com/s/ax1ljny7ja5fdcu/HG002_chr11_119076212_119102218_2.bam.bai?dl=0",
"height": 400,
"name": "PacBio - 5hmC 2 Color",
"colorBy": "basemod2"
}
]
DOH! I was on 1.12.0...And see that in 1.13.0 all of these were implemented. Apologies!
Oh no problem. Actually igv-reports itself doesn't change often, it is just a wrapper around igv.js. The only change to igv-reports generally is the reference to igv.js in the template (e.g. igv_reports/templates/variant_template.html), which looks like this. Making this change manually to your generated reports will update them.
<!-- igv -->
<script src="https://cdn.jsdelivr.net/npm/igv@3.0.5/dist/igv.min.js"></script>
Question again, can I use the --track-config if I don't specify the BAM file as a URL? Could these instead be passed as relative filepaths on the system I'm using?
I'm currently using this within a nextflow pipeline and passing the BAM file as a track specifically. Currently the code chunk looks something like this:
process make_igv_report_cnv{
publishDir params.output_dir, mode: 'copy', overwrite: true, pattern: "*html"
input:
val(sample_id)
path(genome_fasta)
path(genome_index)
path(genome_gtf)
path(bam)
path(bamindex)
path(cnv_vcf)
path(cnv_vcf_index)
val(output_filename)
output:
path("${output_filename}"), emit: html
script:
"""
create_report \
--fasta $genome_fasta \
--output "${output_filename}" \
--tracks $genome_gtf cnv.vcf $bam \
--flanking 5000 \
$cnv.vcf
"""
}
If I use the track config, I can swap the --tracks $bam for:
--track-config bam_config
where the config is
[
{
"type": "alignment",
"format": "bam",
"url": "/path/from/nextflow/sample.bam",
"indexURL": "/path/from/nextflow/sample.bam.bai",
"height": 400,
"name": "sample-id",
"colorBy": "basemod2"
}
]
And then the code chunk would be:
script:
"""
<some bash code to create the config given the paths to the bam and bai and the sampleid> > bam_config.json
create_report \
--fasta $genome_fasta \
--output "${output_filename}" \
--tracks $genome_gtf cnv.vcf \
--track-config bam_config.json \
--flanking 5000 \
$cnv.vcf
"""
Would that work?
Thanks! Phil
The URL can be a local file path. In your example I see an absolute, not a relative, path (it starts with "/").
Relative paths are tricky, what does python consider it relative to? I don't know the answer, but you could try it, it would probably be relative to the directory the script is run from. In any case a leading slash is not a relative path, it is going to consider that an absolute path.
An absolute filepath on the system is tracked via nextflow work directories so this should be fine. Thanks for confirming that the URL can be a local filepath!
I'll close the ticket again.
Cheers, Phil
Hello,
Is it possible to view methylation-tagged BAM files in igv-reports? I can view the haplotagged bam files via using the "HP" tag, but unclear if BAM CpG coloring is possible as well.
If not, I can attempt to work with a bedgraph/bigwig showing methylation frequency instead.
Thanks, Phil