lindenb / jvarkit

Java utilities for Bioinformatics
https://jvarkit.readthedocs.io/
Other
478 stars 132 forks source link

WGSCoveragePlotter: Illegal Capacity: -4 #183

Closed aaronphillips7493 closed 1 year ago

aaronphillips7493 commented 3 years ago

Illegal Capacity: -4

I am trying to run wgscoverageplotter for 1956 contigs. I get the following error: [INFO][WGSCoveragePlotter]Count: 1,927 Elapsed: 19 minutes(98.61%) Remains: 16 seconds(1.39%) Last: tig00109025:1 [INFO][WGSCoveragePlotter]. Completed. N=1,956. That took:19 minutes [INFO][WGSCoveragePlotter]Now using max depth for y axis=83 [SEVERE][WGSCoveragePlotter]Illegal Capacity: -4 java.lang.IllegalArgumentException: Illegal Capacity: -4 at java.util.ArrayList.<init>(ArrayList.java:157) at com.github.lindenb.jvarkit.tools.bam2graphics.WGSCoveragePlotter.doWork(WGSCoveragePlotter.java:445) at com.github.lindenb.jvarkit.util.jcommander.Launcher.instanceMain(Launcher.java:782) at com.github.lindenb.jvarkit.util.jcommander.Launcher.instanceMainWithExit(Launcher.java:945) at com.github.lindenb.jvarkit.tools.bam2graphics.WGSCoveragePlotter.main(WGSCoveragePlotter.java:610) [INFO][Launcher]wgscoverageplotter Exited with failure (-1)

Your environment

Steps to reproduce

I don't know. I mapped my long reads to my 1956 contigs, indexed the resulting BAM file, and gave the FASTA file and BAM file to WGSCoveragePlotter. It has worked for the contigs after I have scaffolded them and mapped the long reads to scaffolds etc.

Expected behaviour

Produce an SVG file showing coverage across the contigs.

Actual behaviour

An empty SVG file is produced because the error above is encountered.

How can I resolve this? I can't find any information on this error anywhere.

Thanks, Aaron :)

lindenb commented 3 years ago

Hi, thank you for the bug report, I'm away from my code for now but my guess is that this bug is produced when some chromosomes are just too small to be displayed compared to the biggest one. May be you could increase --width or remove some contigs with --min-contig-length ?

pawanjayaswal commented 1 year ago

Hello, I was using WGSCoveragePlotter, in which haplotig1.fa as a reference and pulled (Initailly a bam file has generated on combined haplotig12, later on haplotig1.bam and halotig2.bam has separated) haplotig1.bam file was used, but got following error

[SEVERE][WGSCoveragePlotter]Sequence dictionaries are not the same size (10890, 15301) htsjdk.samtools.util.SequenceUtil$SequenceListsDifferException: Sequence dictionaries are not the same size (10890, 15301) at htsjdk.samtools.util.SequenceUtil.assertSequenceListsEqual(SequenceUtil.java:259) at htsjdk.samtools.util.SequenceUtil.assertSequenceDictionariesEqual(SequenceUtil.java:342) at htsjdk.samtools.util.SequenceUtil.assertSequenceDictionariesEqual(SequenceUtil.java:328) at com.github.lindenb.jvarkit.tools.bam2graphics.WGSCoveragePlotter.doWork(WGSCoveragePlotter.java:436) at com.github.lindenb.jvarkit.util.jcommander.Launcher.instanceMain(Launcher.java:819) at com.github.lindenb.jvarkit.util.jcommander.Launcher.instanceMainWithExit(Launcher.java:982) at com.github.lindenb.jvarkit.tools.bam2graphics.WGSCoveragePlotter.main(WGSCoveragePlotter.java:650) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) at java.base/java.lang.reflect.Method.invoke(Method.java:578) at com.github.lindenb.jvarkit.tools.jvarkit.JvarkitCentral$Command.execute(JvarkitCentral.java:247) at com.github.lindenb.jvarkit.tools.jvarkit.JvarkitCentral.run(JvarkitCentral.java:690) at com.github.lindenb.jvarkit.tools.jvarkit.JvarkitCentral.main(JvarkitCentral.java:701)

However, I tried to change the width as well as with --min-contig-length but it has not resolved, can you please fix or rectify this bug.

lindenb commented 1 year ago

You're using a fasta reference file that is different from the one that was used to map the bams.