Problems with PacBio's Improved Phased Assembler (IPA)
1
0
Entering edit mode
7 weeks ago
Panos ★ 1.9k

I'm trying to use PacBio's IPA assembler with my HiFi data, but it has stuck at something that looks like very snakemake-related (the assembler is based on snakemake).

So, I start running it like this:

ipa local --nthreads 8 --njobs 2 -i hifi_reads.bam.fastq.gz

and it dies after just a few seconds saying this:

ValueError in file /home/extioann/Programs/miniconda3/envs/ipa-env/etc/ipa.snakefile, line 57:
Invalid format specifier ' 02d ' for object of type 'int'
  File "/home/extioann/Programs/miniconda3/envs/ipa-env/etc/ipa.snakefile", line 59, in <module>

I checked line 57 from the ipa.snakefile but since I'm not really familiar with Snakemake I can't understand what's wrong (line 57 is the return statement at the very end):

RULE_COUNT = 0

def prenum():
    global RULE_COUNT
    RULE_COUNT += 1
    assert RULE_COUNT < 100
    return f'{RULE_COUNT:02d}-'

I suspect that this is an error that has to do with the specific version of snakemake that I'm running. However, I already downgraded the snakemake version in the conda environment (from 9.X.X to 7.32.0) because IPA was running snakefiles with a parameter that was deprecated in the 9.X.X versions.

Has anyone come across this error? Has anyone used IPA? Because I searched Biostars and there's only one post on IPA and it is from quite some time ago. Moreover, creating issues is apparently not possible at the project's github (there's no issues tab on top)...

pacbio hifi assembly genome • 1.0k views
ADD COMMENT
1
Entering edit mode

Is there a reason you'd like to use IPA over, for instance, hifiasm? I'd recommend starting with hifiasm.

For pbipa, try downgrading to snakemake 5.19.3 with python 3.7.7.

ADD REPLY
0
Entering edit mode

Thanks! I will try further downgrading snakemake (and python)..

Actually, I have already tried hifiasm which worked perfectly (as always!). I just wanted to compare it with IPA (among other assemblers).

ADD REPLY
0
Entering edit mode

Completely understand. I hope this helps then!

ADD REPLY
0
Entering edit mode

Just so others know (in case they try) downgrading snakemake/python didn't work for me. In fact, I tried a number of different combinations of versions for snakemake and python, but none of them worked :(

ADD REPLY
0
Entering edit mode
19 days ago
Kevin Blighe ★ 90k

Hello,

I have not used IPA myself but I can see the issue with the Snakemake script. The error that you are getting is a Python ValueError related to the f-string formatting in the prenum() function. Specifically, the format specifier is being interpreted as ' 02d ', which is invalid for an integer because it includes a leading space.

Looking at the code that you pasted:

RULE_COUNT = 0

def prenum():
    global RULE_COUNT
    RULE_COUNT += 1
    assert RULE_COUNT < 100
    return f'{RULE_COUNT:02d}-'

This should work fine, as there is no space after the colon in :02d. However, the error message suggests that there is a space there in your local ipa.snakefile file (i.e., f'{RULE_COUNT: 02d}-' with a space after the :). Python's f-string parser treats everything after the : as the format specifier, so a space makes it invalid for type 'int'.

I recommend opening the file /home/extioann/Programs/miniconda3/envs/ipa-env/etc/ipa.snakefile in a text editor and checking line 57 (the return statement). Remove any extra space after the colon in the f-string, so it reads exactly as :02d with no spaces. Save the file and try running IPA again.

If that does not resolve it, it could be a version-specific issue in the snakefile that was bundled with your IPA installation. The PacBio IPA repo on GitHub (https://github.com/PacificBiosciences/pbipa) does not have an issues tab, as you mentioned, but you could check for updates or try reinstalling IPA in a fresh conda environment with Python 3.7+ (as required) and Snakemake 7.32.0, ensuring no modifications to the snakefile.

Regarding your attempts to downgrade Snakemake and Python, the space in the format specifier would persist across versions, which is why those did not help. If editing the file works, great; otherwise, you may want to try the suggestion from Billy Rowell on your Biostars post to downgrade specifically to Snakemake 5.19.3 with Python 3.7.7, as that combination has been reported to work for pbipa.

Let me know if this fixes it for you.

Kevin

ADD COMMENT

Login before adding your answer.

Traffic: 3331 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6