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

v-annotate.pl cannot be run with apptainer exec using the VADR Biocontainers Apptainer/Singularity image #87

Open
peterk87 opened this issue Sep 20, 2024 · 1 comment

Comments

@peterk87
Copy link

Hello,

I'm not sure if it's appropriate to post this issue here since it's an issue with the VADR Biocontainer image created from the Bioconda recipe. This issue only arises when running VADR using the Biocontainers Apptainer/Singularity image with Nextflow. There's no issue when running VADR with Nextflow using Conda/Mamba or Docker.

Pulling the VADR Biocontainers Docker image and creating the Apptainer image:

$ apptainer pull docker://quay.io/biocontainers/vadr:1.6.4--pl5321h031d066_0 quay.io-biocontainers-vadr-1.6.4--pl5321h031d066_0.img

Apptainer exec does not have the vadr module in the PERL5LIB env var:

$ apptainer exec quay.io-biocontainers-vadr-1.6.4--pl5321h031d066_0.img v-annotate.pl --help

Can't locate vadr.pm in @INC (you may need to install the vadr module) (@INC contains: /usr/local/lib/perl5/5.32/site_perl /usr/local/lib/perl5/site_perl /usr/local/lib/perl5/5.32/vendor_perl /usr/local/lib/perl5/vendor_perl /usr/local/lib/perl5/5.32/core_perl /usr/local/lib/perl5/core_perl .) at /usr/local/bin/v-annotate.pl line 13.

Apptainer run works fine since the activation script that sets the PERL5LIB path is sourced:

$ apptainer run quay.io-biocontainers-vadr-1.6.4--pl5321h031d066_0.img v-annotate.pl --help

# v-annotate.pl :: classify and annotate sequences using a model library
# VADR 1.6.4 (Jun 2024)
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# date:    Fri Sep 20 15:36:33 2024
#
Usage: v-annotate.pl [-options] <fasta file to annotate> <output directory to create>
...

With $ apptainer exec $IMG bash:

Apptainer> echo $PERL5LIB
# empty/not set

With $ apptainer run $IMG:

Apptainer> echo $PERL5LIB
/usr/local/share/vadr-1.6.4/vadr::/usr/local/share/sequip-0.10/lib

The VADR Bioconda build.sh script creates an activation script:

https://github.com/bioconda/bioconda-recipes/blob/dc96225686dbc772fc733265d51a934ac0f050f2/recipes/vadr/build.sh#L57

But it looks like the script is only sourced when running with Conda, Docker or apptainer run.

Maybe a wrapper script that explicitly sets the necessary env vars would help?

cat > $PREFIX/bin/v-annotate <<EOF
#!/bin/bash
source "${PREFIX}/etc/conda/activate.d/vadr.sh"
$PREFIX/bin/v-annotate.pl "\$@"
EOF

chmod +x $PREFIX/bin/v-annotate
@nawrockie
Copy link
Member

@rpetit3 : could you please take a look at this issue? If I'm understand correctly, the fix involves modifying the Bioconda recipe to have the 'exec' command set the PERL5LIB env variable the same way the 'run' command does, but I could be wrong as I'm out of my depth here. Thanks.

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