The bioBakery help forum

Error running sample fasta with Humann2/metaphlan

Hi I am getting metaphlan3 errors. Is there a way you can help me with this? Thank you!

Best,
Carla

Error message returned from metaphlan :
Warning! Biom python library not detected!
Exporting to biom format will not work!

Downloading https://www.dropbox.com/sh/7qze7m7g9fe2xjg/AAA4XDP85WHon_eHvztxkamTa/file_list.txt?dl=1

Warning: Unable to download https://www.dropbox.com/sh/7qze7m7g9fe2xjg/AAA4XDP85WHon_eHvztxkamTa/file_list.txt?dl=1
Traceback (most recent call last):
File “/Library/Frameworks/Python.framework/Versions/3.8/bin/metaphlan”, line 8, in
sys.exit(main())
File “/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/metaphlan/metaphlan.py”, line 916, in main
pars[‘index’] = check_and_install_database(pars[‘index’], pars[‘bowtie2db’], pars[‘bowtie2_build’], pars[‘nproc’], pars[‘force_download’])
File “/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/metaphlan/init.py”, line 271, in check_and_install_database
index = resolve_latest_database(bowtie2_db, ls_f[‘mpa_latest’], force_redownload_latest)
UnboundLocalError: local variable ‘ls_f’ referenced before assignment

Here is the log file text:

06/18/2020 02:27:43 PM - humann.humann - INFO: Running humann v3.0.0.alpha.2
06/18/2020 02:27:43 PM - humann.humann - INFO: Output files will be written to: /Users/curanga/Desktop/humann3/databases/demo_fastq
06/18/2020 02:27:43 PM - humann.humann - INFO: Writing temp files to directory: /Users/curanga/Desktop/humann3/databases/demo_fastq/demo_humann_temp
06/18/2020 02:27:43 PM - humann.utilities - INFO: File ( /Users/curanga/Desktop/humann3/databases/demo.fastq ) is of format: fastq
06/18/2020 02:27:43 PM - humann.utilities - DEBUG: Check software, metaphlan, for required version, 3.0
06/18/2020 02:27:43 PM - humann.utilities - INFO: Using metaphlan version 3.0
06/18/2020 02:27:43 PM - humann.utilities - DEBUG: Check software, bowtie2, for required version, 2.2
06/18/2020 02:27:43 PM - humann.utilities - INFO: Using bowtie2 version 2.3
06/18/2020 02:27:43 PM - humann.humann - INFO: Search mode set to uniref90 because a uniref90 translated search database is selected
06/18/2020 02:27:43 PM - humann.utilities - DEBUG: Check software, diamond, for required version, 0.9.24
06/18/2020 02:27:43 PM - humann.utilities - INFO: Using diamond version 0.9.34
06/18/2020 02:27:43 PM - humann.config - INFO:
Run config settings:

DATABASE SETTINGS
nucleotide database folder = /Users/curanga/Desktop/humann3/databases/chocophlan
protein database folder = /Users/curanga/Desktop/humann3/databases/uniref
pathways database file 1 = /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/humann/data/pathways/metacyc_reactions_level4ec_only.uniref.bz2
pathways database file 2 = /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/humann/data/pathways/metacyc_pathways_structured_filtered
utility mapping database folder = /Users/curanga/Desktop/humann3/databases/utility_mapping

RUN MODES
resume = False
verbose = False
bypass prescreen = False
bypass nucleotide index = False
bypass nucleotide search = False
bypass translated search = False
translated search = diamond
pick frames = off
threads = 1

SEARCH MODE
search mode = uniref90
nucleotide identity threshold = 0.0
translated identity threshold = 80.0

ALIGNMENT SETTINGS
bowtie2 options = --very-sensitive
diamond options = --top 1 --outfmt 6
evalue threshold = 1.0
prescreen threshold = 0.01
translated subject coverage threshold = 50.0
translated query coverage threshold = 90.0
nucleotide subject coverage threshold = 50.0
nucleotide query coverage threshold = 90.0

PATHWAYS SETTINGS
minpath = on
xipe = off
gap fill = on

INPUT AND OUTPUT FORMATS
input file format = fastq
output file format = tsv
output max decimals = 10
remove stratified output = False
remove column description output = False
log level = DEBUG

06/18/2020 02:27:43 PM - humann.store - DEBUG: Initialize Alignments class instance to minimize memory use
06/18/2020 02:27:43 PM - humann.store - DEBUG: Initialize Reads class instance to minimize memory use
06/18/2020 02:28:00 PM - humann.humann - INFO: Load pathways database part 1: /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/humann/data/pathways/metacyc_reactions_level4ec_only.uniref.bz2
06/18/2020 02:28:00 PM - humann.humann - INFO: Load pathways database part 2: /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/humann/data/pathways/metacyc_pathways_structured_filtered
06/18/2020 02:28:00 PM - humann.search.prescreen - INFO: Running metaphlan …
06/18/2020 02:28:00 PM - humann.utilities - DEBUG: Using software: /Library/Frameworks/Python.framework/Versions/3.8/bin/metaphlan
06/18/2020 02:28:00 PM - humann.utilities - INFO: Execute command: /Library/Frameworks/Python.framework/Versions/3.8/bin/metaphlan /Users/curanga/Desktop/humann3/databases/demo.fastq -t rel_ab -o /Users/curanga/Desktop/humann3/databases/demo_fastq/demo_humann_temp/demo_metaphlan_bugs_list.tsv --input_type fastq --bowtie2out /Users/curanga/Desktop/humann3/databases/demo_fastq/demo_humann_temp/demo_metaphlan_bowtie2.txt
06/18/2020 02:28:01 PM - humann.utilities - CRITICAL: Error executing: /Library/Frameworks/Python.framework/Versions/3.8/bin/metaphlan /Users/curanga/Desktop/humann3/databases/demo.fastq -t rel_ab -o /Users/curanga/Desktop/humann3/databases/demo_fastq/demo_humann_temp/demo_metaphlan_bugs_list.tsv --input_type fastq --bowtie2out /Users/curanga/Desktop/humann3/databases/demo_fastq/demo_humann_temp/demo_metaphlan_bowtie2.txt

Error message returned from metaphlan :
Warning! Biom python library not detected!
Exporting to biom format will not work!

Downloading https://www.dropbox.com/sh/7qze7m7g9fe2xjg/AAA4XDP85WHon_eHvztxkamTa/file_list.txt?dl=1

Warning: Unable to download https://www.dropbox.com/sh/7qze7m7g9fe2xjg/AAA4XDP85WHon_eHvztxkamTa/file_list.txt?dl=1
Traceback (most recent call last):
File “/Library/Frameworks/Python.framework/Versions/3.8/bin/metaphlan”, line 8, in
sys.exit(main())
File “/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/metaphlan/metaphlan.py”, line 916, in main
pars[‘index’] = check_and_install_database(pars[‘index’], pars[‘bowtie2db’], pars[‘bowtie2_build’], pars[‘nproc’], pars[‘force_download’])
File “/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/metaphlan/init.py”, line 271, in check_and_install_database
index = resolve_latest_database(bowtie2_db, ls_f[‘mpa_latest’], force_redownload_latest)
UnboundLocalError: local variable ‘ls_f’ referenced before assignment

06/18/2020 02:28:01 PM - humann.utilities - CRITICAL: TRACEBACK:
Traceback (most recent call last):
File “/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/humann/utilities.py”, line 734, in execute_command
p_out = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
File “/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/subprocess.py”, line 411, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File “/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/subprocess.py”, line 512, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command ‘[’/Library/Frameworks/Python.framework/Versions/3.8/bin/metaphlan’, ‘/Users/curanga/Desktop/humann3/databases/demo.fastq’, ‘-t’, ‘rel_ab’, ‘-o’, ‘/Users/curanga/Desktop/humann3/databases/demo_fastq/demo_humann_temp/demo_metaphlan_bugs_list.tsv’, ‘–input_type’, ‘fastq’, ‘–bowtie2out’, ‘/Users/curanga/Desktop/humann3/databases/demo_fastq/demo_humann_temp/demo_metaphlan_bowtie2.txt’]’ returned non-zero exit status 1.

I know you’ve got another thread going now for install help. Please let us know if your issues have been resolved there or if you need additional help.

An UnboundLocalError is raised when a local variable is referenced before it has been assigned. In most cases this will occur when trying to modify a local variable before it is actually assigned within the local scope. Python doesn’t have variable declarations, so it has to figure out the scope of variables itself. It does so by a simple rule: If there is an assignment to a variable inside a function, that variable is considered local.

Python has lexical scoping by default, which means that although an enclosed scope can access values in its enclosing scope, it cannot modify them (unless they’re declared global with the global keyword). A closure binds values in the enclosing environment to names in the local environment. The local environment can then use the bound value, and even reassign that name to something else, but it can’t modify the binding in the enclosing environment. UnboundLocalError happend because when python sees an assignment inside a function then it considers that variable as local variable and will not fetch its value from enclosing or global scope when we execute the function. However, to modify a global variable inside a function, you must use the global keyword.