summary refs log tree commit diff
path: root/pkgs/applications/science/biology/tandem-aligner/default.nix
blob: 5f197bd7f79cdecfa055b84cc8d3c47670ac13a8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
{ lib
, stdenv
, fetchFromGitHub
, fetchpatch
, cmake
, zlib
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "TandemAligner";
  version = "0.1";

  src = fetchFromGitHub {
    owner = "seryrzu";
    repo = "tandem_aligner";
    rev = "v${finalAttrs.version}";
    hash = "sha256-iMDj1HZ8LzmZckuAM3lbG3eSJSd/5JGVA6SBs7+AgX8=";
  };

  patches = [
    (fetchpatch {
      # https://github.com/seryrzu/tandem_aligner/pull/4
      url = "https://github.com/seryrzu/tandem_aligner/commit/8b516c94f90aaa9cb84278aa811285d4204b03a9.patch";
      hash = "sha256-kD46SykXklG/avK0+sc61YKFw9Bes8ZgFAjVXmcpN8k=";
      stripLen = 1;
    })
  ];

  sourceRoot = "source/tandem_aligner";

  nativeBuildInputs = [ cmake ];

  buildInputs = [ zlib ];

  installPhase = ''
    runHook preInstall
    mkdir -p $out/bin
    cp src/projects/tandem_aligner/tandem_aligner $out/bin
    runHook postInstall
  '';

  doCheck = true;

  # adapted from target test_launch in Makefile
  checkPhase = ''
    runHook preCheck
    mkdir -p $TMPDIR/test_launch
    src/projects/tandem_aligner/tandem_aligner \
      --first $src/tandem_aligner/test_dataset/first.fasta \
      --second $src/tandem_aligner/test_dataset/second.fasta \
      -o $TMPDIR/test_launch \
      --debug
    grep -q "Thank you for using TandemAligner!" $TMPDIR/test_launch/tandem_aligner.log
    diff $TMPDIR/test_launch/cigar.txt $src/tandem_aligner/test_dataset/true_cigar.txt
    runHook postCheck
  '';

  meta = {
    description = "A parameter-free algorithm for sequence alignment";
    homepage = "https://github.com/seryrzu/tandem_aligner";
    changelog = "https://github.com/seryrzu/tandem_aligner/releases/tag/v${finalAttrs.version}";
    license = lib.licenses.bsd3;
    maintainers = with lib.maintainers; [ amesgen ];
    platforms = lib.platforms.linux;
    mainProgram = "tandem_aligner";
  };
})