Coder Social home page Coder Social logo

Comments (4)

apcamargo avatar apcamargo commented on September 4, 2024

Hi @david1ibarra

Can you try to run this before executing geNomad?

PYTHONIOENCODING="utf-8"
LANG="en_US.UTF-8"

Also, what do you mean by truncated output? Can you provide an example?

from genomad.

david1ibarra avatar david1ibarra commented on September 4, 2024

I tried running what you provided before executing geNomad but it did not work. By truncated output I refer to something like this:
Traceback (most recent call last):
File "", line 198, in _run_module_as_main
...
UnicodeEncodeError: 'charmap' codec can't encode characters in position 423-624: character maps to
*** You may need to add PYTHONIOENCODING=utf-8 to your environment ***

from genomad.

apcamargo avatar apcamargo commented on September 4, 2024

If you rename the input to remove spaces and parenthesis, does it work?

from genomad.

david1ibarra avatar david1ibarra commented on September 4, 2024

I tried this:

import subprocess

Specify the correct paths

input_file_path = "C:\Users\DavidIbarra\OneDrive - Cemvita Factory Inc\Desktop\E. coli K12 MG1655 (NC_000913).fasta.gz"
output_directory = "genomad_output"
database_path = "C:\Users\DavidIbarra\Downloads\genomad_db_v1.2.tar.gz"

Remove spaces and parentheses from the input file name

input_file_name = os.path.basename(input_file_path)
input_file_name_without_spaces_parentheses = input_file_name.replace(" ", "_").replace("(", "").replace(")", "")

Construct the new input file path with the modified filename

new_input_file_path = os.path.join(os.path.dirname(input_file_path), input_file_name_without_spaces_parentheses)

Rename the input file

os.rename(input_file_path, new_input_file_path)

Create the output directory if it doesn't exist

if not os.path.exists(output_directory):
... os.makedirs(output_directory)
...

Construct the command with the updated input file path

command = f'set PYTHONIOENCODING=utf-8 && genomad end-to-end --cleanup --splits 8 "{new_input_file_path}" {output_directory} {database_path}'

Run the command in the shell

subprocess.run(command, shell=True)
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Executing geNomad annotate (v1.7.0). This will perform gene calling in the input sequences and annotate the predicted │
│ proteins with geNomad's markers. │
│ ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── │
│ Outputs: │
│ genomad_output\E._coli_K12_MG1655_NC_000913_annotate │
│ ├── E._coli_K12_MG1655_NC_000913_annotate.json (execution parameters) │
│ ├── E._coli_K12_MG1655_NC_000913_genes.tsv (gene annotation data) │
│ ├── E._coli_K12_MG1655_NC_000913_taxonomy.tsv (taxonomic assignment) │
│ ├── E._coli_K12_MG1655_NC_000913_mmseqs2.tsv (MMseqs2 output file) │
│ └── E._coli_K12_MG1655_NC_000913_proteins.faa (protein FASTA file) │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in run_code
File "C:\Users\DavidIbarra\AppData\Local\Programs\Python\Python311\Scripts\genomad.exe_main
.py", line 7, in
File "C:\Users\DavidIbarra\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1157, in call
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\DavidIbarra\AppData\Local\Programs\Python\Python311\Lib\site-packages\rich_click\rich_group.py", line 21, in main
rv = super().main(*args, standalone_mode=False, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\DavidIbarra\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "C:\Users\DavidIbarra\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\DavidIbarra\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\DavidIbarra\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\DavidIbarra\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\decorators.py", line 33, in new_func
return f(get_current_context(), *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\DavidIbarra\AppData\Local\Programs\Python\Python311\Lib\site-packages\genomad\cli.py", line 1240, in end_to_end
ctx.invoke(
File "C:\Users\DavidIbarra\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\DavidIbarra\AppData\Local\Programs\Python\Python311\Lib\site-packages\genomad\cli.py", line 441, in annotate
genomad.annotate.main(
File "C:\Users\DavidIbarra\AppData\Local\Programs\Python\Python311\Lib\site-packages\genomad\modules\annotate.py", line 82, in main
utils.display_header(
File "C:\Users\DavidIbarra\AppData\Local\Programs\Python\Python311\Lib\site-packages\genomad\utils.py", line 286, in display_header
console.print(
File "C:\Users\DavidIbarra\AppData\Local\Programs\Python\Python311\Lib\site-packages\genomad\utils.py", line 96, in print
self.write_print(*args, **kwargs)
File "C:\Users\DavidIbarra\AppData\Local\Programs\Python\Python311\Lib\site-packages\genomad\utils.py", line 80, in write_print
self.writer_console.print(*args, **kwargs)
File "C:\Users\DavidIbarra\AppData\Local\Programs\Python\Python311\Lib\site-packages\rich\console.py", line 1673, in print
with self:
File "C:\Users\DavidIbarra\AppData\Local\Programs\Python\Python311\Lib\site-packages\rich\console.py", line 865, in exit
self._exit_buffer()
File "C:\Users\DavidIbarra\AppData\Local\Programs\Python\Python311\Lib\site-packages\rich\console.py", line 823, in _exit_buffer
self._check_buffer()
File "C:\Users\DavidIbarra\AppData\Local\Programs\Python\Python311\Lib\site-packages\rich\console.py", line 2039, in _check_buffer
write(text)
File "C:\Users\DavidIbarra\AppData\Local\Programs\Python\Python311\Lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'charmap' codec can't encode characters in position 381-498: character maps to
*** You may need to add PYTHONIOENCODING=utf-8 to your environment ***
CompletedProcess(args='set PYTHONIOENCODING=utf-8 && genomad end-to-end --cleanup --splits 8 "C:\Users\DavidIbarra\OneDrive - Cemvita Factory Inc\Desktop\E._coli_K12_MG1655_NC_000913.fasta.gz" genomad_output C:\Users\DavidIbarra\Downloads\genomad_db_v1.2.tar.gz', returncode=1)

from genomad.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.