Bootstrap: library
From: default/alpine:3.14.0

%post
  # Install java
  apk add --no-cache openjdk8 bash

  # Make versioning easier
  CLIQUE_VERSION=2.0.2

  cd /opt
  wget https://github.com/vtsyvina/CliqueSNV/archive/refs/tags/$CLIQUE_VERSION.tar.gz -O cliquesnv.tar.gz
  tar xvzf cliquesnv.tar.gz
  rm cliquesnv.tar.gz
  cd

  {
    echo "#!/bin/bash"
    echo "java -jar /opt/CliqueSNV-$CLIQUE_VERSION/clique-snv.jar \"\$@\""
  } > /usr/bin/clique-snv
  chmod +x /usr/bin/clique-snv

%test
  test_command () {
    if ! command -v "${1}"; then
      echo "command ${1} not found!"
      export FAILED_TESTS=1
    fi
  }

  test_command bash
  test_command ps
  test_command java
  test_command clique-snv

  if [ -n "$FAILED_TESTS" ]; then
    exit 1
  fi

%runscript
  clique-snv "$@"

%labels
  Author 25492070+MillironX@users.noreply.github.com
  SoftwareVersion 2.0.2
  SingularityDefinitionVersion 1

%help
  CliqueSNV
  =========

  CliqueSNV can identify minority haplotypes based on extracting pairs of
  statistically linked mutations from noisy reads.

  For more help, see
  - <https://github.com/vtsyvina/CliqueSNV>
  - <https://github.com/MillironX/singularity-builds>
