From 7372c27ea3930ad464b05a6c3ab4fd6348eb3abd Mon Sep 17 00:00:00 2001 From: Justin Bedo Date: Thu, 25 May 2023 11:50:52 +1000 Subject: ampliconarchitect: init --- tools/aa-app.nix | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ tools/aa-call.nix | 31 ++++++++++++++++++++++++++++++ tools/aa.nix | 7 +++++++ 3 files changed, 95 insertions(+) create mode 100644 tools/aa-app.nix create mode 100644 tools/aa-call.nix create mode 100644 tools/aa.nix (limited to 'tools') diff --git a/tools/aa-app.nix b/tools/aa-app.nix new file mode 100644 index 0000000..4b782b3 --- /dev/null +++ b/tools/aa-app.nix @@ -0,0 +1,57 @@ +{ + stdenv, + fetchurl, + fetchFromGitHub, + python3, +}: let + python = python3.withPackages (pkgs: + with pkgs; [ + numpy + scipy + pysam + matplotlib + future + (mosek pkgs) + ]); + + mosek = assert stdenv.system == "x86_64-linux"; + pkgs: + pkgs.buildPythonPackage { + pname = "mosek"; + version = "8.1.0.83"; + src = fetchurl { + url = "https://download.mosek.com/stable/8.1.0.83/mosektoolslinux64x86.tar.bz2"; + sha256 = "sha256-d/S/IalmQwizWYZ89ZskUoVAaXWYszuw7w+w0Vp+13k"; + }; + doCheck = false; + preBuild = '' + cd 8/tools/platform/linux64x86/python/3/ + ''; + propagatedBuildInputs = with pkgs; [numpy]; + postInstall = '' + find $out -name lib\*.so\* -print0 | xargs -0 \ + patchelf --add-rpath ${stdenv.cc.cc.lib}/lib + ''; + }; +in + stdenv.mkDerivation rec { + pname = "AmpliconArchitect"; + version = "1.3"; + + src = fetchFromGitHub { + owner = "virajbdeshpande"; + repo = pname; + rev = "40da8520a953810ad43e5a6fdf4aba7449d7f5e0"; + sha256 = "sha256-4SAOpdjXiZFTfpD6WpLfs2zDyGT2hcWabl+sUjboBpc="; + }; + + doBuild = false; + installPhase = '' + mkdir -p $out/libexec + cp -r src $out/libexec/aa + mkdir $out/bin + ln -s $out/libexec/aa/{AmpliconArchitect,amplified_intervals,ref_util,downsample}.py $out/bin + ''; + + buildInputs = [python]; + } diff --git a/tools/aa-call.nix b/tools/aa-call.nix new file mode 100644 index 0000000..1c6a121 --- /dev/null +++ b/tools/aa-call.nix @@ -0,0 +1,31 @@ +{ + bionix, + seeds, + license, + flags ? "", + downsample ? 0.1, + ... +}: input: +with bionix; let + indexedBam = linkOutputs { + "input.bam" = input; + "input.bam.bai" = samtools.index {} input; + }; +in + stage { + name = "aa-call"; + MOSEKLM_LICENSE_FILE = license; + buildInputs = [bionix.ampliconarchitect.app]; + buildCommand = '' + mkdir $out + export AA_DATA_REPO=$TMPDIR + tar -xzf ${self.aa.ref} + AmpliconArchitect.py \ + --bam ${indexedBam}/input.bam \ + --bed ${seeds} \ + --ref GRCh38 \ + --out $out/out \ + --downsample ${toString downsample} \ + $flags + ''; + } diff --git a/tools/aa.nix b/tools/aa.nix new file mode 100644 index 0000000..6010c43 --- /dev/null +++ b/tools/aa.nix @@ -0,0 +1,7 @@ +{bionix}: +with bionix; + +{ + app = pkgs.callPackage ./aa-app.nix { }; + call = callBionixE ./aa-call.nix { }; +} -- cgit v1.2.3