ratschlab / spladder

Tool for the detection and quantification of alternative splicing events from RNA-Seq data.
Other
103 stars 33 forks source link

fix IndexError from write.py line 89 #197

Closed ShixiangWang closed 6 months ago

ShixiangWang commented 6 months ago

error:

Reporting confirmed intron_retention events: writing intron_retention events in gff3 format to AS_output/SRR10900579/spladder/merge_graphs_intron_retention_C3.confirmed.gff3 writing intron_retention events in flat txt format to AS_output/SRR10900579/spladder/merge_graphs_intron_retention_C3.confirmed.txt.gz Traceback (most recent call last): File "/home/circrna/miniconda3/envs/spladder/bin/spladder", line 8, in <module> sys.exit(main()) File "/home/circrna/miniconda3/envs/spladder/lib/python3.8/site-packages/spladder/spladder.py", line 229, in main options.func(options) File "/home/circrna/miniconda3/envs/spladder/lib/python3.8/site-packages/spladder/spladder_build.py", line 163, in spladder analyze_events(event_type, options.bam_fnames, options) File "/home/circrna/miniconda3/envs/spladder/lib/python3.8/site-packages/spladder/alt_splice/analyze.py", line 191, in analyze_events write_events_txt(fn_out_conf_txt, options.samples[sample_idx], events_all, fn_out_count, event_idx=confirmed_idx) File "/home/circrna/miniconda3/envs/spladder/lib/python3.8/site-packages/spladder/alt_splice/write.py", line 89, in write_events_txt counts = event_counts_chunk[:, :, i - chunk_idx_event[0]] IndexError: index 1668 is out of bounds for axis 2 with size 1649

I debugged the error and found when the error happened, 6987 - 5275 > 1055 because the shift size should be added more times of chunk size.

1055 cs1

1055 cs2

10

[ 686 1307 1959 2838 3268 3867 4487 6987 6998 8400] event_idx

686

[  0 1055]

1307

[1055 2110]

1959

[1055 2110]

2838

[2110 3165]

3268

[3165 4220]

3867

[3165 4220]

4487

[4220 5275]

6987 i 

[5275 6330] chunk_idx_event
akahles commented 6 months ago

Thanks a lot for spotting this issue and providing a fix! Could you please re-open the PR against the development branch? Then I will merge it, bundle it with some other fixes and re-release.

Thanks, Andre

akahles commented 6 months ago

I realised that I could change the base branch directly. Merged it now.

ShixiangWang commented 6 months ago

@akahles Thanks for your acceptance of the PR :).