malonge / RagTag

Tools for fast and flexible genome assembly scaffolding and improvement
MIT License
473 stars 49 forks source link

RagTag patch bug #155

Open r-poloni opened 1 year ago

r-poloni commented 1 year ago

Hi, I am using RagTag to to scaffold (with scaffold command) and then fill the gaps in a PacBio genome I have, using as a reference another PacBio genome, chromosome-scale. However, the program stucks almost immediatly. It seems a problem of python asking for strings but receiving binary files from the last command, but seems something that cannot be fixed with a quick look. Thank you in advance!

This is the output I get from slurm (.err file afterwords)

Thu Mar 2 10:13:50 2023 --- VERSION: RagTag v2.1.0 Thu Mar 2 10:13:50 2023 --- WARNING: This is a beta version of ragtag patch Thu Mar 2 10:13:50 2023 --- CMD: ragtag.py patch -u hifiasm_0.16.1_Eg_no_HiC.bp.p_ctg.gfa_newscaffolds.fa purged.fa Thu Mar 2 10:13:50 2023 --- INFO: Running: ragtag_splitasm.py -o /ragtag/patch/ragtag_output/ragtag.patch.ctg.agp /ragtag/patch/hifiasm_0.16.1_Eg_no_HiC.bp.p_ctg.gfa_newscaffolds.fa > /ragtag/patch/ragtag_output/ragtag.patch.ctg.fasta 2> /ragtag/patch/ragtag_output/ragtag.patch.err Traceback (most recent call last): File "/ragtag_2.1.0/bin/ragtag_patch.py", line 518, in main() File "/ragtag_2.1.0/bin/ragtag_patch.py", line 318, in main run_oae(cmd, reference_ctg_fn, ragtag_log) File "/ragtag_2.1.0/lib/python3.6/site-packages/ragtag_utilities/utilities.py", line 126, in run_oae raise RuntimeError('Failed : %s > %s 2> %s. Check stderr file for details.' % (" ".join(cmd), out, err)) RuntimeError: Failed : ragtag_splitasm.py -o /ragtag/patch/ragtag_output/ragtag.patch.ctg.agp /ragtag/patch/hifiasm_0.16.1_Eg_no_HiC.bp.p_ctg.gfa_newscaffolds.fa > /ragtag/patch/ragtag_output/ragtag.patch.ctg.fasta 2> /ragtag/patch/ragtag_output/ragtag.patch.err. Check stderr file for details.

ragtag.patch.err

[fai_load] build FASTA index. Traceback (most recent call last): File "/env/ragtag_2.1.0/bin/ragtag_splitasm.py", line 111, in main() File "/env/ragtag_2.1.0/bin/ragtag_splitasm.py", line 65, in main gap_coords = [(i.start(), i.end()) for i in re.finditer(r'N+', seq) if i.end() - i.start() > min_gap_size] File "/env/ragtag_2.1.0/lib/python3.6/re.py", line 229, in finditer return _compile(pattern, flags).finditer(string) TypeError: cannot use a string pattern on a bytes-like object

malonge commented 1 year ago

Hi there,

Looks like your fasta file is incorrectly formatted. Try to use the fasta file with other standard tools to confirm that it's properly formatted. For example, perhaps your fasta file is compressed with gzip rather than bgzip? If not this, it will be some other small formatting issue.

r-poloni commented 1 year ago

Hi, thank you for the answer. The file works perfectly with other programs and also with RagTag scaffold, so it seems strange that it is not well formatted.

bhanu-circlelabs commented 4 months ago

@malonge I am running into this issue too:

Traceback (most recent call last): File "ragtag/bin/ragtag_splitasm.py", line 111, in main() File "ragtag/bin/ragtag_splitasm.py", line 65, in main gap_coords = [(i.start(), i.end()) for i in re.finditer(r'N+', seq) if i.end() - i.start() > min_gap_size] File "ragtag/lib/python3.6/re.py", line 229, in finditer return _compile(pattern, flags).finditer(string) TypeError: cannot use a string pattern on a bytes-like object

dannagifford commented 4 months ago

A workaround for this is to downgrade your python version to 3.5. If you've installed within a conda environment, e.g. your_ragtag_env, you can do this with

conda activate your_ragtag_env
conda install python=3.5