Question: 'HTSeq._HTSeq.GenomicInterval' object has no attribute 'xrange'
0
gravatar for zhangdengwei
13 months ago by
zhangdengwei130
zhangdengwei130 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 • 205 views
ADD COMMENTlink modified 11 months ago by Biostar ♦♦ 20 • written 13 months ago by zhangdengwei130

Are you using the latest version?

ADD REPLYlink written 13 months ago by WouterDeCoster44k

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

ADD REPLYlink written 13 months ago by zhangdengwei130

But you have GenomicPosition not Intervals

ADD REPLYlink written 13 months ago by Asaf8.5k
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: 1181 users visited in the last hour