This is a test version of Biostars. For the public version, visit https://www.biostars.org.
HTSeq TSS plot Error

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

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

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 ?

0 answers

No answers yet.

Log in to answer this question.