poretools icon indicating copy to clipboard operation
poretools copied to clipboard

python3 support?

Open pfaucon opened this issue 8 years ago • 9 comments

I'm looking to rewrite some of the scripts we were using for fast5 parsing, and in particular to just borrow functionality from poretools but I'm having trouble running with python3. In particular pip install fails because setup.py has a "print version" instead of "print(version)" I'll submit a fix for that, but I wanted to see if I can get everything up to speed at the same time. In particular I'm seeing the error below about "scripts" missing, this error does not show up in python2.7.

It looks like there is no support for python 3 within the package (imports are relative, prints and exceptions lack parenthesis etc...) is there interest from the group in doing the conversion?

pfaucon@pfaucon-ubuntu:~/Desktop/poretools$ python3 Python 3.4.3 (default, Oct 14 2015, 20:28:29) [GCC 4.8.4] on linux Type "help", "copyright", "credits" or "license" for more information.

import poretools Traceback (most recent call last): File "", line 1, in File "/home/pfaucon/Desktop/poretools/poretools/init.py", line 3, in import scripts ImportError: No module named 'scripts'

pfaucon avatar Oct 13 '16 01:10 pfaucon

for what it's worth I was able to get poretools working in python3 with the following commands(standard linux):

  • do a generic conversion of python 2 to python 3, make a new directory with the updated python
    • 2to3 --output-dir=poretools-3 -W -n poretools
  • copy the things that weren't changed without clobbering new stuff
    • cp -nr ../poretools/* poretools/
  • clean up the tabs (some of the developers work in vim/nano and mix tabs and spaces, also 8 spaces per tab)
    • find . -name '*.py' ! -type d -exec bash -c 'expand -t 8 "$0" > /tmp/e && mv /tmp/e "$0"' {} ;

after this I rebuilt in python2 and python3 and it seems to work fine. If there is interest I would be happy to place a pull request, else one of you could run the same.

pfaucon avatar Oct 13 '16 01:10 pfaucon

A poretools conversion to python 3 would be much appreciated pfaucon. I wouldn't be able to help to achieve this since I am fairly new to bioinformatics but I am happy to offer the computer systems that I have available for testing of any new builds.

NathanielLegall avatar Mar 10 '17 14:03 NathanielLegall

This is great, thank you for the suggestion. @arq5x what do you think?

nickloman avatar Mar 10 '17 14:03 nickloman

I am on board with this, but don't have any direct experience doing this. @tomsasani would you be up for tackling this with a bit of guidance from @brentp, as he has done 2 and 3 support for some of his tools.

arq5x avatar Mar 10 '17 15:03 arq5x

it's already done, look at the pull request that I opened in October. It is probable that there will be more changes to be made (or one could re-run my original pipeline to do the conversion).

I think the main problem is that there are no unit tests for pore tools so I did limited testing by hand at the time, but it would be more comforting to have a standardized testing.

phfaucon avatar Mar 10 '17 17:03 phfaucon

@arq5x @nickloman @brentp @tomsasani

It seems like poretools hasn't had any maintenance for at least a few months, but it is still an important tool to the Nanopore community. There are numerous new tools being released, and new file formats and folder formats being used. Is there any interest in continuing the development, or at least maintaining it?

I would be willing to make some contributions, as I have used the tool, but only if they would actually be reviewed and possibly incorporated(unlike my proposed patch that has now sat for a few months :) ).

pfaucon avatar Mar 12 '17 05:03 pfaucon

Well I think between us we've managed to keep up with the various changes required for new Metrichor (recursive folder operation) and the new MinKNOW 1.4 file format, but we are certainly overdue rolling a new release.

What we really could do productively is spend a couple of days looking through all the issues and pull requests and cleaning up the repository.

nickloman avatar Mar 12 '17 09:03 nickloman

Agreed. Let's do that and yes, contributions from others are most welcome. Sorry for the slowness in integrating. We are juggling many software projects and just don't have enough hands on deck!

arq5x avatar Mar 12 '17 15:03 arq5x

Cross referencing this pull request to add python3 support. https://github.com/arq5x/poretools/pull/129

robegan21 avatar Apr 05 '17 01:04 robegan21