Image size: 169.9 MB

For more on pulling from the registry, see the ilifu documentation.

First, once: add the registry and make it your default

singularity remote add --no-login idia-registry https://sregistry.idia.ac.za
singularity remote use idia-registry

If you added it before, as the ilifu docs describe, remote add says it already exists: just run remote use.

Log in, for a private collection

singularity remote login idia-registry

Paste a token from your token page when asked. Public collections need no login.

Pull the container

singularity pull library://bioinformatics/verkko-fillet:0.1.28

Shell into the container

singularity shell library://bioinformatics/verkko-fillet:0.1.28

Run the container

singularity run library://bioinformatics/verkko-fillet:0.1.28

First, once: add the registry and make it your default

apptainer remote add --no-login idia-registry https://sregistry.idia.ac.za
apptainer remote use idia-registry

If you added it before, as the ilifu docs describe, remote add says it already exists: just run remote use.

Log in, for a private collection

apptainer remote login idia-registry

Paste a token from your token page when asked. Public collections need no login.

Pull the container

apptainer pull library://bioinformatics/verkko-fillet:0.1.28

Shell into the container

apptainer shell library://bioinformatics/verkko-fillet:0.1.28

Run the container

apptainer run library://bioinformatics/verkko-fillet:0.1.28
verkko-fillet 0.1.28 by Juhyun Kim and the verkko-fillet contributors (https://github.com/marbl/verkko-fillet).

This image packages the unmodified upstream 0.1.28 release (the verkkofillet wheel from
PyPI). IDIA builds and maintains the image only; report verkko-fillet bugs upstream
(https://github.com/marbl/verkko-fillet/issues). Report image problems to
support@ilifu.ac.za.

verkko-fillet is a Python toolkit for cleaning and gap-filling Verkko assemblies, used
mainly from Python or Jupyter. The default runscript is the image's Python:
  singularity run verkko-fillet_0.1.28.sif -c 'import verkkofillet as vf'
  singularity run --bind /path/to/verkko_run verkko-fillet_0.1.28.sif my_curation.py
  singularity exec verkko-fillet_0.1.28.sif samtools faidx assembly.fasta

To use it as a Jupyter kernel, make ~/.local/share/jupyter/kernels/verkko-fillet/kernel.json:
  {"display_name": "verkko-fillet 0.1.28", "language": "python",
   "argv": ["singularity", "exec", "/path/to/verkko-fillet_0.1.28.sif",
            "python", "-m", "ipykernel_launcher", "-f", "{connection_file}"]}

Included and on PATH: verkkofillet's own scripts (site-packages/verkkofillet/bin) and the
external tools it calls: samtools 1.25, bgzip/tabix/htsfile (htslib 1.25), seqtk 1.5,
MashMap 3.1.3, bedtools 2.31.1, meryl 1.4.2 (meryl, meryl-lookup) and minimap2 2.31.
Not included, so these parts won't work: Java (telomere detection, e.g.
detect_internal_telomere), gnuplot (dot plots), GraphAligner (graphAlign; pass your own
via GraphAligner_path), verkko itself (screenAssembly), seqkit, mash, R (svbyeye.r) and
Slurm (the sbatch-based meryl helpers). No reference data or databases are included;
bind your Verkko run and references with --bind.

Licence: verkko-fillet is MIT (/opt/verkko-fillet/LICENSE). The bundled tools' licences
are in /opt/tools/licenses/: samtools, htslib, seqtk, bedtools and minimap2 are MIT;
MashMap and meryl are US Government public-domain works with some third-party code
under their own terms.

Citation: Kim J, et al. Finishing a complete giraffe genome from telomere to telomere
with Verkko-Fillet. Cell Genomics 6(8) (2026). Please also cite the tools you use
(samtools, MashMap, seqtk, bedtools, meryl/Merqury, minimap2).

This image has 6 apps. Pick one to see how to use it.

singularity run --app bedtools library://bioinformatics/verkko-fillet:0.1.28

This works once you've added the registry as a remote (see the CLI tab). Add the app's arguments after the command. With Apptainer, start it with apptainer instead.

Help

bedtools 2.31.1, for interval arithmetic on BED/GFF/VCF/BAM files (intersect, merge,
sort, complement...). Only the main bedtools binary is installed, so use the
subcommand form (bedtools intersect), not the old intersectBed-style names.

  singularity run --app bedtools verkko-fillet_0.1.28.sif merge -i telomere.sorted.bed -c 4 -o max > telomere.merged.bed

Docs: https://bedtools.readthedocs.io/

Runs

exec bedtools "$@"
singularity run --app mashmap library://bioinformatics/verkko-fillet:0.1.28

This works once you've added the registry as a remote (see the CLI tab). Add the app's arguments after the command. With Apptainer, start it with apptainer instead.

Help

MashMap 3.1.3 estimates local alignment boundaries and identity between long
sequences without computing base-level alignments; verkko-fillet uses it to assign
contigs to reference chromosomes. Output is PAF, written to mashmap.out in the current
directory unless you give -o. mashmap-align is also included (singularity exec).

  singularity run --app mashmap verkko-fillet_0.1.28.sif -r reference.fasta -q assembly.fasta --pi 95 -s 10000 -f one-to-one -t 8 -o assembly.mashmap.out

Docs: https://github.com/marbl/MashMap

Runs

exec mashmap "$@"
singularity run --app meryl library://bioinformatics/verkko-fillet:0.1.28

This works once you've added the registry as a remote (see the CLI tab). Add the app's arguments after the command. With Apptainer, start it with apptainer instead.

Help

meryl 1.4.2 counts k-mers and combines k-mer databases (union, intersect, subtract,
histogram...), e.g. for Merqury-style QV and completeness checks. A meryl database is a
directory. meryl-lookup is also included (singularity exec).

  singularity run --app meryl verkko-fillet_0.1.28.sif count k=21 threads=8 memory=32 reads.fastq.gz output reads.meryl

Docs: https://github.com/marbl/meryl

Runs

exec meryl "$@"
singularity run --app python library://bioinformatics/verkko-fillet:0.1.28

This works once you've added the registry as a remote (see the CLI tab). Add the app's arguments after the command. With Apptainer, start it with apptainer instead.

Help

The image's Python 3.13, the same as the default runscript, with verkko-fillet
installed: import verkkofillet as vf (vf.pp, vf.tl and vf.pl for preprocessing, tools
and plots). pandas, matplotlib, seaborn, scikit-learn and ipykernel are importable too,
and the bundled tools are on PATH for the functions that call them. verkkofillet
prints its version when imported.

  singularity run --app python --bind /path/to/verkko_run verkko-fillet_0.1.28.sif my_curation.py

Docs: https://verkko-fillet.readthedocs.io/

Runs

exec python "$@"
singularity run --app samtools library://bioinformatics/verkko-fillet:0.1.28

This works once you've added the registry as a remote (see the CLI tab). Add the app's arguments after the command. With Apptainer, start it with apptainer instead.

Help

samtools 1.25, for indexing, sorting and querying FASTA and SAM/BAM/CRAM files.
bgzip, tabix and htsfile (htslib 1.25) are also included; run them with
singularity exec. Built without libcurl, so only local files work (no http://, s3://
or gs:// paths).

  singularity run --app samtools verkko-fillet_0.1.28.sif faidx assembly.fasta

Docs: https://www.htslib.org/doc/samtools.html

Runs

exec samtools "$@"
singularity run --app seqtk library://bioinformatics/verkko-fillet:0.1.28

This works once you've added the registry as a remote (see the CLI tab). Add the app's arguments after the command. With Apptainer, start it with apptainer instead.

Help

seqtk 1.5, a fast FASTA/FASTQ toolkit: format conversion, subsampling, trimming,
and gap and telomere finding (verkko-fillet's T2T detection uses seqtk gap and
seqtk telo). This finds telomeric repeats (motif CCCTAA) at contig ends:

  singularity run --app seqtk verkko-fillet_0.1.28.sif telo -m CCCTAA -d 50000 assembly.fasta > assembly.telomere.bed

Docs: https://github.com/lh3/seqtk

Runs

exec seqtk "$@"
Bootstrap: docker
From: python:3.13-slim-trixie
Stage: build

%post
  export VERKKOFILLET_VERSION=0.1.28
  export VERKKOFILLET_WHEEL_SHA256=9a0e8d3a26314775e70dbcd62cda94ef1d8b839f4438df10e68eb05659845fcc
  export VERKKOFILLET_LICENSE_SHA256=98cb8f4d1a93b17f76f9f4d65308b18ac2fb9fea8faebe6cf0a08b375e8d911a
  export UV_VERSION=0.13.7
  export UV_SHA256=c5221ff41b7892bfc223543883600125f6a47fe845093e0f5bdff4f359196d83
  export SAMTOOLS_VERSION=1.25
  export SAMTOOLS_SHA256=8bbd2b3cb447953149a74ab0b00e3ec4e88a789a27b8373a31fa6b5b2dee02b1
  export SEQTK_VERSION=1.5
  export SEQTK_SHA256=384aa1e3cecf4f70403839d586cbb29d469b7c6f773a64bc5af48a6e4b8220a6
  export MASHMAP_VERSION=3.1.3
  export MASHMAP_SHA256=7719dd6b3c25e650e16218252eaae7dbf424a10890d717ec3ad0920b102fd05a
  export BEDTOOLS_VERSION=2.31.1
  export BEDTOOLS_SHA256=fc7e660c2279b1e008b80aca0165a4a157daf4994d08a533ee925d73ce732b97
  export MERYL_VERSION=1.4.2
  export MERYL_SHA256=01a9994d72d2610fee01966ccd554592a877f554ea0804fd0c64fb8a533fc825
  export MINIMAP2_VERSION=2.31
  export MINIMAP2_SHA256=300bc287f05eb890c6211fa7db043ce98320a401621fadd1cfdbeabd1a6e4ab5
  export DEBIAN_FRONTEND=noninteractive

  apt-get update -y
  apt-get install -y --no-install-recommends \
    bzip2 \
    ca-certificates \
    cmake \
    curl \
    g++ \
    gcc \
    libbz2-dev \
    libcurl4-openssl-dev \
    libgsl-dev \
    liblzma-dev \
    libssl-dev \
    make \
    perl \
    pkg-config \
    xz-utils \
    zlib1g-dev

  mkdir -p /tmp/src /opt/tools/bin /opt/tools/licenses
  cd /tmp/src || exit 1

  curl -fsSL -o "verkkofillet-${VERKKOFILLET_VERSION}-py3-none-any.whl" \
    "https://files.pythonhosted.org/packages/4a/3f/f9c3e3bed0d9df262628e3c70e5c97f19210026a1d753adefd954b7c54bc/verkkofillet-${VERKKOFILLET_VERSION}-py3-none-any.whl"
  curl -fsSL -o verkko-fillet-LICENSE \
    "https://raw.githubusercontent.com/marbl/verkko-fillet/v${VERKKOFILLET_VERSION}/LICENSE"
  curl -fsSL -o "uv-${UV_VERSION}.tar.gz" \
    "https://github.com/astral-sh/uv/releases/download/${UV_VERSION}/uv-x86_64-unknown-linux-gnu.tar.gz"
  curl -fsSL -o "samtools-${SAMTOOLS_VERSION}.tar.bz2" \
    "https://github.com/samtools/samtools/releases/download/${SAMTOOLS_VERSION}/samtools-${SAMTOOLS_VERSION}.tar.bz2"
  curl -fsSL -o "seqtk-${SEQTK_VERSION}.tar.gz" \
    "https://github.com/lh3/seqtk/archive/refs/tags/v${SEQTK_VERSION}.tar.gz"
  curl -fsSL -o "MashMap-${MASHMAP_VERSION}.tar.gz" \
    "https://github.com/marbl/MashMap/archive/refs/tags/v${MASHMAP_VERSION}.tar.gz"
  curl -fsSL -o "bedtools-${BEDTOOLS_VERSION}.tar.gz" \
    "https://github.com/arq5x/bedtools2/releases/download/v${BEDTOOLS_VERSION}/bedtools-${BEDTOOLS_VERSION}.tar.gz"
  curl -fsSL -o "meryl-${MERYL_VERSION}.tar.xz" \
    "https://github.com/marbl/meryl/releases/download/v${MERYL_VERSION}/meryl-${MERYL_VERSION}.tar.xz"
  curl -fsSL -o "minimap2-${MINIMAP2_VERSION}_x64-linux.tar.bz2" \
    "https://github.com/lh3/minimap2/releases/download/v${MINIMAP2_VERSION}/minimap2-${MINIMAP2_VERSION}_x64-linux.tar.bz2"

  cat > SHA256SUMS <<EOF
${VERKKOFILLET_WHEEL_SHA256}  verkkofillet-${VERKKOFILLET_VERSION}-py3-none-any.whl
${VERKKOFILLET_LICENSE_SHA256}  verkko-fillet-LICENSE
${UV_SHA256}  uv-${UV_VERSION}.tar.gz
${SAMTOOLS_SHA256}  samtools-${SAMTOOLS_VERSION}.tar.bz2
${SEQTK_SHA256}  seqtk-${SEQTK_VERSION}.tar.gz
${MASHMAP_SHA256}  MashMap-${MASHMAP_VERSION}.tar.gz
${BEDTOOLS_SHA256}  bedtools-${BEDTOOLS_VERSION}.tar.gz
${MERYL_SHA256}  meryl-${MERYL_VERSION}.tar.xz
${MINIMAP2_SHA256}  minimap2-${MINIMAP2_VERSION}_x64-linux.tar.bz2
EOF
  sha256sum -c SHA256SUMS || exit 1

  # --- verkkofillet: a venv built with uv (uv itself stays in this stage) ---
  # The wheel declares no dependencies (upstream's requirements.txt is a pip freeze, so
  # it isn't used). These are verkkofillet's third-party imports, pinned exactly with
  # their full dependency closure for CPython 3.13 on x86_64 manylinux, all as wheels.
  # Each pin carries the sha256 of every PyPI wheel usable here, and --require-hashes
  # makes uv reject any download that doesn't match (the verkkofillet wheel itself was
  # checked by sha256sum above).
  tar xzf "uv-${UV_VERSION}.tar.gz"
  UV=/tmp/src/uv-x86_64-unknown-linux-gnu/uv
  export UV_NO_CACHE=1 UV_PYTHON_DOWNLOADS=never UV_LINK_MODE=copy
  "$UV" venv --python /usr/local/bin/python3.13 /opt/verkko-fillet
  cat > requirements.txt <<'EOF'
asttokens==3.0.2 \
    --hash=sha256:9da13157f5b28becde0bd374fc677dcd3c290614264eff096f167c469cd9f933
biopython==1.87 \
    --hash=sha256:6d221b2e08e7e89713fdbfb15c8ea6744e908d59f672cd2b6fcf9ed47910d05e
cloudpickle==3.1.2 \
    --hash=sha256:9acb47f6afd73f60dc1df93bb801b472f05ff42fa6c84167d25cb206be1fbf4a
comm==0.2.3 \
    --hash=sha256:c615d91d75f7f04f095b30d1c1711babd43bdc6419c1be9886a85f2f4e489417
contourpy==1.4.0 \
    --hash=sha256:f1219a8898523cba821085f2da8a1b962cc696325763f09d7f93538ba43b2d70
cycler==0.12.1 \
    --hash=sha256:85cef7cff222d8644161529808465972e51340599459b8ac3ccbac5a854e0d30
debugpy==1.8.22 \
    --hash=sha256:a9e9d3550e15ca479c59333e90845029190531f0cacfedab3b815a57bd913947 \
    --hash=sha256:c1ffb9953708b648ecf6acd2e5ad2c002bf68785ed618197dd4463a2a7226f39
decorator==5.3.1 \
    --hash=sha256:f47fe6fdbd2edd623ecfe36875d37aba411624e2670dd395dddae1358689bb3c
executing==2.3.0 \
    --hash=sha256:736e859c9f8701f11fcf516856f26f562e04776387824b43a35a1dfe21c84122
fonttools==4.68.0 \
    --hash=sha256:08851f7d2b983412f490b73a7c56f17cbda1d4d85d2ad3f857564bf15b5d9475 \
    --hash=sha256:d76f8fdcb6936f5e1045a0c9dd721a4bf11112e60d1e243bfa1d39f06a8b3104
ipykernel==7.3.0 \
    --hash=sha256:897eb64da762549ef610698fca5e9675195ec6ac8ec7f19d81ce1ca20c876057
ipython==9.15.0 \
    --hash=sha256:515ad9c3cdf0c932a5a9f6245419e8aba706b7bd03c3e1d3a1c83d9351d6aa6e
ipython-pygments-lexers==1.1.1 \
    --hash=sha256:a9462224a505ade19a605f71f8fa63c2048833ce50abc86768a0d81d876dc81c
jedi==0.20.1 \
    --hash=sha256:0fb16d86c4a4c73c37ba518c77419975e30fcc620658a8d14fbb5720cdd34142
joblib==1.6.0 \
    --hash=sha256:3dbbf9f6e4b592a2357b854608e980fe6390d131d7a82f011a377ef2ebef7aba
jupyter-client==8.10.0 \
    --hash=sha256:5f73f24f22fa25192cfff6b23c051932a2473a797b05734aff495b392103e14e
jupyter-core==5.9.1 \
    --hash=sha256:ebf87fdc6073d142e114c72c9e29a9d7ca03fad818c5d300ce2adc1fb0743407
kiwisolver==1.5.1 \
    --hash=sha256:74ad5c3dad54a4641b4c28cd15ded70899d04459c6c7aeacafea716be97cce6d
matplotlib==3.11.1 \
    --hash=sha256:b0a19dcf73406d3746d25a5ed42d713604c9a3e024d129b102852b0d941cb9f3
matplotlib-inline==0.2.2 \
    --hash=sha256:3c821cf1c209f59fb2d2d64abbf5b23b67bcb2210d663f9918dd851c6da1fcf6
narwhals==2.28.0 \
    --hash=sha256:1f69d6385ec30e2fa6e1fdeb37c562ecabd0f713f6f3e3b58a668c5c9df9567f
natsort==8.4.0 \
    --hash=sha256:4732914fb471f56b5cce04d7bae6f164a592c7712e1c85f9ef585e197299521c
nest-asyncio2==1.7.4 \
    --hash=sha256:86e77b52c3d1496b294af3c944b44213b9b82a12a5ee590c0acc4ca4692ef6c7
networkx==3.6.1 \
    --hash=sha256:d47fbf302e7d9cbbb9e2555a0d267983d2aa476bac30e90dfbe5669bd57f3762
numpy==2.5.1 \
    --hash=sha256:9726558e8db4a5bf7929a70ae50f63abda4daf0efe810e3bfbab95976f75fc1a
packaging==26.2 \
    --hash=sha256:5fc45236b9446107ff2415ce77c807cee2862cb6fac22b8a73826d0693b0980e
pandas==3.0.3 \
    --hash=sha256:a4eeb6830daf35a71cc09649bd823e2b542dac246cdee9614c6e4bd65028cd6a
parso==0.8.7 \
    --hash=sha256:a8926eb2a1b915486941fdbd31e86a4baf88fe8c210f25f2f35ecec5b574ca1c
pexpect==4.9.0 \
    --hash=sha256:7236d1e080e4936be2dc3e326cec0af72acf9212a7e1d060210e70a47e253523
pillow==12.3.0 \
    --hash=sha256:0847a763afefb695bc912d7c131e7e0632d4edc1d8698f58ddabec8e46b8b6d3
platformdirs==4.14.5 \
    --hash=sha256:8e778c6fa421516f4d3369449f8df3b0e1b72c0e0005fe88e3ec772d0a14e750
plotly==6.9.0 \
    --hash=sha256:36bebe2f1bb13884774fe61689c329071446f6ce4a8927fb1f0d6fb24f581236
prompt-toolkit==3.0.53 \
    --hash=sha256:01c0891d7f9237d5e339f7d3e42cdae80b7534abb1c7c0e3352efba6231492f2
psutil==7.2.2 \
    --hash=sha256:076a2d2f923fd4821644f5ba89f059523da90dc9014e85f8e45a5774ca5bc6f9
ptyprocess==0.7.0 \
    --hash=sha256:4b41f3967fce3af57cc7e94b888626c18bf37a083e3651ca8feeb66d492fef35
pure-eval==0.2.4 \
    --hash=sha256:96cae060a313cfaad51bb761278bfb0e62dc0248d9315a81173752dc546cd37a
pygments==2.21.0 \
    --hash=sha256:2363c69b61c4a97c838da3b130dcd6468f4848992b21a82f2a63ec34377137d9
pyparsing==3.3.3 \
    --hash=sha256:ece8c00a69cf01b45d0b1dedabb469c90d8caf996d4fda40f147627a122849a4
python-dateutil==4.0.0 \
    --hash=sha256:a5e246f79eb80475e691bf93862cead98decd8a498cf53ba0516fcdc0f50dc1c
pyzmq==27.3.0 \
    --hash=sha256:858fe25231e0fd8612da142efde019faa5ef63fa150a821a27870e791b38c798
scikit-learn==1.9.0 \
    --hash=sha256:da76d09304a4706db7cc1e3ebaa3b6b98a67365cc11d2996c4f1e58ba47df714
scipy==1.18.1 \
    --hash=sha256:fdaf5ea890a6183d0565f51a61799d67081bd5b1cf03c5f4b3fd3732108625c9
seaborn==0.13.2 \
    --hash=sha256:636f8336facf092165e27924f223d3c62ca560b1f2bb5dff7ab7fad265361987
session-info==1.0.1 \
    --hash=sha256:451d191e51816070b9f21a6ff3f6eb5d6015ae2738e8db63ac4e6398260a5838
stack-data==0.6.3 \
    --hash=sha256:d5558e0c25a4cb0853cddad3d77da9891a08cb85dd9f9f91b9f8cd66e511e695
stdlib-list==0.12.0 \
    --hash=sha256:df2d11e97f53812a1756fb5510393a11e3b389ebd9239dc831c7f349957f62f2
threadpoolctl==3.8.0 \
    --hash=sha256:f1b49c82704d50f13ffae019c727b0fa4f6791a58f48f06a09c45face1be66da
tornado==6.6.1 \
    --hash=sha256:1b6ff57cc69b339f8feb9e7b567b0e0eacb16bfaf234159496623ef7a67ba640
tqdm==4.69.0 \
    --hash=sha256:9979978912be667a6ef21fd5d8abf54e324e63d82f7f43c360792ebc2bc4e622
traitlets==5.16.1 \
    --hash=sha256:f775618166caa0396c8e337099240f2bd3e5e917d203b2e6fbe21a58d3cb1f6b
typing-extensions==4.16.0 \
    --hash=sha256:481caa481374e813c1b176ada14e97f1f67a4539ce9cfeb3f350d78d6370c2e8
tzdata==2026.6 \
    --hash=sha256:0a10eec6e13ef16b627fabed9a5f2ba61a62b1c67f327305f4e7e412a70b4aec
wcwidth==0.9.4 \
    --hash=sha256:901eace6d2dd25ebb917d0ce5db18e5c537e1504c905cf32f0d006c12098b05d \
    --hash=sha256:b185c8b927b23af2721be1783499d1cfa5c028b098b0858951b4ae224477f1c2
EOF
  "$UV" pip install --python /opt/verkko-fillet/bin/python --no-deps --no-build \
    --require-hashes -r requirements.txt
  "$UV" pip install --python /opt/verkko-fillet/bin/python --no-deps --no-build \
    "/tmp/src/verkkofillet-${VERKKOFILLET_VERSION}-py3-none-any.whl"
  "$UV" pip check --python /opt/verkko-fillet/bin/python
  cp verkko-fillet-LICENSE /opt/verkko-fillet/LICENSE

  # --- samtools, with bgzip/tabix/htsfile from its bundled (identical) htslib ---
  # Both link htslib statically. Remote file access (libcurl, S3, GCS) is left out.
  tar xjf "samtools-${SAMTOOLS_VERSION}.tar.bz2"
  cd "samtools-${SAMTOOLS_VERSION}/htslib-${SAMTOOLS_VERSION}" || exit 1
  ./configure --disable-libcurl --disable-gcs --disable-s3 --disable-plugins
  make -j "$(nproc)" lib-static bgzip tabix htsfile
  cp bgzip tabix htsfile /opt/tools/bin/
  mkdir -p /opt/tools/licenses/htslib
  cp LICENSE /opt/tools/licenses/htslib/LICENSE
  cd .. || exit 1
  ./configure --with-htslib="htslib-${SAMTOOLS_VERSION}" --without-curses
  make -j "$(nproc)" samtools
  cp samtools /opt/tools/bin/
  mkdir -p /opt/tools/licenses/samtools
  cp LICENSE /opt/tools/licenses/samtools/LICENSE
  cd /tmp/src || exit 1

  # --- seqtk ---
  tar xzf "seqtk-${SEQTK_VERSION}.tar.gz"
  cd "seqtk-${SEQTK_VERSION}" || exit 1
  make
  cp seqtk /opt/tools/bin/
  mkdir -p /opt/tools/licenses/seqtk
  cp LICENSE /opt/tools/licenses/seqtk/LICENSE
  cd /tmp/src || exit 1

  # --- MashMap: upstream defaults to -march=native, which is turned off here ---
  tar xzf "MashMap-${MASHMAP_VERSION}.tar.gz"
  cd "MashMap-${MASHMAP_VERSION}" || exit 1
  cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DOPTIMIZE_FOR_NATIVE=OFF -DSKIP_VERSION_FILE=ON
  cmake --build build -j "$(nproc)"
  cp build/bin/mashmap build/bin/mashmap-align /opt/tools/bin/
  mkdir -p /opt/tools/licenses/mashmap
  cp LICENSE.txt /opt/tools/licenses/mashmap/LICENSE.txt
  cd /tmp/src || exit 1

  # --- bedtools: only the main binary (the legacy *Bed wrappers aren't built) ---
  # The -Wno-error flags only stop GCC 14 rejecting old C in bedtools' bundled htslib.
  # NOTE: bedtools, MashMap and meryl haven't been built with trixie's GCC 14 before;
  # CI is the first build. If bedtools fails, add the GCC 14 errors it reports to CFLAGS
  # or switch to upstream's static bedtools binary (sha256-pinned like the rest).
  tar xzf "bedtools-${BEDTOOLS_VERSION}.tar.gz"
  cd bedtools2 || exit 1
  make -j "$(nproc)" \
    CFLAGS="-g -Wall -O2 -Wno-error=implicit-function-declaration -Wno-error=incompatible-pointer-types -Wno-error=int-conversion" \
    bin/bedtools
  cp bin/bedtools /opt/tools/bin/
  mkdir -p /opt/tools/licenses/bedtools
  cp LICENSE /opt/tools/licenses/bedtools/LICENSE
  cd /tmp/src || exit 1

  # --- meryl: built from source, as upstream's Linux binary needs CentOS 7's OpenSSL ---
  tar xJf "meryl-${MERYL_VERSION}.tar.xz"
  cd "meryl-${MERYL_VERSION}/src" || exit 1
  make -j "$(nproc)" BUILDOPTIMIZED=1
  cd .. || exit 1
  cp build/bin/meryl build/bin/meryl-lookup /opt/tools/bin/
  mkdir -p /opt/tools/licenses/meryl
  cp README.licenses /opt/tools/licenses/meryl/README.licenses
  cd /tmp/src || exit 1

  # --- minimap2: upstream's prebuilt x86_64 binary ---
  tar xjf "minimap2-${MINIMAP2_VERSION}_x64-linux.tar.bz2"
  cp "minimap2-${MINIMAP2_VERSION}_x64-linux/minimap2" /opt/tools/bin/
  mkdir -p /opt/tools/licenses/minimap2
  cp "minimap2-${MINIMAP2_VERSION}_x64-linux/LICENSE.txt" /opt/tools/licenses/minimap2/LICENSE.txt

  strip /opt/tools/bin/*
  find /opt/verkko-fillet -name __pycache__ -type d -prune -exec rm -rf {} +

  cd / || exit 1
  rm -rf /tmp/src

Bootstrap: docker
From: python:3.13-slim-trixie
Stage: final

%files from build
  /opt/verkko-fillet /opt/verkko-fillet
  /opt/tools /opt/tools

%post
  export DEBIAN_FRONTEND=noninteractive
  # Runtime libraries for the compiled tools (MashMap: GSL; meryl: OpenMP, libcurl) and
  # for verkkofillet's bundled C++ helpers. bash and perl-base are already in the base.
  apt-get update -y
  apt-get install -y --no-install-recommends \
    libbz2-1.0 \
    libcurl4t64 \
    libgomp1 \
    libgsl28 \
    libgslcblas0 \
    liblzma5 \
    libstdc++6 \
    zlib1g
  apt-get clean
  rm -rf /var/lib/apt/lists/* /var/cache/apt/*

%environment
  export PATH=/opt/verkko-fillet/lib/python3.13/site-packages/verkkofillet/bin:/opt/verkko-fillet/bin:/opt/tools/bin:$PATH

%labels
  Maintainer IDIA <support@ilifu.ac.za>
  Version 0.1.28
  Source https://github.com/marbl/verkko-fillet
  License MIT (verkko-fillet); bundled tools: samtools/htslib, seqtk, bedtools, minimap2 MIT; MashMap and meryl public domain (US Government work) with third-party parts
  Authors Juhyun Kim and the verkko-fillet contributors

%help
  verkko-fillet 0.1.28 by Juhyun Kim and the verkko-fillet contributors (https://github.com/marbl/verkko-fillet).

  This image packages the unmodified upstream 0.1.28 release (the verkkofillet wheel from
  PyPI). IDIA builds and maintains the image only; report verkko-fillet bugs upstream
  (https://github.com/marbl/verkko-fillet/issues). Report image problems to
  support@ilifu.ac.za.

  verkko-fillet is a Python toolkit for cleaning and gap-filling Verkko assemblies, used
  mainly from Python or Jupyter. The default runscript is the image's Python:
    singularity run verkko-fillet_0.1.28.sif -c 'import verkkofillet as vf'
    singularity run --bind /path/to/verkko_run verkko-fillet_0.1.28.sif my_curation.py
    singularity exec verkko-fillet_0.1.28.sif samtools faidx assembly.fasta

  To use it as a Jupyter kernel, make ~/.local/share/jupyter/kernels/verkko-fillet/kernel.json:
    {"display_name": "verkko-fillet 0.1.28", "language": "python",
     "argv": ["singularity", "exec", "/path/to/verkko-fillet_0.1.28.sif",
              "python", "-m", "ipykernel_launcher", "-f", "{connection_file}"]}

  Included and on PATH: verkkofillet's own scripts (site-packages/verkkofillet/bin) and the
  external tools it calls: samtools 1.25, bgzip/tabix/htsfile (htslib 1.25), seqtk 1.5,
  MashMap 3.1.3, bedtools 2.31.1, meryl 1.4.2 (meryl, meryl-lookup) and minimap2 2.31.
  Not included, so these parts won't work: Java (telomere detection, e.g.
  detect_internal_telomere), gnuplot (dot plots), GraphAligner (graphAlign; pass your own
  via GraphAligner_path), verkko itself (screenAssembly), seqkit, mash, R (svbyeye.r) and
  Slurm (the sbatch-based meryl helpers). No reference data or databases are included;
  bind your Verkko run and references with --bind.

  Licence: verkko-fillet is MIT (/opt/verkko-fillet/LICENSE). The bundled tools' licences
  are in /opt/tools/licenses/: samtools, htslib, seqtk, bedtools and minimap2 are MIT;
  MashMap and meryl are US Government public-domain works with some third-party code
  under their own terms.

  Citation: Kim J, et al. Finishing a complete giraffe genome from telomere to telomere
  with Verkko-Fillet. Cell Genomics 6(8) (2026). Please also cite the tools you use
  (samtools, MashMap, seqtk, bedtools, meryl/Merqury, minimap2).

%runscript
  exec python "$@"

%apprun python
  exec python "$@"

%apphelp python
  The image's Python 3.13, the same as the default runscript, with verkko-fillet
  installed: import verkkofillet as vf (vf.pp, vf.tl and vf.pl for preprocessing, tools
  and plots). pandas, matplotlib, seaborn, scikit-learn and ipykernel are importable too,
  and the bundled tools are on PATH for the functions that call them. verkkofillet
  prints its version when imported.

    singularity run --app python --bind /path/to/verkko_run verkko-fillet_0.1.28.sif my_curation.py

  Docs: https://verkko-fillet.readthedocs.io/

%apprun samtools
  exec samtools "$@"

%apphelp samtools
  samtools 1.25, for indexing, sorting and querying FASTA and SAM/BAM/CRAM files.
  bgzip, tabix and htsfile (htslib 1.25) are also included; run them with
  singularity exec. Built without libcurl, so only local files work (no http://, s3://
  or gs:// paths).

    singularity run --app samtools verkko-fillet_0.1.28.sif faidx assembly.fasta

  Docs: https://www.htslib.org/doc/samtools.html

%apprun seqtk
  exec seqtk "$@"

%apphelp seqtk
  seqtk 1.5, a fast FASTA/FASTQ toolkit: format conversion, subsampling, trimming,
  and gap and telomere finding (verkko-fillet's T2T detection uses seqtk gap and
  seqtk telo). This finds telomeric repeats (motif CCCTAA) at contig ends:

    singularity run --app seqtk verkko-fillet_0.1.28.sif telo -m CCCTAA -d 50000 assembly.fasta > assembly.telomere.bed

  Docs: https://github.com/lh3/seqtk

%apprun mashmap
  exec mashmap "$@"

%apphelp mashmap
  MashMap 3.1.3 estimates local alignment boundaries and identity between long
  sequences without computing base-level alignments; verkko-fillet uses it to assign
  contigs to reference chromosomes. Output is PAF, written to mashmap.out in the current
  directory unless you give -o. mashmap-align is also included (singularity exec).

    singularity run --app mashmap verkko-fillet_0.1.28.sif -r reference.fasta -q assembly.fasta --pi 95 -s 10000 -f one-to-one -t 8 -o assembly.mashmap.out

  Docs: https://github.com/marbl/MashMap

%apprun bedtools
  exec bedtools "$@"

%apphelp bedtools
  bedtools 2.31.1, for interval arithmetic on BED/GFF/VCF/BAM files (intersect, merge,
  sort, complement...). Only the main bedtools binary is installed, so use the
  subcommand form (bedtools intersect), not the old intersectBed-style names.

    singularity run --app bedtools verkko-fillet_0.1.28.sif merge -i telomere.sorted.bed -c 4 -o max > telomere.merged.bed

  Docs: https://bedtools.readthedocs.io/

%apprun meryl
  exec meryl "$@"

%apphelp meryl
  meryl 1.4.2 counts k-mers and combines k-mer databases (union, intersect, subtract,
  histogram...), e.g. for Merqury-style QV and completeness checks. A meryl database is a
  directory. meryl-lookup is also included (singularity exec).

    singularity run --app meryl verkko-fillet_0.1.28.sif count k=21 threads=8 memory=32 reads.fastq.gz output reads.meryl

  Docs: https://github.com/marbl/meryl

%test
  export PATH=/opt/verkko-fillet/lib/python3.13/site-packages/verkkofillet/bin:/opt/verkko-fillet/bin:/opt/tools/bin:$PATH
  workdir=$(mktemp -d) || exit 1
  export MPLCONFIGDIR="$workdir/mpl"

  # verkkofillet prints its version on import.
  python -c 'import verkkofillet' | grep -q 'verkko-fillet version:0.1.28' || exit 1
  [ "$(python -c 'import importlib.metadata as m; print(m.version("verkkofillet"))')" = "0.1.28" ] || exit 1
  command -v getT2T.sh > /dev/null || exit 1
  command -v neighborhood > /dev/null || exit 1

  samtools --version | head -n 1 | grep -q '^samtools 1\.25$' || exit 1
  bgzip --version | head -n 1 | grep -q '(htslib) 1\.25$' || exit 1
  tabix --version | head -n 1 | grep -q '(htslib) 1\.25$' || exit 1
  seqtk 2>&1 | grep -q 'Version: 1\.5-' || exit 1
  mashmap --version 2>&1 | grep -q '^3\.1\.3$' || exit 1
  bedtools --version | grep -q 'bedtools v2\.31\.1' || exit 1
  meryl --version 2>&1 | grep -q '^meryl 1\.4\.2$' || exit 1
  minimap2 --version | grep -q '^2\.31' || exit 1

  cat > "$workdir/asm.fa" <<'EOF'
>contig1
ACGTACGTTTGACCATGACGATCGATCGGGCTAGCTAGCTAACGTTAGCATCGACTAGCATCGACG
>contig2
TTGGCCAATCGATCGTAGCTAGCTAGCATGCATCGATCGACTGACTAGCTAGCATCGACTAGCTAC
EOF
  samtools faidx "$workdir/asm.fa" || exit 1
  [ "$(cut -f 1 "$workdir/asm.fa.fai" | tr '\n' ' ')" = "contig1 contig2 " ] || exit 1
  [ "$(seqtk seq -r "$workdir/asm.fa" | grep -c '^>')" -eq 2 ] || exit 1
  bgzip -c "$workdir/asm.fa" > "$workdir/asm.fa.gz" || exit 1
  samtools faidx "$workdir/asm.fa.gz" contig2 | grep -q '^>contig2$' || exit 1
  rm -rf "$workdir"
Download bioinformatics-verkko-fillet_0.1.28.def
#!/bin/sh

  exec python "$@"
#!/bin/sh

  export PATH=/opt/verkko-fillet/lib/python3.13/site-packages/verkkofillet/bin:/opt/verkko-fillet/bin:/opt/tools/bin:$PATH
  workdir=$(mktemp -d) || exit 1
  export MPLCONFIGDIR="$workdir/mpl"

  # verkkofillet prints its version on import.
  python -c 'import verkkofillet' | grep -q 'verkko-fillet version:0.1.28' || exit 1
  [ "$(python -c 'import importlib.metadata as m; print(m.version("verkkofillet"))')" = "0.1.28" ] || exit 1
  command -v getT2T.sh > /dev/null || exit 1
  command -v neighborhood > /dev/null || exit 1

  samtools --version | head -n 1 | grep -q '^samtools 1\.25$' || exit 1
  bgzip --version | head -n 1 | grep -q '(htslib) 1\.25$' || exit 1
  tabix --version | head -n 1 | grep -q '(htslib) 1\.25$' || exit 1
  seqtk 2>&1 | grep -q 'Version: 1\.5-' || exit 1
  mashmap --version 2>&1 | grep -q '^3\.1\.3$' || exit 1
  bedtools --version | grep -q 'bedtools v2\.31\.1' || exit 1
  meryl --version 2>&1 | grep -q '^meryl 1\.4\.2$' || exit 1
  minimap2 --version | grep -q '^2\.31' || exit 1

  cat > "$workdir/asm.fa" <<'EOF'
>contig1
ACGTACGTTTGACCATGACGATCGATCGGGCTAGCTAGCTAACGTTAGCATCGACTAGCATCGACG
>contig2
TTGGCCAATCGATCGTAGCTAGCTAGCATGCATCGATCGACTGACTAGCTAGCATCGACTAGCTAC
EOF
  samtools faidx "$workdir/asm.fa" || exit 1
  [ "$(cut -f 1 "$workdir/asm.fa.fai" | tr '\n' ' ')" = "contig1 contig2 " ] || exit 1
  [ "$(seqtk seq -r "$workdir/asm.fa" | grep -c '^>')" -eq 2 ] || exit 1
  bgzip -c "$workdir/asm.fa" > "$workdir/asm.fa.gz" || exit 1
  samtools faidx "$workdir/asm.fa.gz" contig2 | grep -q '^>contig2$' || exit 1
  rm -rf "$workdir"
# /.singularity.d/env/10-docker2singularity.sh
#!/bin/sh
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
export LANG="${LANG:-"C.UTF-8"}"
export GPG_KEY="${GPG_KEY:-"7169605F62C751356D054A26A821E680E5FA6305"}"
export PYTHON_VERSION="${PYTHON_VERSION:-"3.13.18"}"
export PYTHON_SHA256="${PYTHON_SHA256:-"abb0102e6d4ae027509bcb82327d9dd85515b44a3ba8ad538cfc5e9847029f68"}"
# /.singularity.d/env/90-environment.sh
#!/bin/sh
# Custom environment shell code should follow


  export PATH=/opt/verkko-fillet/lib/python3.13/site-packages/verkkofillet/bin:/opt/verkko-fillet/bin:/opt/tools/bin:$PATH