2.9.22: Strainphlan error - trying to download bcftools

41 views
Skip to first unread message

Marc Hoeppner

unread,
Dec 4, 2019, 5:10:17 AM12/4/19
to MetaPhlAn-users
Hi,

I recently installed Metaphlan 2.9.22 through bioconda into a docker container. So far, so good. 

However, when trying to run sample2maker.py from Strainphlan, I get: 

Traceback (most recent call last):
  File "/opt/conda/envs/metagenomics-profiling-1.1/bin/sample2markers.py", line 49, in <module>
    request.urlretrieve('https://www.dropbox.com/sh/m4na8wefp53j8ej/AACU1-Nc0q2dUNRmc9pesUi4a/bin/bcftools', os.path.join(os.path.dirname(os.path.realpath(__file__)),'bcftools_0.1.19'))
  File "/opt/conda/envs/metagenomics-profiling-1.1/lib/python3.7/urllib/request.py", line 257, in urlretrieve
    tfp = open(filename, 'wb')
OSError: [Errno 30] Read-only file system: '/opt/conda/envs/metagenomics-profiling-1.1/bin/bcftools_0.1.19'
[sukmb352@rzcl00g MF_cfDNA-cfRNA-Metagenome_01]$ singularity exec -B /ifs /ifs/data/nfs_share/ikmb_repository/singularity_cache/mhoeppner-metagenomic-profiling-metaphlan.img sample2markers.py
Traceback (most recent call last):
  File "/opt/conda/envs/metagenomics-profiling-1.1/bin/sample2markers.py", line 49, in <module>
    request.urlretrieve('https://www.dropbox.com/sh/m4na8wefp53j8ej/AACU1-Nc0q2dUNRmc9pesUi4a/bin/bcftools', os.path.join(os.path.dirname(os.path.realpath(__file__)),'bcftools_0.1.19'))
  File "/opt/conda/envs/metagenomics-profiling-1.1/lib/python3.7/urllib/request.py", line 257, in urlretrieve
    tfp = open(filename, 'wb')
OSError: [Errno 30] Read-only file system: '/opt/conda/envs/metagenomics-profiling-1.1/bin/bcftools_0.1.19'

Obviously, nothing can be downloaded on-the-fly into a docker container. I have tried to provide bcftools (0.1.19, via the Dropbox link) using the 'bcftools_exe' argument from the host system but also from inside the container. Both times the option seemingly gets ignored and the program falls back on trying to download from Dropbox. This also happens, if I just invoke "-help". 

From the looks of it, this problem seems to be kinda old (found a thread from 2018) - and makes me wonder why the conda install is not setup such that bcftools 0.1.19 is provided there. Or why it still uses this horribly outdated version of Bcftools to begin with...

Anyway, what would be the solution to this issue?

Cheers,
Marc

Marc Hoeppner

unread,
Dec 4, 2019, 5:13:52 AM12/4/19
to MetaPhlAn-users

Actually, it seems like the source code in conda is different from the latest version on bitbucket. This is the line where the bcftools check is performed and it seems to not allow any external overrides:

if not os.path.isfile(os.path.join(os.path.dirname(os.path.realpath(__file__)),'bcftools_0.1.19')):
    if(PYTHON_VERSION < 3):
        urlretrieve('https://www.dropbox.com/sh/m4na8wefp53j8ej/AACU1-Nc0q2dUNRmc9pesUi4a/bin/bcftools', os.path.join(os.path.dirname(os.path.realpath(__file__)),'bcftools_0.1.19'))
    else:
        request.urlretrieve('https://www.dropbox.com/sh/m4na8wefp53j8ej/AACU1-Nc0q2dUNRmc9pesUi4a/bin/bcftools', os.path.join(os.path.dirname(os.path.realpath(__file__)),'bcftools_0.1.19'))
try:
    os.symlink(os.path.join(os.path.dirname(os.path.realpath(__file__)),'bcftools_0.1.19'), os.path.join(os.path.dirname(os.path.realpath(__file__)),'bcftools'))
except OSError as e:
    if e.errno == errno.EEXIST:
        os.remove(os.path.join(os.path.dirname(os.path.realpath(__file__)),'bcftools'))
        os.symlink(os.path.join(os.path.dirname(os.path.realpath(__file__)),'bcftools_0.1.19'),os.path.join(os.path.dirname(os.path.realpath(__file__)),'bcftools'))


Aitor Blanco-Miguez

unread,
Dec 9, 2019, 11:30:49 AM12/9/19
to MetaPhlAn-users
Hi Marc, 
thaks for getting in touch.

You can install the last conda version of MetaPhlAn2, in which this error was fixed:
conda install -c bioconda metaphlan2=2.9.5

Best,
Aitor
Reply all
Reply to author
Forward
0 new messages