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

Error: terminate called after throwing an instance of 'std::logic_error' #20

Open
stolarczyk opened this issue Dec 11, 2023 · 5 comments
Assignees
Labels
bug Something isn't working Whatchlist Better keep an eye on this

Comments

@stolarczyk
Copy link

When running the following command within my Snakemake pipeline:

porechop_abi -abi -i /path/to/inputs/18S_combo.fastq.gz -o /path/to/outputs/abi_trimmed/18S_combo_pc.fastq.gz

I get the following error

Ab Initio Phase

terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string: construction from null is not valid

More traceback:

Command line:
 /usr/local/bin/miniconda3/envs/qc_long_reads/lib/python3.10/site-packages/porechop_abi/approx_counter /path/to/inputs/Mock.fastq.gz -v 1 --config /usr/local/bin/miniconda3/envs/qc_long_reads/lib/python3.10/site-packages/porechop_abi/ab_initio.config -o ./tmp/temp_approx_kmer_count -nt 16 -mr 10
[11-12-2023 20:58:15 UTC] Traceback (most recent call last):
  File "/usr/local/bin/miniconda3/envs/qc_long_reads/bin/porechop_abi", line 11, in 
    sys.exit(main())
  File "/usr/local/bin/miniconda3/envs/qc_long_reads/lib/python3.10/site-packages/porechop_abi/porechop_abi.py", line 53, in main
    ADAPTERS += launch_ab_initio(args)
  File "/usr/local/bin/miniconda3/envs/qc_long_reads/lib/python3.10/site-packages/porechop_abi/abinitio.py", line 879, in launch_ab_initio
    adp = consensus_adapter(args,
  File "/usr/local/bin/miniconda3/envs/qc_long_reads/lib/python3.10/site-packages/porechop_abi/abinitio.py", line 711, in consensus_adapter
    execApproxCounter(args, out_filename, conf_file, nb_run, v, print_dest)
  File "/usr/local/bin/miniconda3/envs/qc_long_reads/lib/python3.10/site-packages/porechop_abi/abinitio.py", line 433, in execApproxCounter
    subprocess.check_call(command.split())
  File "/usr/local/bin/miniconda3/envs/qc_long_reads/lib/python3.10/subprocess.py", line 369, in check_call
    raise CalledProcessError(retcode, cmd)

subprocess.CalledProcessError: Command '['/usr/local/bin/miniconda3/envs/qc_long_reads/lib/python3.10/site-packages/porechop_abi/approx_counter', '/path/to/inputs/Mock.fastq.gz', '-v', '1', '--config', '/usr/local/bin/miniconda3/envs/qc_long_reads/lib/python3.10/site-packages/porechop_abi/ab_initio.config', '-o', './tmp/temp_approx_kmer_count', '-nt', '16', '-mr', '10']' died with .

Looks like an issue in approx_counter called by the package. Does anyone have an idea where to start looking for a solution?

@qbonenfant
Copy link
Collaborator

It may be hard to debug from this output.

It looks like approx_counter (our approximate k-mer counter core module) received an input it did not like.
The error seems to originate from the STD namespace, so likely something before the approximate count.

Could you rerun this using option '-v 3', so i may pinpoint the crash point a bit better ?

@stolarczyk
Copy link
Author

Thanks for the prompt reply!

here's more verbose output:

Kmer size:             16
Sampled sequences:     40000
Sampling length        100
LC filter threshold:   1
Adjusted LC threshold: 1
Nb thread:             16
Number of kept kmer:   500
Number of runs:        10
Verbosity level:       3

A total of 10 runs will be performed.
[4.41811 ms]    Parsing FASTA file
[99.7605 ms]    Number of sequences found: 1472.
Starting run number 1
/!\ WARNING: Sequence set too small for the requested sample size
/!\ WARNING: The whole set will be used.
[99.8248 ms]    Working on sequence start.
[99.8307 ms]            Sampling
[99.8884 ms]            Sampling the start of reads
[102.529 ms]            Sampled 1471 sequences
[102.56 ms]             Exact k-mer count
[125.369 ms]            Number of kmer found: 51395
[125.422 ms]            Keeping most frequent k-mer
[199.677 ms]            Number of kmer kept:  500
[199.726 ms]            Approximate k-mer count
[199.746 ms]            Preparing index
[201.619 ms]            Creating index
[331.4 ms]              Starting approximate counting
[1187.38 ms]            Exporting approximate count
/!\ ERROR: COULD NOT OPEN FILE ./tmp/temp_approx_kmer_count_0.start
/!\ ERROR: Failed to export approximate k-mer count
Path: ./tmp/temp_approx_kmer_count_0.start

@stolarczyk
Copy link
Author

stolarczyk commented Dec 11, 2023

it seems like the solution could be to use porechop_abi --temp_dir to indicate a different temporary directory location.

It didn't help, unfortunately

@qbonenfant
Copy link
Collaborator

qbonenfant commented Dec 11, 2023

Thanks for this also very fast follow up.
This looks indeed like a temp dir issue. By default, Porechop_ABI will try to create a 'tmp' directory wherever the command was launched. If the user do not have writing permission for this folder, this step will fail.

Changing the 'temp_dir' option to a writable place, or changing the current folder permissions should fix this.
Nevertheless, i really should have put the default temp folder to be in /tmp/, instead of "wherever i am".
There are pros and cons for both, but this is not the first time this became an issue.
I will consider switching if it really become a problem in the futur.

@qbonenfant qbonenfant self-assigned this Dec 11, 2023
@qbonenfant qbonenfant added bug Something isn't working Whatchlist Better keep an eye on this labels Dec 11, 2023
@qbonenfant
Copy link
Collaborator

I see the temp-dir trick did not work (which is weird, we added this for this exact reason).
It may just be a permission issue, maybe try to launch your command from a folder where you are sure you can create new files.
If it does not work, that may be an installation issue (which should not happens since you used conda).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Whatchlist Better keep an eye on this
Projects
None yet
Development

No branches or pull requests

2 participants