Question: 'HTSeq._HTSeq.GenomicInterval' object has no attribute 'xrange'
0
gravatar for zhangdengwei
11 weeks ago by
zhangdengwei40
zhangdengwei40 wrote:

Hi,

I'd like to employ HTSeq to summarize my alignment data. But I encountered an error about its syntax, my code is

import HTSeq
ga = HTSeq.GenomicArray("auto", stranded=False)
iv = HTSeq.GenomicPosition('chr1', 50, "+")
ga[iv] += 1
iv = HTSeq.GenomicPosition('chr1', 50, "+")
ga[iv] += 1
iv = HTSeq.GenomicPosition('chr1', 49, "+")
ga[iv] += 1
iv = HTSeq.GenomicPosition('chr1', 53, "+")
ga[iv] += 1
iv = HTSeq.GenomicPosition('chr1', 48, "+")
ga[iv] += 1
iv = HTSeq.GenomicPosition('chr1', 52, "+")
ga[iv] += 1

for iv, value in ga.steps():
    if value:
        for position in iv.xrange(step=1):
            print(position)

But I got this

Traceback (most recent call last):
  File "htsput.py", line 34, in <module>
    for position in iv.xrange(step=1):
AttributeError: 'HTSeq._HTSeq.GenomicInterval' object has no attribute 'xrange'

According to its tutorial, the GenomicInterval should have the attribute of xrange, like

GenomicInterval.xrange(step = 1)
GenomicInterval.xrange_d(step = 1)

So how can I correct my code? Any suggestion is appreciated, thanks very much.

rna-seq python htseq • 106 views
ADD COMMENTlink modified 6 weeks ago by Biostar ♦♦ 20 • written 11 weeks ago by zhangdengwei40

Are you using the latest version?

ADD REPLYlink written 11 weeks ago by WouterDeCoster42k

Yes, my version of HTSeq is 0.11.2, and 3.7 for python

ADD REPLYlink written 11 weeks ago by zhangdengwei40

But you have GenomicPosition not Intervals

ADD REPLYlink written 11 weeks ago by Asaf6.6k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1265 users visited in the last hour