easybuilders / easybuild-easyconfigs

A collection of easyconfig files that describe which software to build using which build options with EasyBuild.
https://easybuild.io
GNU General Public License v2.0
383 stars 703 forks source link

Creating easyconfig for Phantompeakqualtools #15772

Closed VictorGoitea closed 2 years ago

VictorGoitea commented 2 years ago

Hi,

I was trying to create an easyconfig for this tool:

I read the tutorials, all the info on Easybuild website, and I tried my best, but it is not working yet. Maybe you can help me with what I am missing here. Below is the recipe and the last error log file.

My first doubt is about the easyblock selections. It is not clear to me yet the criteria about how to choose the easyblock. Based on others easyconfig files I picked 'Binary'.

Then, the toolchain, I picked {'name': 'foss', 'version': '2021b'} but again I am not sure if it is the right one for this case.

I think I have stated source_urls and sources correctly, at least I found the tar.gz in the folder after the failed installation and I stopped getting the error about this when I was setting these variables differently.

Anyway, I realized that any of the dependencies R-bundle-Bioconductor nor R-4.2.0 include the r package "spp". Do you think it would be possible to include that here or must it be done in the R-4.2.0 eb file?

I provided spp to R in provisory way just to try to continue with the installation, but it still fails at the sanity check instance, even though I did not include a sanity check in the eb file because run_spp.R seems not to have a --help optional argument. Do you

What Sanity check failed: no (non-empty) directory found at 'bin' means? Seems to me that it complains that the folder already exists, but I make sure to delete the folder at Phantompeakqualtools at /work/easybuild/software/Phantompeakqualtools every time before trying again (and with --rebuild)

# This file is an EasyBuild reciPY as per https://github.com/easybuilders/easybuild

easyblock = 'Binary'

name = 'Phantompeakqualtools'
version = '1.2.2'

homepage = "https://github.com/kundajelab/phantompeakqualtools"

description = """ It computes informative enrichment and quality measures for ChIP-seq/DNase-seq/FAIRE-seq/MNase-seq data."""

toolchain = {'name': 'foss', 'version': '2021b'}

source_urls = ['https://github.com/kundajelab/phantompeakqualtools/archive/refs/tags']
sources = ['1.2.2.tar.gz']
checksums = ['b31263b64aefe97bdc4d7fae138f515a7d7a60cd05031d38dd89a10f9ee10cd1']

dependencies = [
    ('R', '4.2.0'),
    ('SAMtools', '1.15.1'),
    ('R-bundle-Bioconductor', '3.15', '-R-4.2.0'),
]

moduleclass = 'bio'

Last lines of the Error log file:

== 2022-06-27 11:34:18,969 environment.py:91 INFO Environment variable EBVARSCALAPACK_STATIC_LIBS set to libscalapack.a,libflexiblas.a,libgfortran.a (previously undefined)
== 2022-06-27 11:34:18,971 build_log.py:169 ERROR EasyBuild crashed with an error (at easybuild/software/EasyBuild/4.5.5/lib/python3.10/site-packages/easybuild/base/exceptions.py:124 in __init__): Sanity check failed: no (non-empty) directory found at 'bin' in /work/easybuild/software/Phantompeakqualtools/1.2.2-foss-2021b
no (non-empty) directory found at 'lib' or 'lib64' in /work/easybuild/software/Phantompeakqualtools/1.2.2-foss-2021b (at easybuild/software/EasyBuild/4.5.5/lib/python3.10/site-packages/easybuild/framework/easyblock.py:3461 in _sanity_check_step)
== 2022-06-27 11:34:18,972 build_log.py:265 INFO ... (took 7 secs)
== 2022-06-27 11:34:18,972 filetools.py:1983 INFO Removing lock /work/easybuild/software/.locks/_work_easybuild_software_Phantompeakqualtools_1.2.2-foss-2021b.lock...
== 2022-06-27 11:34:18,974 filetools.py:382 INFO Path /work/easybuild/software/.locks/_work_easybuild_software_Phantompeakqualtools_1.2.2-foss-2021b.lock successfully removed.
== 2022-06-27 11:34:18,974 filetools.py:1987 INFO Lock removed: /work/easybuild/software/.locks/_work_easybuild_software_Phantompeakqualtools_1.2.2-foss-2021b.lock
== 2022-06-27 11:34:18,974 easyblock.py:4079 WARNING build failed (first 300 chars): Sanity check failed: no (non-empty) directory found at 'bin' in /work/easybuild/software/Phantompeakqualtools/1.2.2-foss-2021b
no (non-empty) directory found at 'lib' or 'lib64' in /work/easybuild/software/Phantompeakqualtools/1.2.2-foss-2021b
== 2022-06-27 11:34:18,975 easyblock.py:318 INFO Closing log for application name Phantompeakqualtools version 1.2.2

It would be nice to have an easyconfig recipe for this tool. Thanks in advance for help :)

jfgrimm commented 2 years ago

@VictorGoitea first off, welcome to EasyBuild!

My first doubt is about the easyblock selections. It is not clear to me yet the criteria about how to choose the easyblock. Based on others easyconfig files I picked 'Binary'.

The easyblocks encapsulate different build/installation procedures that are common. The Binary easyblock is designed to copy a prebuilt binary to the installation directory. Looking at the the phantompeakqualtools repository, the installation consists of:

  1. providing the necessary dependencies (R, SAMtools, spp etc.)
  2. copying the run_spp.R (and LICENSE, README.md) files to the installation directory, and ensuring the script is in $PATH As such, I would probably go for the Tarball easyblock, which simply unpacks a tarball and copies it to the installation directory. Before installing, we should also remove the spp tarball that is shipped:
    preinstall_cmd = "rm spp-1.14.tar.gz"

Anyway, I realized that any of the dependencies R-bundle-Bioconductor nor R-4.2.0 include the r package "spp". Do you think it would be possible to include that here or must it be done in the R-4.2.0 eb file?

Since phantompeakqualtools requires an older version of spp than the latest release (according to the documentation, 1.14 or 1.15.x, whereas the latest available is 1.16.0 ), I would actually install spp as part of the phantompeakqualtools package, as an extension. To do this, add something like this to the easyconfig:

exts_defaultclass = 'RPackage'
exts_default_options = {
    'source_urls': [
        'https://cran.r-project.org/src/contrib/Archive/%(name)s',  # package archive
        'https://cran.r-project.org/src/contrib/',      # current version of packages
        'https://cran.freestatistics.org/src/contrib',  # mirror alternative for current packages
    ],
    'source_tmpl': '%(name)s_%(version)s.tar.gz',
}

exts_list = [
    # phantompeakqualtools requires spp 1.14 or 1.15.x (1.16 is not supported)
    ('spp', '1.15.5', {
        'checksums': ['1c486792ac3feb194c95efe7a8a98eab4331877ba901d774561b8839c958f924'],
    }),
]

I provided spp to R in provisory way just to try to continue with the installation, but it still fails at the sanity check instance, even though I did not include a sanity check in the eb file because run_spp.R seems not to have a --help optional argument.

We should explicitly add a check that run_spp.R is in the installation directory, and add it to PATH (given relative to installdir):

modextrapaths = {'PATH': ''}

sanity_check_paths = {
    'files': ['run_spp.R'],
    'dirs': [],
}

Adding a sanity check command is nice to do where possible; in this case, since it does not accept --help or --version. The workaround for this is often something like:

sanity_check_commands = ['run_spp.R | grep "Usage: Rscript run_spp.R <options>"']

On another note, please consider making a pull request for phantompeakqualtools (even if you haven't ironed out all the issues, we're happy to help)

VictorGoitea commented 2 years ago

Thanks @jfgrimm. I created the pull request #15871 . The easyconfig is still not working. Somehow there is conflict with the line preinstall_cmd = "rm spp-1.14.tar.gz". Maybe you can take a look.

Micket commented 2 years ago

I believe this can be closed now?