nf-core / slamseq

SLAMSeq processing and analysis pipeline
https://nf-co.re/slamseq
MIT License
7 stars 8 forks source link

gtf2bed.py py2->py3 conversation error #16

Open genio0815 opened 4 years ago

genio0815 commented 4 years ago

Hi,

running

nf-core/slamseq v1.0.0
Container: singularity - nfcore/slamseq:1.0.0

leads to

Error executing process > 'gtf2bed (genes.gtf)'

Caused by:
  Process `gtf2bed (genes.gtf)` terminated with an error exit status (1)

Command executed:

  gtf2bed.py genes.gtf | sort -k1,1 -k2,2n > genes.3utr.bed

Command exit status:
  1

Command output:
  (empty)

Command error:
  Traceback (most recent call last):
    File  XXX/nf-core/slamseq/bin/gtf2bed.py", line 223, in <module>
      lastCDSIndexInExon = exonRank.index(lastCDS)
  AttributeError: 'dict_keys' object has no attribute 'index'

as also reported in issue https://github.com/nf-core/slamseq/issues/13

However the reason for that seems to be an incomplete py3 compatibility in gtf2bed.py. The py2=>py3 conversion as begun in https://github.com/t-neumann/slamseq/commit/47c9439481fe297fe322eb91f34c151c0399fe07#diff-70d6ae98392251549ca5b2101e582aaa is (at least) also missing in line 199

exonRank = dict.keys()
# returns a 'dict_key' object in in py3, but a 'list' object in pyt2 

lastCDSIndexInExon = exonRank.index(lastCDS) 
# fails therefore in py3

cheers

Hypertyz commented 4 years ago

if you edit from dict.keys() to list(dict.keys()), the error will go away

mattheatley commented 1 year ago

just encountered the same error. was going to add specifically change line 199

currently: exonRank = exon.keys()

should be: exonRank = list(exon.keys())

Is correct on line 92 but just missed there.