lpantano / seqcluster

small RNA analysis from NGS data
http://seqcluster.readthedocs.io
MIT License
35 stars 17 forks source link

First round of Python3 compatibility #30

Closed smoe closed 6 years ago

smoe commented 6 years ago

Hello, I think to have addressed a series of easy bits to prepare seqcluster for Python 3.

There are a few other bits, though. Could you please have a look at

  File "/usr/lib/python3/dist-packages/seqcluster/detect/description.py", line 18
    data_loci = map(lambda (x): [x, loci[x].chr, int(loci[x].start), int(loci[x].end), loci[x].strand, len(c.loci2seq[x])], c.loci2seq.keys())
                           ^
SyntaxError: invalid syntax

  File "/usr/lib/python3/dist-packages/seqcluster/libs/annotation.py", line 28
    except Exception, e:
                    ^
SyntaxError: invalid syntax

  File "/usr/lib/python3/dist-packages/seqcluster/make_clusters.py", line 176
    data_ann_temp[dbi] = {dbi: map(lambda (x): loci[lid].db_ann[dbi].ann[x].name, loci[lid].db_ann[dbi].ann.keys())}
                                          ^
SyntaxError: invalid syntax

  File "/usr/lib/python3/dist-packages/seqcluster/stats.py", line 42
    seqs_name = map(lambda (x): x.keys(), item['seqs'])
                           ^
SyntaxError: invalid syntax

Can these bits possibly be addressed in a backward-compatible way? Can the 2to3 tool be a stimulus for you, possibly?

Many thanks and regards,

Steffen

lpantano commented 6 years ago

Thanks, i am totally interested on this. I see travis is failing, maybe some missing imports from future. I’ll take a look later today. Thanks for starting this!

smoe commented 6 years ago

Thank you for your kind reply. I tried to make some sense of what Travis reports but was a bit lost over it. I hope I did not mess it up too much.

When playing with it that command line Travis could not start with Python 3, I ran into

File "/usr/lib/python3/dist-packages/seqcluster/make_clusters.py", line 14, in <module>
   import libs.logger as mylog
ModuleNotFoundError: No module named 'libs'

It somehow did not associate libs as seqcluster.libs. Or classes as seqcluster.libs.classes. Could this be similar to what is described on https://stackoverflow.com/questions/33862963/python-cant-find-my-module ?

Cheers,

Steffen

lpantano commented 6 years ago

Thanks for helping with that.

I remember some issues like that for other packages I migrated, but don’t know if it is the same.

I’ll look into this as well. Maybe it has to be changed to seqcluster.libs.logger instead.

Thanks!

On Jul 10, 2018, at 6:09 PM, Steffen Möller notifications@github.com wrote:

Thank you for your kind reply. I tried to make some sense of what Travis reports but was a bit lost over it. I hope I did not mess it up too much.

When playing with it that command line Travis could not start with Python 3, I ran into

File "/usr/lib/python3/dist-packages/seqcluster/make_clusters.py", line 14, in import libs.logger as mylog ModuleNotFoundError: No module named 'libs' It somehow did not associate libs as seqcluster.libs. Or classes as seqcluster.libs.classes. Could this be similar to what is described on https://stackoverflow.com/questions/33862963/python-cant-find-my-module https://stackoverflow.com/questions/33862963/python-cant-find-my-module ?

Cheers,

Steffen

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/lpantano/seqcluster/pull/30#issuecomment-403982064, or mute the thread https://github.com/notifications/unsubscribe-auth/ABi_HCFCIor3z_fcqJWS0bsQdQCCinSFks5uFSYJgaJpZM4VIkr6.

smoe commented 6 years ago

Those seqcluster prefixes I had added to some 10+ files and this works nicely, indeed. And it would help the overall clarity of the codebase, too, I tend to think. I happily add these prefixes in another branch/pull-request if you do not insist to add these yourself.