htseq-count python tutorial attribute counts error

Hello,

I’m following the htseq-count tutorial for RNA-seq (counting the overlapping genes and exons) here htseq.readthedocs.io/en/master/tour.html. However, when I get to the point where I need to find the overlaps in the .sam file and .gtf file, I get an error. This is the code I ran originally that gave the error:

`#2, step_set in exons[alnmt.iv].steps():
if iset is None:
iset = step_set.copy()
else:
iset.intersection_update(step_set)

And this is the error message after running:


AttributeError Traceback (most recent call last)
in
3 if alnmt.aligned:
4 iset = None
—-> 5 for iv2, step_set in exons[alnmt.iv].steps():
6 if iset is None:
7 iset = step_set.copy()

~/anaconda3/lib/python3.8/site-packages/HTSeq/_HTSeq_internal.py in ChromVector_steps(cv)
31 )
32 elif isinstance(cv.array, HTSeq.StepVector.StepVector):
—> 33 for start, stop, value in cv.array[cv.iv.start:cv.iv.end].get_steps():
34 yield (HTSeq.GenomicInterval(
35 cv.iv.chrom, start, stop, cv.iv.strand), value,

~/anaconda3/lib/python3.8/site-packages/HTSeq/StepVector.py in get_steps(self, values_only, merge_steps)
407 startvals = self._swigobj.get_values_pystyle( self.start )
408 prevstart = self.start
–> 409 prevval = startvals.next().second
410 for pair in startvals:
411 stepstart, value = pair.first, pair.second

AttributeError: ‘_StepVector_Iterator_obj’ object has no attribute ‘next’

It said “object has no attribute ‘next'”. Therefore, I looked back at the StepVector.py script and found that the method is called “get_steps()” and not “steps() as it was written in the tutorial code I used above. Therefore, I changed it to “get_steps()” and ran it but got the following error:


AttributeError Traceback (most recent call last)
in
3 if alnmt.aligned:
4 iset = None
—-> 5 for iv2, step_set in exons[alnmt.iv].get_steps():
6 if iset is None:
7 iset = step_set.copy()

AttributeError: ‘HTSeq._HTSeq.ChromVector’ object has no attribute ‘get_steps’

Any idea as to what’s going on and how I can work around it?

Read more here: Source link