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

[singularity] UnicodeDecodeError: 'ascii' codec can't decode byte 0xef #70

Closed
yoann-dufresne opened this issue Sep 20, 2018 · 4 comments

Comments

@yoann-dufresne
Copy link

I'm trying to run quast inside a Singularity (for cluster usage at institut pasteur) but I am encountering some troubles.

First I am building a singularity image with the following singularity file :
https://gitlab.pasteur.fr/bio-singularity/quast/blob/master/Singularity
(download quast5 and execute install.sh)

Then I'm running quast on some samples with the command line :
singularity run quast.simg simu/d5_sub0.5/smrt_assembly_errors.fa.gz simu/d5_sub0.8/smrt_assembly_errors.fa.gz -R ref/reference.fasta -o quast
equivalent to the following line outside of the container:
python3 quast.py simu/d5_sub0.5/smrt_assembly_errors.fa.gz simu/d5_sub0.8/smrt_assembly_errors.fa.gz -R ref/reference.fasta -o quast

Outside of the container everything is ok but inside I trigger the following error:

Version: 5.0.0, de6973bb

System information:
  OS: Linux-4.15.0-34-generic-x86_64-with-Ubuntu-18.04-bionic (linux_64)
  Python version: 3.6.6
  CPUs number: 8

Started: 2018-09-20 14:44:31

Logging to /home/yoann/Projects/Hub/NIRVS/snakes/quast5_s/quast.log
NOTICE: Output directory already exists and looks like a QUAST output dir. Existing results can be reused (e.g. previously generated alignments)!
NOTICE: Maximum number of threads is set to 2 (use --threads option to set it manually)

CWD: /home/yoann/Projects/Hub/NIRVS/snakes
Main parameters: 
  MODE: default, threads: 2, minimum contig length: 500, minimum alignment length: 65, \
  ambiguity: one, threshold for extensive misassembly size: 1000

WARNING: Can't draw plots: python-matplotlib is missing or corrupted.

Reference:
  /home/yoann/Projects/Hub/NIRVS/snakes/ref/reference.fasta ==> reference

Contigs:
  Pre-processing...
  1  simu/d5_sub0.5/smrt_assembly_errors.fa.gz ==> d5_sub0.5_smrt_assembly_errors
  2  simu/d5_sub0.8/smrt_assembly_errors.fa.gz ==> d5_sub0.8_smrt_assembly_errors

2018-09-20 14:44:32
Running Basic statistics processor...
  Reference genome:
    reference.fasta, length = 4639560, num fragments = 1, GC % = 50.79
  Contig files: 
    1  d5_sub0.5_smrt_assembly_errors
    2  d5_sub0.8_smrt_assembly_errors

'ascii' codec can't decode byte 0xef in position 14588: ordinal not in range(128)
Traceback (most recent call last):
  File "/quast/quast.py", line 304, in <module>
    return_code = main(sys.argv[1:])
  File "/quast/quast.py", line 149, in main
    icarus_gc_fpath, circos_gc_fpath = basic_stats.do(ref_fpath, contigs_fpaths, os.path.join(output_dirpath, 'basic_stats'), output_dirpath)
  File "/quast/quast_libs/basic_stats.py", line 259, in do
    html_saver.save_reference_lengths(results_dir, reference_lengths)
  File "/quast/quast_libs/html_saver/html_saver.py", line 463, in save_reference_lengths
    append(results_dirpath, json_fpath, 'referenceLength')
  File "/quast/quast_libs/html_saver/html_saver.py", line 220, in append
    init(html_fpath)
  File "/quast/quast_libs/html_saver/html_saver.py", line 115, in init
    script_texts.append(js_html(aux_f_rel_path))
  File "/quast/quast_libs/html_saver/html_saver.py", line 95, in js_html
    return '<script type="text/javascript">\n' + open(get_real_path(script_rel_path)).read() + '\n</script>\n'
  File "/usr/lib/python3.6/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xef in position 14588: ordinal not in range(128)
ERROR! exception caught!

In case you have troubles running QUAST, you can write to quast.support@cab.spbu.ru
Please provide us with quast.log file from the output directory.

Question: Do you know why this error is raised inside but not outside of the container ? Did I miss some package installation inside of the container ?

To reproduce the bug, you can use the file attached
reference.zip
Uploading smrt_assembly_errors.fa.gz…
smrt_assembly_errors.fa.gz

@yoann-dufresne
Copy link
Author

I fixed the bug by setting the locale inside of the Singularity by these two commands

locale-gen en_US.UTF-8
dpkg-reconfigure locales

@alexeigurevich
Copy link
Contributor

Great to hear that you solved the problem!

And thank you for posting both the issue and the solution here, this could be extremely useful for future Quast users who face the same problem.

@yoann-dufresne
Copy link
Author

And now, if you want to distribute quast5 into a singularity for cluster usage you can use the repository that I mentioned

@alexeigurevich
Copy link
Contributor

Yes, thank you!

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

2 participants