harbourlab / SparK

Publication quality NGS track plotting
102 stars 20 forks source link

Error when using averages #6

Closed bvaldebenitom closed 4 years ago

bvaldebenitom commented 4 years ago

Hi!

I just found out this tool, and I've been doing some tests with it. When using the "-ps averages" options I get the following error:

SparK Version 2.6 initiated
Plotting averages
Plotting region: chr11:54746105-54746358
Autoscaling enabled
Traceback (most recent call last):
  File "SparK-master/SparK.py", line 559, in <module>
    for x in range(len(control_data[0])):
IndexError: list index out of range

Any idea on what might be causing it? Thanks!

harbourlab commented 4 years ago

Hi!

Could you please post the full command you used to run SparK?

Thanks!

bvaldebenitom commented 4 years ago

Hi!

Could you please post the full command you used to run SparK?

Thanks!

Sure!

python3 SparK-master/SparK.py --region chr11:54746105-54746358 -cf control1.bdg control2.bdg -tf tr1.bdg tr2.bdg -gtf test2.gtf -bed mm10_all.bed selected.bed -gs yes -ps averages -dt all -o test

harbourlab commented 4 years ago

I tried a couple of things and am puzzled. For my test dataset, all functions work normal. You are trying to plot a very short stretch.. around 250 bp only. I never plotted something so small but even that works with my dataset. If you are comfortable to share your data, email me at Stefan.Kurtenbach@me.com, I could have a closer look. I'm curious on what might be happening here.

bvaldebenitom commented 4 years ago

Hi! @harbourlab

I just used bedtools to get the bedgraph information of the region I'm testing, and got the same issue. I tried a command with just these small bedgraph files, no GTF:

 python3 SparK-master/SparK.py --region chr6:121655069-121664360 -cf ct1.bdg ct2.bdg -tf tr1.bdg tr2.bdg -gs yes -ps averages -o debug

SparK Version 2.6 initiated
Plotting averages
Plotting region: chr6:121655069-121664360
Autoscaling enabled
Traceback (most recent call last):
  File "SparK-master/SparK.py", line 559, in <module>
    for x in range(len(control_data[0])):
IndexError: list index out of range

Also, tried removing the autoscaling and got:

python3 SparK-master/SparK.py --region chr6:121655069-121664360 -cf ct1.bdg ct2.bdg -tf tr1.bdg tr2.bdg -ps averages -o debug
SparK Version 2.6 initiated
Plotting averages
Plotting region: chr6:121655069-121664360
Traceback (most recent call last):
  File "SparK-master/SparK.py", line 564, in <module>
    coords.append([get_relative_hight(np.average(averages)), x_pos])
  File "SparK-master/SparK.py", line 132, in get_relative_hight
    return((raw_value * hight * relative_track_hight_percentage) / max_value) # to not go up to the max
TypeError: unsupported operand type(s) for /: 'float' and 'NoneType'

Here's how the Bedgraph files look:

chr6    121654616   121657379   0
chr6    121657379   121657381   7
chr6    121657381   121657383   8
chr6    121657383   121657389   7
chr6    121657389   121657390   6
chr6    121657390   121657391   7
chr6    121657391   121657394   8
chr6    121657394   121657399   9
chr6    121657399   121657400   10
chr6    121657400   121657401   13

Those files were generated by following the command on the output of some STAR RNA-seq alignments: bamCoverage -b bamfile.bam -o outputfilename.bdg -bs 1 -of bedgraph

Thanks!

selected_region_for_test.tar.gz

EDIT: Apologies. Just noticed that I have put the command regarding another region in here, but I got the same exact behaviour. Please let me know if you can reproduce the errors described with the information in this post, or if you need the files for the original region.

harbourlab commented 4 years ago

Thanks for providing the files! I just uploaded a new version (2.6.2) which fixes your problem. The issue was that when using averages, you had to define groups. In your case, -cg 1 1 -tg 1 1. SparK 2.6.2 now assumes that when no groups are defined, that all control and all treatment files should be plotted in one plot. Let me know if it works for you!

bvaldebenitom commented 4 years ago

Thanks! Works great!

harbourlab commented 4 years ago

Great! I'm closing this issue.