HTSeq TSS plot Error
0
1
Entering edit mode
9.8 years ago

I am trying to plot TSS vs Read mapped using HTSeq

I am getting below error:

Traceback (most recent call last):
  File "streaming_throughRead.py", line 17, in <module>
    tsspos[window]+=p
  File "_HTSeq.pyx", line 526, in HTSeq._HTSeq.GenomicArray.__getitem__ (src/_HTSeq.c:9489)
  File "_HTSeq.pyx", line 372, in HTSeq._HTSeq.ChromVector.__getitem__ (src/_HTSeq.c:6649)
IndexError: start too small

Anyone have answer for this, why I am getting this error ..?

htseq version:HTSeq-0.5.4p3

input file size is: 1.5GB

Below Script is used:

#!/usr/bin/env
import HTSeq
import numpy
from matplotlib import pyplot

bamfile = HTSeq.BAM_Reader( "sample2_2hr_Rv_merged.rmdup.bam" )
gtffile = HTSeq.GFF_Reader( "Final_Filt_Gene_CODING_STATUS.gtf" )
halfwinwidth = 3000
fragmentsize = 49

coverage = HTSeq.GenomicArray( "auto", stranded=False, typecode="i" )
for almnt in bamfile:
   if almnt.aligned:
      almnt.iv.length = fragmentsize
      coverage[ almnt.iv ] += 1

tsspos = set()
for feature in gtffile:
   if feature.type == "exon" and feature.attr["exon_number"] == "1":
      tsspos.add( feature.iv.start_d_as_pos )

profile = numpy.zeros(2*halfwinwidth, dtype='i')
for p in tsspos:
   window = HTSeq.GenomicInterval( p.chrom, p.pos - halfwinwidth, p.pos + halfwinwidth, "." )
   wincvg = numpy.fromiter( coverage[window], dtype='i', count=2*halfwinwidth )
   if p.strand == "+":
      profile += wincvg
   else:
      profile += wincvg[::-1]
pyplot.plot( numpy.arange( -halfwinwidth, halfwinwidth ), profile)
pyplot.show()

Thank you in Advance

ChIP-Seq • 2.8k views
ADD COMMENT
0
Entering edit mode

Did you see this?

ADD REPLY
1
Entering edit mode

Yes I saw that but I didnt get single thing from that, can you please explain me how should I solve this error

ADD REPLY
0
Entering edit mode

Hello Sudhir, I have got a similar error with the 0.6.1 version of HTSeq. I am trying to do the same thing as you and got this :

coverage[ almnt.iv ] += 1

File "_HTSeq.pyx", line 526, in HTSeq._HTSeq.GenomicArray.__getitem__ (src/_HTSeq.c:10799)

File "_HTSeq.pyx", line 372, in HTSeq._HTSeq.ChromVector.__getitem__ (src/_HTSeq.c:7653)

IndexError: start too small

Have you find a solution for this issue ?

ADD REPLY

Login before adding your answer.

Traffic: 2734 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6