Illumina / canvas

Canvas - Copy number variant (CNV) calling from DNA sequencing data
Other
121 stars 20 forks source link

Unhandled Exception: System.IndexOutOfRangeException: Index was outside the bounds of the array. #92

Closed BenoitFiset closed 6 years ago

BenoitFiset commented 6 years ago

Hi Eric,

As you know, using mono and TN with 1.11.0 of canvas.... Trying to adjust files for WES and getting these errors.

These errors are in all the dat.stderr.txt files. Where do I start to debug this ?

A full error sample:

Unhandled Exception:
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at CanvasBin.CanvasBin.ExcludeTagsOverlappingFilterFile (System.String filterFile, System.Collections.Generic.IDictionary`2[TKey,TValue] tags) [0x0001a] in <63fa03d6c0824
e34bfc976c23685abf9>:0 
  at CanvasBin.CanvasBin.BinOneGenomicInterval (CanvasBin.CanvasBinParameters parameters, System.Collections.Generic.Dictionary`2[TKey,TValue] possibleAlignments, System.Co
llections.Generic.Dictionary`2[TKey,TValue] observedAlignments, System.Collections.Generic.Dictionary`2[TKey,TValue] fragmentLengths) [0x0007f] in <63fa03d6c0824e34bfc976c2
3685abf9>:0 
  at CanvasBin.CanvasBin.Run (CanvasBin.CanvasBinParameters parameters) [0x00040] in <63fa03d6c0824e34bfc976c23685abf9>:0 
  at CanvasBin.Program.Main (System.String[] args) [0x0003b] in <63fa03d6c0824e34bfc976c23685abf9>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.IndexOutOfRangeException: Index was outside the bounds of the array.
  at CanvasBin.CanvasBin.ExcludeTagsOverlappingFilterFile (System.String filterFile, System.Collections.Generic.IDictionary`2[TKey,TValue] tags) [0x0001a] in <63fa03d6c0824
e34bfc976c23685abf9>:0 
  at CanvasBin.CanvasBin.BinOneGenomicInterval (CanvasBin.CanvasBinParameters parameters, System.Collections.Generic.Dictionary`2[TKey,TValue] possibleAlignments, System.Co
llections.Generic.Dictionary`2[TKey,TValue] observedAlignments, System.Collections.Generic.Dictionary`2[TKey,TValue] fragmentLengths) [0x0007f] in <63fa03d6c0824e34bfc976c2
3685abf9>:0 
  at CanvasBin.CanvasBin.Run (CanvasBin.CanvasBinParameters parameters) [0x00040] in <63fa03d6c0824e34bfc976c23685abf9>:0 
  at CanvasBin.Program.Main (System.String[] args) [0x0003b] in <63fa03d6c0824e34bfc976c23685abf9>:0 

Thanks,

B.

BenoitFiset commented 6 years ago

Hi Eric,

Seems I found it.... My --filter-bed file had spaces instead of TABS between columns.... Canvas now seems to be humming fine... I'll see later if finishes...

To be updated later...

BenoitFiset commented 6 years ago

This seems the right fix.

Closing

osowiecki commented 5 years ago

I think my problem is similar in nature. My ploidy.vcf fails but switching from spaces to tabs doesn't fix the problem.

I copied the header from my Germline Strelka result vcf file and placed information about chromosome X in male at the bottom.

######################################### ...

FILTER=

FILTER=

FILTER=

FILTER=

bcftools_filterVersion=1.9+htslib-1.9

bcftools_filterCommand=filter --exclude 'QUAL<30 || GQ<30' ./vcf/CF_6942/CF_6942_strelka.vcf.gz; Date=Tue Jun 25 00:59:17 2019

CHROM POS ID REF ALT QUAL FILTER INFO FORMAT CF_6942

X 0 . N . PASS END=123869142 CN 1

#########################################

I get this error :

#########################################

2019-06-25T01:08:43+02:00,ERROR: Exception caught in WorkDoerFactory. Cancelling all jobs. Exception: Index was outside the bounds of the array. System.IndexOutOfRangeException: Index was outside the bounds of the array. at Isas.SequencingFiles.Vcf.VcfReader.ConvertColumnsToVariant(String[] cols, VcfVariant variant, String& genotypeTagString, String[ ]& genotypeTagOrder, Int32 numSamples) at Isas.SequencingFiles.Vcf.VcfReader.GetNextVariant(VcfVariant& variant) at CanvasCommon.PloidyInfo.LoadPloidyFromVcfFile(String vcfPath, Int32 sampleIndex) in D:\TeamCity\buildAgent\work\a29a190a11771d97 \Src\Canvas\CanvasCommon\PloidyInfo.cs:line 132 at CanvasPedigreeCaller.SampleMetrics.GetSampleInfo(IReadOnlyList1 segments, String ploidyBedPath, Int32 numberOfTrimmedBins, Samp leId id)
at CanvasPedigreeCaller.CanvasPedigreeCaller.CallVariants(List1 variantFrequencyFiles, List1 segmentFiles, IFileLocation outVcfFi le, String ploidyBedPath, String referenceFolder, List1 sampleNames, String commonCnvsBedPath, List1 sampleTypes) in D:\TeamCity\bui ldAgent\work\a29a190a11771d97\Src\Canvas\CanvasPedigreeCaller\CanvasPedigreeCaller.cs:line 93
at CanvasPedigreeCaller.Program.<>c__DisplayClass2_0.b__12(IWorkDoer workDoer) in D:\TeamCity\buildAgent\work\a29a190a11771d97 \Src\Canvas\CanvasPedigreeCaller\Program.cs:line 191
at Isas.Framework.WorkManagement.JobLaunching.JobLauncherFactory.RunWithJobLauncher(ILogger logger, ISettings settings, IDirectoryL ocation loggingDir, Action1 logCommand, CancellationToken cancellationToken, Action1 function)
at Isas.Framework.WorkManagement.JobLaunching.JobLauncherFactory.RunWithJobLauncher(ILogger logger, ISettings settings, IDirectoryL ocation analysisFolder, CancellationToken cancellationToken, Action1 function) at Isas.Framework.WorkManagement.ResourceManagement.WorkResourceManagerFactory.RunWithResourceManager(ILogger logger, ISettings set tings, CancellationToken cancellationToken, Action1 function)
at Isas.Framework.WorkManagement.WorkDoerFactory.RunWithWorkDoer(ILogger logger, ISettings settings, IDirectoryLocation analysisFol der, CancellationTokenSource cancellationTokenSource, Action1 function) at CanvasPedigreeCaller.Program.Run(String[] args) in D:\TeamCity\buildAgent\work\a29a190a11771d97\Src\Canvas\CanvasPedigreeCaller\ Program.cs:line 193 at CanvasPedigreeCaller.Program.Main(String[] args) in D:\TeamCity\buildAgent\work\a29a190a11771d97\Src\Canvas\CanvasPedigreeCaller \Program.cs:line 39

#########################################

By the way, can I use my filtered Strelka Germline result for one normal sample as a --sample-b-allele-vcf file? The dbsnp.vcf for my species (dog) crash complaining that dbsnp file doesn't contain a genotype column.

osowiecki commented 5 years ago

Ok. Seems that the ploidy file needs to be in range of variants present in strelka2 output. My starting position in chromosome X wasn't 0 like in example but somewhere down the line as my strelka2 Germline vcf contains all chromosomes in one file.

I extracted minimal and maximal position of X chromosome from vcf file and not Canvas worked on my male sample.

` bcftools filter --exclude 'QUAL<30 || GQ<30' ./vcf/CF_132/CF_132_strelka.vcf.gz > ./temp.vcf cat ./temp.vcf | grep '#|PASS' > temp2.vcf cat ./temp2.vcf | grep "#" > head.vcf cat ./head.vcf > ./data/ploidy.vcf

MALE

zless ./temp2.vcf | grep -P "X\t" > test_p a=$(cat ./test_p | cut -d$'\t' -f2 |sort -V | head -n1) b=$(cat ./test_p | cut -d$'\t' -f2 |sort -V | tail -n1) printf "X\t${a}\t.\tN\t\t.\tPASS\tEND=${b}\tCN\t1\n" > ./m cat ./head.vcf ./m> ./data/male.vcf

Canvas SmallPedigree-WGS -b ./bam/CF_36.bam --sample-b-allele-vcf=./temp2.vcf -o ./CNV/CF_36 -r ./data/kmers.fasta -g ./data/canFam3/ --filter-bed=./data/filter.bed --ploidy-vcf=./data/male.vcf `