Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python error with --coverage #40

Closed
mikeyweigand opened this issue Sep 27, 2018 · 13 comments
Closed

python error with --coverage #40

mikeyweigand opened this issue Sep 27, 2018 · 13 comments
Assignees
Milestone

Comments

@mikeyweigand
Copy link

In attempting to use '--coverage' I encounter the following python error, which I have been unable to correct. Admittedly, I am not a skilled python user.

Traceback (most recent call last):
File "/home/yrh8/Tools/stringMLST/stringMLST.py", line 1613, in
getCoverage(results)
File "/home/yrh8/Tools/stringMLST/stringMLST.py", line 790, in getCoverage
allele = gene+'_'+re.sub("*", "", str(results[sample][gene]))
File "/usr/lib/python2.7/re.py", line 151, in sub
return _compile(pattern, flags).sub(repl, string, count)
File "/usr/lib/python2.7/re.py", line 244, in _compile
raise error, v # invalid expression
sre_constants.error: nothing to repeat

@ar0ch
Copy link
Member

ar0ch commented Sep 29, 2018

Hi Mike,

There's is an oddball bug in Python in early version of Python 2.7 (2.7.x < 2.7.5 if memory serves). What version of Python 2.7 are you running (python --version will tell you)?

@mikeyweigand
Copy link
Author

mikeyweigand commented Oct 1, 2018

Thanks. I get this error with Python 2.7.6; and a similar error with Python 3.4.3.

@ar0ch ar0ch self-assigned this Oct 2, 2018
@ar0ch ar0ch added the bug label Oct 2, 2018
@ar0ch
Copy link
Member

ar0ch commented Oct 2, 2018

I'll take a look this week

@ar0ch
Copy link
Member

ar0ch commented Oct 22, 2018

I haven't forgotten about this issue Mike, just haven't had the time to look at it yet. I'm sorry for the wait! 😞

@garfinjm
Copy link

Hello,

I am encountering the same issue with python 2.7.12 and 3.5.2, working in a docker container based on ubuntu:xenial. I get the same error with the Neisseria test dataset and a Salmonella enterica dataset.

I am using the suggested samtools/bedtools/bwa versions.

For Neisseria I tried:

stringMLST.py --predict -1 tests/fastqs/ERR026529_1.fastq.gz -2 tests/fastqs/ERR026529_2.fastq.gz --prefix Nm -k 35 --coverage --config datasets/Neisseria_spp/neisseria_config.txt -o testingout

and my error looks like:

Traceback (most recent call last):
  File "/stringMLST/stringMLST.py", line 1613, in <module>
    getCoverage(results)
  File "/stringMLST/stringMLST.py", line 790, in getCoverage
    allele = gene+'_'+re.sub("*", "", str(results[sample][gene]))
  File "/usr/lib/python2.7/re.py", line 155, in sub
    return _compile(pattern, flags).sub(repl, string, count)
  File "/usr/lib/python2.7/re.py", line 251, in _compile
    raise error, v # invalid expression
sre_constants.error: nothing to repeat

Let me know if there is anything you want me to try. Thanks!

@ar0ch
Copy link
Member

ar0ch commented Dec 27, 2018

Alright...I'll carve out some time during the begining of January to finally squash this bug. It's been around long enough and I should really fix it.

@ar0ch ar0ch removed the bug label Dec 27, 2018
@ar0ch ar0ch added this to the Jan2019 milestone Dec 27, 2018
@ar0ch ar0ch mentioned this issue Jan 7, 2019
@ar0ch
Copy link
Member

ar0ch commented Jan 7, 2019

Alrighty, this bug should be fixed now. I missed escaping the "*" in the re.sub statement on line 790 while refactoring code .

python2 --version;python2 ./stringMLST.py --predict -d tests/fastqs -P neisseria/nmb --coverage --config neisseria/nmb_config.txt; python3 --version; python3 ./stringMLST.py --predict -d tests/fastqs -P neisseria/nmb --coverage --config neisseria/nmb_config.txt

Python 2.7.11
Sample  abcZ    adk     aroE    fumC    gdh     pdhC    pgm  ST
ERR027250       581 (100.00)    408 (99.35)     655 (91.63)  602 (92.47)        633 (99.60)     612 (100.00)    632 (97.33)     10252
ERR026529       231 (100.00)    180 (100.00)    306 (100.00) 612 (100.00)       269 (100.00)    277 (100.00)    260 (99.78)     10174
ERR036104       2 (100.00)      3 (100.00)      4 (100.00)   3 (100.00) 8 (100.00)      4 (100.00)      6 (100.00)      11

Python 3.6.3 :: Anaconda custom (64-bit)
Sample  abcZ    adk     aroE    fumC    gdh     pdhC    pgm  ST
ERR026529       231 (100.00)    180 (100.00)    306 (100.00) 612 (100.00)       269 (100.00)    277 (100.00)    260 (99.78)     10174
ERR027250       581 (100.00)    408 (99.35)     655 (91.63)  602 (92.47)        633 (99.60)     612 (100.00)    632 (97.33)     10252
ERR036104       2 (100.00)      3 (100.00)      4 (100.00)   3 (100.00) 8 (100.00)      4 (100.00)      6 (100.00)      11


And this also has made me realize why #36 is happening... So hopefully I'll get that fixed today as well

@ar0ch
Copy link
Member

ar0ch commented Jan 14, 2019

@mikeyweigand @garfinjm Does the update from last week (you can update via pip if you want) solve this for you?

@garfinjm
Copy link

Works perfect for me with the Neisseria test dataset.

Thanks for the fix!

@ar0ch
Copy link
Member

ar0ch commented Jan 15, 2019

Great! 😄

@ar0ch ar0ch closed this as completed Jan 15, 2019
@garfinjm
Copy link

garfinjm commented Feb 1, 2019

Sorry to reopen this one, could you do 0.5.2 release on github? For validation purposes, I would like to have a static release to put in my dockerfile, but I am getting an error with pip3:

root@3510db9e948f:/stringMLST-0.5.2# pip3 install stringMLST
Collecting stringMLST
  Using cached https://files.pythonhosted.org/packages/c0/15/beb76e4fcbc196862812c4ad08f86ca1ace2d67424eeb02d257309deaa37/stringMLST-0.5.2.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-u7exvti2/stringMLST/setup.py", line 9, in <module>
        with open("README.md", "r") as fh:
    FileNotFoundError: [Errno 2] No such file or directory: 'README.md'

Thanks again for all your help with this, let me know if you want any more debugging info from my attempts with pip.

@ar0ch
Copy link
Member

ar0ch commented Feb 1, 2019

Done! https://github.com/jordanlab/stringMLST/releases/tag/0.5.2

I'll track down that pip error and put out a new pip bundle

@garfinjm
Copy link

garfinjm commented Feb 8, 2019

Working perfect now. Thanks for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants