aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJustin Bedo <cu@cua0.org>2018-09-26 11:24:18 +1000
committerJustin Bedo <cu@cua0.org>2018-09-26 11:24:18 +1000
commit91e6ec3f53b9183082f56c0e52931436d069528e (patch)
treee9d7fef5af4d151f80c85a781b1bbae2ff65a92e /tools
parent98672cb1bba7221c5c8ecc363243cb47fcd13f47 (diff)
Add flagstat and fastqc
Diffstat (limited to 'tools')
-rw-r--r--tools/fastqc-app.nix24
-rw-r--r--tools/fastqc-check.nix20
-rw-r--r--tools/fastqc.nix7
-rw-r--r--tools/samtools-flagstat.nix15
-rw-r--r--tools/samtools.nix3
5 files changed, 68 insertions, 1 deletions
diff --git a/tools/fastqc-app.nix b/tools/fastqc-app.nix
new file mode 100644
index 0000000..40fd7ec
--- /dev/null
+++ b/tools/fastqc-app.nix
@@ -0,0 +1,24 @@
+{ stdenv, unzip, perl, fetchurl, jre }:
+
+stdenv.mkDerivation rec {
+ name = "fastqc-${version}";
+ version = "0.11.7";
+
+ src = fetchurl {
+ url = "https://www.bioinformatics.babraham.ac.uk/projects/fastqc/fastqc_v0.11.7.zip";
+ sha256 = "04hifbfrh60s5kzqr7n46bcviaiymr1rx67b88s3cpxydf3m1ksr";
+ };
+
+ buildInputs = [ unzip perl ];
+
+ phases = [ "unpackPhase" "installPhase" "fixupPhase" ];
+
+ installPhase = ''
+ mkdir -p $out/libexec/fastqc
+ cp -r . $out/libexec/fastqc
+ mkdir $out/bin
+ ln -s $out/libexec/fastqc/fastqc $out/bin
+ substituteInPlace $out/bin/fastqc --replace "my \$java_bin = 'java'" "my \$java_bin = '${jre}/bin/java'"
+ chmod 755 $out/libexec/fastqc/fastqc
+ '';
+}
diff --git a/tools/fastqc-check.nix b/tools/fastqc-check.nix
new file mode 100644
index 0000000..e13ce2a
--- /dev/null
+++ b/tools/fastqc-check.nix
@@ -0,0 +1,20 @@
+{ stdenv
+, lib
+, fastqc
+, flags ? null}:
+
+with lib;
+
+input:
+
+stdenv.mkDerivation {
+ name = "fastqc-check";
+ buildInputs = [ fastqc ];
+ buildCommand = ''
+ mkdir $out
+ fastqc \
+ -o $out \
+ ${optionalString (flags != null) flags} \
+ ${input}
+ '';
+}
diff --git a/tools/fastqc.nix b/tools/fastqc.nix
new file mode 100644
index 0000000..2034c91
--- /dev/null
+++ b/tools/fastqc.nix
@@ -0,0 +1,7 @@
+{ bionix, nixpkgs }:
+
+with nixpkgs;
+
+{
+ check = attrs: callPackage ./fastqc-check.nix attrs;
+}
diff --git a/tools/samtools-flagstat.nix b/tools/samtools-flagstat.nix
new file mode 100644
index 0000000..790eeb4
--- /dev/null
+++ b/tools/samtools-flagstat.nix
@@ -0,0 +1,15 @@
+{ stdenv
+, callPackage
+, lib
+, samtools
+}:
+
+input:
+
+with lib;
+
+stdenv.mkDerivation {
+ name = "samtools-index";
+ buildInputs = [ samtools ];
+ buildCommand = "samtools flagstat -@ $NIX_BUILD_CORES ${input} > $out";
+}
diff --git a/tools/samtools.nix b/tools/samtools.nix
index 6fdbef5..77e3815 100644
--- a/tools/samtools.nix
+++ b/tools/samtools.nix
@@ -3,7 +3,8 @@
with nixpkgs;
{
+ faidx = attrs: callPackage ./samtools-faidx.nix attrs;
+ flagstat = attrs: callPackage ./samtools-flagstat.nix attrs;
index = attrs: callPackage ./samtools-index.nix attrs;
sort = attrs: callPackage ./samtools-sort.nix attrs;
- faidx = attrs: callPackage ./samtools-faidx.nix attrs;
}