From c3babc9eb65dc8c56d07ce8a6ee0d8c03bbd223e Mon Sep 17 00:00:00 2001 From: Justin Bedo Date: Wed, 9 Jan 2019 16:38:42 +1100 Subject: large refactor - use bionix.pkgs instead of nixpkgs - replace stdenv.mkDerivation with stage --- tools/bowtie-align.nix | 11 +++++------ tools/bowtie-index.nix | 9 ++++----- tools/bowtie.nix | 2 +- tools/bwa-index.nix | 9 ++++----- tools/bwa-mem.nix | 11 +++++------ tools/bwa.nix | 2 +- tools/compression.nix | 11 +++++------ tools/crumble.nix | 5 ++--- tools/fastqc-check.nix | 5 ++--- tools/fastqc.nix | 5 ++--- tools/gridss-assemble.nix | 9 ++++----- tools/gridss-callVariants.nix | 9 ++++----- tools/gridss-collectMetrics.nix | 9 ++++----- tools/gridss-computeSamTags.nix | 9 ++++----- tools/gridss-configFile.nix | 13 +++++++------ tools/gridss-extractSVReads.nix | 9 ++++----- tools/gridss-softClipsToSplitReads.nix | 9 ++++----- tools/gridss-variants.nix | 15 +++++++-------- tools/gridss.nix | 7 +++---- tools/infercnv-infer.nix | 5 ++--- tools/infercnv.nix | 3 +-- tools/kallisto-index.nix | 9 ++++----- tools/kallisto-quant.nix | 7 +++---- tools/kallisto.nix | 2 +- tools/mosdepth-depth.nix | 7 +++---- tools/mosdepth-plot.nix | 7 +++---- tools/mosdepth.nix | 2 +- tools/mutect-call.nix | 7 +++---- tools/mutect.nix | 5 ++--- tools/platypus-callVariants.nix | 9 ++++----- tools/platypus.nix | 2 +- tools/samtools-dict.nix | 9 ++++----- tools/samtools-faidx.nix | 9 ++++----- tools/samtools-fixmate.nix | 9 ++++----- tools/samtools-flagstat.nix | 7 +++---- tools/samtools-index.nix | 9 ++++----- tools/samtools-markdup.nix | 9 ++++----- tools/samtools-merge.nix | 7 +++---- tools/samtools-sort.nix | 7 +++---- tools/samtools-view.nix | 9 ++++----- tools/samtools.nix | 2 +- tools/snpeff-annotate.nix | 9 ++++----- tools/snpeff-dbnsfp.nix | 7 +++---- tools/snpeff.nix | 2 +- tools/strelka-call.nix | 9 ++++----- tools/strelka.nix | 2 +- 46 files changed, 147 insertions(+), 183 deletions(-) (limited to 'tools') diff --git a/tools/bowtie-align.nix b/tools/bowtie-align.nix index 456747a..67a1169 100644 --- a/tools/bowtie-align.nix +++ b/tools/bowtie-align.nix @@ -1,5 +1,4 @@ { bionix -, nixpkgs , ref , bamOutput ? true , flags ? null @@ -10,18 +9,18 @@ , input2 ? null }: -with nixpkgs; +with bionix; with lib; -with bionix.types; -with bionix.compression; +with types; +with compression; let fa = f: matchFiletype "bowtie2-ref" { fa = _: f; } f; fq = f: matchFiletype "bowtie2-input" { fq = _: f; gz = matchFiletype' "bowtie2-input" { fq = _: f; }; } f; -in stdenv.mkDerivation { +in stage { name = "bowtie2-align"; - buildInputs = [ bowtie2 bc ] ++ optional bamOutput samtools; + buildInputs = with pkgs; [ bowtie2 bc ] ++ optional bamOutput samtools; buildCommand = '' cores=$(echo $NIX_BUILD_CORES ${optionalString bamOutput "- 1"} | bc) if [[ $cores -lt 1 ]] ; then diff --git a/tools/bowtie-index.nix b/tools/bowtie-index.nix index 98e529f..4554ad1 100644 --- a/tools/bowtie-index.nix +++ b/tools/bowtie-index.nix @@ -1,20 +1,19 @@ { bionix -, nixpkgs , flags ? null , seed ? 42 }: ref: -with nixpkgs; +with bionix; with lib; -with bionix.types; +with types; assert (matchFiletype "bowtie-index" { fa = _: true; } ref); -stdenv.mkDerivation { +stage { name = "bowtie-index"; - buildInputs = [ bowtie2 ]; + buildInputs = with pkgs; [ bowtie2 ]; buildCommand = '' mkdir $out bowtie2-build --seed ${toString seed} --threads $NIX_BUILD_CORES ${optionalString (flags != null) flags} ${ref} $out/ref diff --git a/tools/bowtie.nix b/tools/bowtie.nix index df8f955..a4439d3 100644 --- a/tools/bowtie.nix +++ b/tools/bowtie.nix @@ -1,4 +1,4 @@ -{ bionix, nixpkgs }: +{ bionix }: with bionix; diff --git a/tools/bwa-index.nix b/tools/bwa-index.nix index c879bc4..17b651f 100644 --- a/tools/bwa-index.nix +++ b/tools/bwa-index.nix @@ -1,19 +1,18 @@ { bionix -, nixpkgs , flags ? null }: ref: -with nixpkgs; +with bionix; with lib; -with bionix.types; +with types; assert (matchFiletype "bwa-index" { fa = _: true; } ref); -stdenv.mkDerivation { +stage { name = "bwa-index"; - buildInputs = [ bwa ]; + buildInputs = with pkgs; [ bwa ]; buildCommand = '' ln -s ${ref} ref.fa bwa index ${optionalString (flags != null) flags} ref.fa diff --git a/tools/bwa-mem.nix b/tools/bwa-mem.nix index 2b3bc64..1427b49 100644 --- a/tools/bwa-mem.nix +++ b/tools/bwa-mem.nix @@ -1,5 +1,4 @@ { bionix -, nixpkgs , ref , bamOutput ? true , flags ? null @@ -10,18 +9,18 @@ , input2 ? null }: -with nixpkgs; +with bionix; with lib; -with bionix.types; -with bionix.compression; +with types; +with compression; let fa = f: matchFiletype "bwa-ref" { fa = _: f; } f; fq = f: matchFiletype "bwa-input" { fq = _: f; gz = matchFiletype' "bwa-input" { fq = _: f; }; } f; -in stdenv.mkDerivation { +in stage { name = "bwa-mem"; - buildInputs = [ bwa bc ] ++ optional bamOutput samtools; + buildInputs = with pkgs; [ bwa bc ] ++ optional bamOutput samtools; buildCommand = '' ln -s ${fa ref} ref.fa for f in ${bionix.bwa.index indexAttrs ref}/* ; do diff --git a/tools/bwa.nix b/tools/bwa.nix index ea0e6a0..d0ab5ee 100644 --- a/tools/bwa.nix +++ b/tools/bwa.nix @@ -1,4 +1,4 @@ -{ bionix, nixpkgs }: +{ bionix }: with bionix; diff --git a/tools/compression.nix b/tools/compression.nix index 4184fec..6e69d7e 100644 --- a/tools/compression.nix +++ b/tools/compression.nix @@ -1,6 +1,5 @@ -{bionix, nixpkgs}: +{bionix}: -with nixpkgs; with bionix; { @@ -12,11 +11,11 @@ with bionix; cram = _: f; vcf = _: f; bed = _: f; - gz = _: types.tagFiletype (types.gunzip f.filetype) (stdenv.mkDerivation { + gz = _: types.tagFiletype (types.gunzip f.filetype) (stage { name = "gunzip"; buildCommand = "gunzip < ${f} > $out"; }); - bz2 = _: types.tagFiletype (types.bunzip2 f.filetype) (stdenv.mkDerivation { + bz2 = _: types.tagFiletype (types.bunzip2 f.filetype) (stage { name = "bunzip2"; buildCommand = "bunzip2 < ${f} > $out"; }); @@ -24,7 +23,7 @@ with bionix; gzip = f: let - gz = (stdenv.mkDerivation { + gz = (stage { name = "gzip"; buildCommand = "gzip < ${f} > $out"; passthru = { filetype = types.filetype.gz f.filetype; }; @@ -42,7 +41,7 @@ with bionix; bzip2 = f: let - bz2 = (stdenv.mkDerivation { + bz2 = (stage { name = "bzip2"; buildCommand = "bzip2 < ${f} > $out"; passthru = { filetype = types.filetype.bz2 f.filetype; }; diff --git a/tools/crumble.nix b/tools/crumble.nix index 6031fca..4256f37 100644 --- a/tools/crumble.nix +++ b/tools/crumble.nix @@ -1,8 +1,7 @@ -{ bionix, nixpkgs }: +{ bionix }: -with nixpkgs; with bionix; { - crumble = callPackage ./crumble-app.nix {}; + crumble = pkgs.callPackage ./crumble-app.nix {}; } diff --git a/tools/fastqc-check.nix b/tools/fastqc-check.nix index 17d6183..d33b987 100644 --- a/tools/fastqc-check.nix +++ b/tools/fastqc-check.nix @@ -1,14 +1,13 @@ { bionix -, nixpkgs , flags ? null }: -with nixpkgs; +with bionix; with lib; input: -stdenv.mkDerivation { +stage { name = "fastqc-check"; buildInputs = [ bionix.fastqc.fastqc ]; buildCommand = '' diff --git a/tools/fastqc.nix b/tools/fastqc.nix index 6e603b2..5632958 100644 --- a/tools/fastqc.nix +++ b/tools/fastqc.nix @@ -1,9 +1,8 @@ -{ bionix, nixpkgs }: +{ bionix }: -with nixpkgs; with bionix; { - fastqc = callPackage ./fastqc-app.nix {}; + fastqc = pkgs.callPackage ./fastqc-app.nix {}; check = callBionixE ./fastqc-check.nix; } diff --git a/tools/gridss-assemble.nix b/tools/gridss-assemble.nix index f57bc12..e5cb3ca 100644 --- a/tools/gridss-assemble.nix +++ b/tools/gridss-assemble.nix @@ -1,5 +1,4 @@ { bionix -, nixpkgs , bwaIndexAttrs ? {} , faidxAttrs ? {} , indexAttrs ? {} @@ -9,9 +8,9 @@ , heapSize ? "31g" }: -with nixpkgs; +with bionix; with lib; -with bionix.types; +with types; inputs: @@ -36,9 +35,9 @@ in assert (all sorted inputs); assert (homoRef); -stdenv.mkDerivation rec { +stage rec { name = "gridss-assemble"; - buildInputs = [ jre bwa ]; + buildInputs = with pkgs; [ jre bwa ]; buildCommand = '' TMPDIR=$(pwd) ln -s ${ref} ref.fa diff --git a/tools/gridss-callVariants.nix b/tools/gridss-callVariants.nix index d55db23..4117126 100644 --- a/tools/gridss-callVariants.nix +++ b/tools/gridss-callVariants.nix @@ -1,5 +1,4 @@ { bionix -, nixpkgs , blacklist ? null , bwaIndexAttrs ? {} , faidxAttrs ? {} @@ -8,9 +7,9 @@ , heapSize ? "31g" }: -with nixpkgs; +with bionix; with lib; -with bionix.types; +with types; inputs: @@ -22,9 +21,9 @@ in assert (length (unique refs) == 1); -stdenv.mkDerivation rec { +stage rec { name = "gridss-callVariants"; - buildInputs = [ jre R bwa ]; + buildInputs = with pkgs; [ jre R bwa ]; buildCommand = '' ln -s ${ref} ref.fa ln -s ${bionix.samtools.faidx faidxAttrs ref} ref.fa.fai diff --git a/tools/gridss-collectMetrics.nix b/tools/gridss-collectMetrics.nix index 17e3c46..37e22f1 100644 --- a/tools/gridss-collectMetrics.nix +++ b/tools/gridss-collectMetrics.nix @@ -1,14 +1,13 @@ { bionix -, nixpkgs , thresholdCoverage ? 10000 , flags ? null , config ? null , heapSize ? "1G" }: -with nixpkgs; +with bionix; with lib; -with bionix.types; +with types; input: @@ -17,9 +16,9 @@ let in -stdenv.mkDerivation rec { +stage rec { name = "gridss-collectMetrics"; - buildInputs = [ jre R ]; + buildInputs = with pkgs; [ jre R ]; buildCommand = '' mkdir $out java -Xmx${heapSize} -cp ${bionix.gridss.jar} \ diff --git a/tools/gridss-computeSamTags.nix b/tools/gridss-computeSamTags.nix index c462461..5b249e7 100644 --- a/tools/gridss-computeSamTags.nix +++ b/tools/gridss-computeSamTags.nix @@ -1,5 +1,4 @@ { bionix -, nixpkgs , blacklist ? null , bwaIndexAttrs ? {} , faidxAttrs ? {} @@ -8,9 +7,9 @@ , heapSize ? "1G" }: -with nixpkgs; +with bionix; with lib; -with bionix.types; +with types; input: @@ -21,9 +20,9 @@ in assert(sorted); -stdenv.mkDerivation rec { +stage rec { name = "gridss-computeSamTags"; - buildInputs = [ jre ]; + buildInputs = with pkgs; [ jre ]; buildCommand = '' ln -s ${ref} ref.fa ln -s ${bionix.samtools.faidx faidxAttrs ref} ref.fa.fai diff --git a/tools/gridss-configFile.nix b/tools/gridss-configFile.nix index 15eba55..d6b600e 100644 --- a/tools/gridss-configFile.nix +++ b/tools/gridss-configFile.nix @@ -1,14 +1,15 @@ -{bionix, nixpkgs}: +{bionix}: -with nixpkgs; +with bionix; +with lib; let attrsToGridssConfigString = attrsToGridssConfigStringPrepend ""; attrsToGridssConfigStringPrepend = prepend: attrs: - lib.concatStringsSep "\n" ( - lib.attrValues ( - lib.mapAttrs + concatStringsSep "\n" ( + attrValues ( + mapAttrs (name: attr: prepend + (iniLine name attr)) attrs)); @@ -31,6 +32,6 @@ let # Allows for repeated fields (e.g. for adapters): list = name: attr: concatStringsSep "\n" (map (x: iniLine name x) attr); }; -in configAttrs: (writeText +in configAttrs: (pkgs.writeText "gridss.properties.override" ((attrsToGridssConfigString configAttrs) + "\n")) diff --git a/tools/gridss-extractSVReads.nix b/tools/gridss-extractSVReads.nix index 5fc4c59..f2fab30 100644 --- a/tools/gridss-extractSVReads.nix +++ b/tools/gridss-extractSVReads.nix @@ -1,5 +1,4 @@ { bionix -, nixpkgs , dictIndexAttrs ? {} , faidxAttrs ? {} , flags ? null @@ -9,9 +8,9 @@ , config ? null }: -with nixpkgs; +with bionix; with lib; -with bionix.types; +with types; input: @@ -20,9 +19,9 @@ let in -stdenv.mkDerivation rec { +stage rec { name = "gridss-extractSVReads"; - buildInputs = [ jre R ]; + buildInputs = with pkgs; [ jre R ]; buildCommand = '' ln -s ${ref} ref.fa ln -s ${bionix.samtools.faidx faidxAttrs ref} ref.fa.fai diff --git a/tools/gridss-softClipsToSplitReads.nix b/tools/gridss-softClipsToSplitReads.nix index c5d8062..315fbf9 100644 --- a/tools/gridss-softClipsToSplitReads.nix +++ b/tools/gridss-softClipsToSplitReads.nix @@ -1,5 +1,4 @@ { bionix -, nixpkgs , bwaIndexAttrs ? {} , faidxAttrs ? {} , alignerStreaming ? false @@ -9,9 +8,9 @@ }: -with nixpkgs; +with bionix; with lib; -with bionix.types; +with types; input: @@ -19,9 +18,9 @@ let ref = matchFiletype "gridss-softClipsToSplitReads" { bam = x: x.ref; } input; in -stdenv.mkDerivation rec { +stage rec { name = "gridss-softClipsToSplitReads"; - buildInputs = [ jre bwa ]; + buildInputs = with pkgs; [ jre bwa ]; buildCommand = '' ln -s ${ref} ref.fa ln -s ${bionix.samtools.faidx faidxAttrs ref} ref.fa.fai diff --git a/tools/gridss-variants.nix b/tools/gridss-variants.nix index d3070a8..fc26c5a 100644 --- a/tools/gridss-variants.nix +++ b/tools/gridss-variants.nix @@ -1,5 +1,4 @@ { bionix -, nixpkgs , bwaIndexAttrs ? {} , faidxAttrs ? {} , indexAttrs ? {} @@ -11,10 +10,10 @@ , heapSize ? "4g" }: -with nixpkgs; +with bionix; with lib; -with bionix.types; -with bionix.gridss; +with types; +with gridss; inputs: @@ -65,9 +64,9 @@ assert (all sorted inputs); assert (homoRef); rec { - identify = stdenv.mkDerivation rec { + identify = stage rec { name = "gridss-identifyVariants"; - buildInputs = [ jre samtools ]; + buildInputs = with pkgs; [ jre samtools ]; buildCommand = mkLinks + '' java -Xmx${heapSize} -Dsamjdk.create_index=true \ -cp ${jar} gridss.IdentifyVariants \ @@ -87,9 +86,9 @@ rec { }; }; - annotate = stdenv.mkDerivation rec { + annotate = stage rec { name = "gridss-annotateVariants"; - buildInputs = [ jre ]; + buildInputs = with pkgs; [ jre ]; buildCommand = mkLinks + '' ln -s ${bionix.gridss.identifyVariants {inherit bwaIndexAttrs faidxAttrs indexAttrs assemblyAttrs collectMetricsAttrs softClipsToSplitReadsAttrs flags config; } inputs} input.vcf java -Xmx${heapSize} -Dsamjdk.create_index=true \ diff --git a/tools/gridss.nix b/tools/gridss.nix index 5bb9484..e8dd304 100644 --- a/tools/gridss.nix +++ b/tools/gridss.nix @@ -1,14 +1,13 @@ -{bionix, nixpkgs}: +{bionix}: -with nixpkgs; with bionix; rec { - jar = fetchurl { + jar = pkgs.fetchurl { url = "https://github.com/PapenfussLab/gridss/releases/download/v2.0.0/gridss-2.0.0-gridss-jar-with-dependencies.jar"; sha256 = "01srl3qvv060whqg1y1fpxjc5cwga5wscs1bmf1v3z87dignra7k"; }; - gridssConfig = callBionixE ./gridss-configFile.nix {}; + genConfig = callBionixE ./gridss-configFile.nix {}; callVariants = callBionixE ./gridss-callVariants.nix; computeSamTags = callBionixE ./gridss-computeSamTags.nix; softClipsToSplitReads = callBionixE ./gridss-softClipsToSplitReads.nix; diff --git a/tools/infercnv-infer.nix b/tools/infercnv-infer.nix index 95ebbe3..0915691 100644 --- a/tools/infercnv-infer.nix +++ b/tools/infercnv-infer.nix @@ -1,15 +1,14 @@ {bionix -,nixpkgs ,flags ? null}: -with nixpkgs; +with bionix; with lib; {ref ,expr ,pos}: -stdenv.mkDerivation { +stage { name = "inferCNV"; buildInputs = [ bionix.infercnv.app ]; buildCommand = '' diff --git a/tools/infercnv.nix b/tools/infercnv.nix index 03e073b..71ed274 100644 --- a/tools/infercnv.nix +++ b/tools/infercnv.nix @@ -1,6 +1,5 @@ -{nixpkgs, bionix}: +{bionix}: -with nixpkgs; with bionix; { diff --git a/tools/kallisto-index.nix b/tools/kallisto-index.nix index 33dfb80..3b92d38 100644 --- a/tools/kallisto-index.nix +++ b/tools/kallisto-index.nix @@ -1,11 +1,10 @@ {bionix -, nixpkgs , kmerSize ? 31 , unique ? false}: -with nixpkgs; +with bionix; with lib; -with bionix.types; +with types; assert (kmerSize > 1); @@ -13,9 +12,9 @@ input: assert (matchFiletype input { fa = _: true; } input); -stdenv.mkDerivation { +stage { name = "kallisto-index"; - buildInputs = [ kallisto ]; + buildInputs = with pkgs; [ kallisto ]; buildCommand = '' kallisto index -k ${toString kmerSize} ${optionalString unique "--make-unique"} -i $out ${input} ''; diff --git a/tools/kallisto-quant.nix b/tools/kallisto-quant.nix index c410721..1deab67 100644 --- a/tools/kallisto-quant.nix +++ b/tools/kallisto-quant.nix @@ -1,5 +1,4 @@ {bionix -, nixpkgs , indexFlags ? {} , bias ? false , bootstrapSamples ? 0 @@ -13,7 +12,7 @@ , fragmentSD ? null , ref}: -with nixpkgs; +with bionix; with lib; assert (!single || (fragmentLength != null && fragmentSD != null)); @@ -27,9 +26,9 @@ in assert (all (x: isFastQ (x.filetype)) inputs); -stdenv.mkDerivation { +stage { name = "kallisto-quant"; - buildInputs = [ kallisto ]; + buildInputs = with pkgs; [ kallisto ]; buildCommand = '' mkdir $out kallisto quant \ diff --git a/tools/kallisto.nix b/tools/kallisto.nix index 8a5d038..31e15d9 100644 --- a/tools/kallisto.nix +++ b/tools/kallisto.nix @@ -1,4 +1,4 @@ -{bionix, nixpkgs}: +{bionix}: with bionix; diff --git a/tools/mosdepth-depth.nix b/tools/mosdepth-depth.nix index 7043c43..448da11 100644 --- a/tools/mosdepth-depth.nix +++ b/tools/mosdepth-depth.nix @@ -1,17 +1,16 @@ { bionix -, nixpkgs , indexAttrs ? {} , flags ? null }: -with nixpkgs; +with bionix; with lib; input: -stdenv.mkDerivation { +stage { name = "mosdepth-depth"; - buildInputs = [ mosdepth ]; + buildInputs = with pkgs; [ mosdepth ]; buildCommand = '' mkdir $out ln -s ${input} input.bam diff --git a/tools/mosdepth-plot.nix b/tools/mosdepth-plot.nix index f15e099..0fdfc67 100644 --- a/tools/mosdepth-plot.nix +++ b/tools/mosdepth-plot.nix @@ -1,17 +1,16 @@ { bionix -, nixpkgs , flags ? null }: -with nixpkgs; +with bionix; with lib; { inputs , names ? []}: -stdenv.mkDerivation { +stage { name = "mosdepth-depth"; - buildInputs = [ python ]; + buildInputs = with pkgs; [ python ]; buildCommand = '' python ${mosdepth.src}/scripts/plot-dist.py ${concatMapStringsSep " " (i: "${i}/out.mosdepth.global.dist.txt") inputs} ${concatStringsSep "\n" (zipListsWith (i: n: "substituteInPlace dist.html --replace ${i}/out ${n}") inputs names)} diff --git a/tools/mosdepth.nix b/tools/mosdepth.nix index fa1101a..a5083a7 100644 --- a/tools/mosdepth.nix +++ b/tools/mosdepth.nix @@ -1,4 +1,4 @@ -{ bionix, nixpkgs }: +{ bionix }: with bionix; diff --git a/tools/mutect-call.nix b/tools/mutect-call.nix index 9fd009b..e2fe3a1 100644 --- a/tools/mutect-call.nix +++ b/tools/mutect-call.nix @@ -1,13 +1,12 @@ {bionix -, nixpkgs , cosmic , dbsnp}: -with nixpkgs; +with bionix; with lib; let - inherit (bionix.types) matchFiletype; + inherit (types) matchFiletype; getVCFref = matchFiletype "mutect-call" {vcf = {ref}: ref;}; getBAMref = matchFiletype "mutect-call" {bam = {ref, ...}: ref;}; refs = map getVCFref [ cosmic dbsnp ]; @@ -20,7 +19,7 @@ assert (length (unique refs) == 1); assert (ref == getBAMref normal && ref == getBAMref tumour); -stdenv.mkDerivation { +stage { name = "mutect"; buildInputs = [ bionix.mutect.app ]; buildCommand = '' diff --git a/tools/mutect.nix b/tools/mutect.nix index 627b77e..59aff0a 100644 --- a/tools/mutect.nix +++ b/tools/mutect.nix @@ -1,9 +1,8 @@ -{bionix, nixpkgs}: +{bionix}: -with nixpkgs; with bionix; { - app = callPackage ./mutect-app.nix {inherit (nixpkgs) stdenv fetchurl makeWrapper unzip fetchFromGitHub;}; + app = pkgs.callPackage ./mutect-app.nix {inherit (pkgs) stdenv fetchurl makeWrapper unzip fetchFromGitHub;}; call = callBionixE ./mutect-call.nix; } diff --git a/tools/platypus-callVariants.nix b/tools/platypus-callVariants.nix index a57aa83..a5e497e 100644 --- a/tools/platypus-callVariants.nix +++ b/tools/platypus-callVariants.nix @@ -1,5 +1,4 @@ { bionix -, nixpkgs , indexAttrs ? {} , bamIndexAttrs ? {} , flags ? null @@ -7,9 +6,9 @@ inputs: -with nixpkgs; +with bionix; with lib; -with bionix.types; +with types; let @@ -21,9 +20,9 @@ in assert (length (unique refs) == 1); -stdenv.mkDerivation { +stage { name = "platypus"; - buildInputs = [ platypus ]; + buildInputs = with pkgs; [ platypus ]; buildCommand = '' ln -s ${ref} ref.fa ln -s ${bionix.samtools.faidx indexAttrs ref} ref.fa.fai diff --git a/tools/platypus.nix b/tools/platypus.nix index 1b214dc..4379675 100644 --- a/tools/platypus.nix +++ b/tools/platypus.nix @@ -1,4 +1,4 @@ -{ bionix, nixpkgs }: +{ bionix }: with bionix; diff --git a/tools/samtools-dict.nix b/tools/samtools-dict.nix index 80ec1e0..f9de70f 100644 --- a/tools/samtools-dict.nix +++ b/tools/samtools-dict.nix @@ -1,19 +1,18 @@ { bionix -, nixpkgs , flags ? null }: input: -with nixpkgs; +with bionix; with lib; -with bionix.types; +with types; assert (matchFiletype "samtools-dict" { fa = _: true; } input); -stdenv.mkDerivation { +stage { name = "samtools-dict"; - buildInputs = [ samtools ]; + buildInputs = with pkgs; [ samtools ]; buildCommand = '' samtools dict ${optionalString (flags != null) flags} ${input} > $out ''; diff --git a/tools/samtools-faidx.nix b/tools/samtools-faidx.nix index 1fde411..45e055b 100644 --- a/tools/samtools-faidx.nix +++ b/tools/samtools-faidx.nix @@ -1,20 +1,19 @@ { bionix -, nixpkgs , flags ? null }: input: -with nixpkgs; +with bionix; with lib; -with bionix.types; +with types; assert (matchFiletype "samtools-faidx" { fa = _: true; } input); -stdenv.mkDerivation { +stage { name = "samtools-faidx"; - buildInputs = [ samtools ]; + buildInputs = with pkgs; [ samtools ]; buildCommand = '' ln -s ${input} input.fasta samtools faidx ${optionalString (flags != null) flags} input.fasta diff --git a/tools/samtools-fixmate.nix b/tools/samtools-fixmate.nix index 3ffa72c..7c62bdc 100644 --- a/tools/samtools-fixmate.nix +++ b/tools/samtools-fixmate.nix @@ -1,21 +1,20 @@ { bionix -, nixpkgs , mateScore ? true , flags ? null }: input: -with nixpkgs; +with bionix; with lib; -with bionix.types; +with types; assert (matchFiletype "samtools-fixmate" { bam = _: true; } input); assert (matchFileSorting "samtools-fixmate" { name = _: true; } input); -stdenv.mkDerivation { +stage { name = "samtools-fixmate"; - buildInputs = [ samtools ]; + buildInputs = with pkgs; [ samtools ]; buildCommand = '' samtools fixmate \ ${optionalString mateScore "-m"} \ diff --git a/tools/samtools-flagstat.nix b/tools/samtools-flagstat.nix index ae36c94..57d8bb6 100644 --- a/tools/samtools-flagstat.nix +++ b/tools/samtools-flagstat.nix @@ -1,14 +1,13 @@ { bionix -, nixpkgs }: input: -with nixpkgs; +with bionix; with lib; -stdenv.mkDerivation { +stage { name = "samtools-index"; - buildInputs = [ samtools ]; + buildInputs = with pkgs; [ samtools ]; buildCommand = "samtools flagstat -@ $NIX_BUILD_CORES ${input} > $out"; } diff --git a/tools/samtools-index.nix b/tools/samtools-index.nix index 6919f97..84ebbe1 100644 --- a/tools/samtools-index.nix +++ b/tools/samtools-index.nix @@ -1,20 +1,19 @@ { bionix -, nixpkgs , flags ? null }: input: -with nixpkgs; +with bionix; with lib; -with bionix.types; +with types; assert (matchFiletype "samtools-index" { bam = _: true; } input); assert (matchFileSorting "samtools-index" { coord = _: true; } input); -stdenv.mkDerivation { +stage { name = "samtools-index"; - buildInputs = [ samtools ]; + buildInputs = with pkgs; [ samtools ]; buildCommand = '' ln -s ${input} input.bam samtools index -@ $NIX_BUILD_CORES ${optionalString (flags != null) flags} input.bam diff --git a/tools/samtools-markdup.nix b/tools/samtools-markdup.nix index 73094f2..08b8aa6 100644 --- a/tools/samtools-markdup.nix +++ b/tools/samtools-markdup.nix @@ -1,20 +1,19 @@ { bionix -, nixpkgs , flags ? null }: input: -with nixpkgs; +with bionix; with lib; -with bionix.types; +with types; assert (matchFiletype "samtools-markdup" { bam = _: true; } input); assert (matchFileSorting "samtools-markdup" { coord = _: true; } input); -stdenv.mkDerivation { +stage { name = "samtools-markdup"; - buildInputs = [ samtools ]; + buildInputs = with pkgs; [ samtools ]; buildCommand = '' samtools markdup ${optionalString (flags != null) flags} ${input} $out ''; diff --git a/tools/samtools-merge.nix b/tools/samtools-merge.nix index eacf520..120f825 100644 --- a/tools/samtools-merge.nix +++ b/tools/samtools-merge.nix @@ -1,12 +1,11 @@ { bionix -, nixpkgs , flags ? null , outfmt ? null }: inputs: -with nixpkgs; +with bionix; with lib; let @@ -16,9 +15,9 @@ in assert inputIsHomogenous; -stdenv.mkDerivation { +stage { name = "samtools-merge"; - buildInputs = [ samtools ]; + buildInputs = with pkgs; [ samtools ]; buildCommand = '' samtools merge ${optionalString (flags != null) flags} $out ${concatStringsSep " " inputs} ''; diff --git a/tools/samtools-sort.nix b/tools/samtools-sort.nix index 37df5c8..6f9eb33 100644 --- a/tools/samtools-sort.nix +++ b/tools/samtools-sort.nix @@ -1,5 +1,4 @@ { bionix -, nixpkgs , nameSort ? false , flags ? null , outfmt ? null @@ -7,7 +6,7 @@ input: -with nixpkgs; +with bionix; with lib; let @@ -20,9 +19,9 @@ let outfmtR = if outfmt != null then outfmt input else input.filetype; outFmtFlags = matchFiletype "samtools-sort-outfmt" { bam = _: "-O BAM"; sam = _: "-O SAM"; cram = ref: "-O CRAM -T ${ref}"; } {filetype = outfmtR;}; alreadySorted = matchFileSorting "samtools-sort" { name = _: nameSort; coord = _: !nameSort; none = _: false;} input; -in stdenv.mkDerivation { +in pkgs.stdenv.mkDerivation { name = "samtools-sort"; - buildInputs = [ samtools ]; + buildInputs = with pkgs; [ samtools ]; buildCommand = if alreadySorted then "ln -s ${input} $out" diff --git a/tools/samtools-view.nix b/tools/samtools-view.nix index b791534..e1ca0a8 100644 --- a/tools/samtools-view.nix +++ b/tools/samtools-view.nix @@ -1,5 +1,4 @@ { bionix -, nixpkgs , nameSort ? false , flags ? null , outfmt ? null @@ -7,9 +6,9 @@ input: -with nixpkgs; +with bionix; with lib; -with bionix.types; +with types; assert (matchFiletype "samtools-view" { bam = _: true; sam = _: true; cram = _: true; } input); @@ -17,9 +16,9 @@ let outfmtR = if outfmt != null then outfmt input else input.filetype; fa = ref: matchFiletype "samtools-view-ref" { fa = _: ref; } ref; outfmtFlags = matchFiletype "samtools-view-outfmt" { bam = _: "-O BAM"; sam = _: "-O SAM"; cram = x: "-O CRAM -T ${fa x.ref}"; } {filetype = outfmtR;}; -in stdenv.mkDerivation { +in stage { name = "samtools-view"; - buildInputs = [ samtools ]; + buildInputs = with pkgs; [ samtools ]; buildCommand = '' samtools view ${outfmtFlags} ${optionalString (flags != null) flags} ${input} > $out ''; diff --git a/tools/samtools.nix b/tools/samtools.nix index c29db40..27f3f73 100644 --- a/tools/samtools.nix +++ b/tools/samtools.nix @@ -1,4 +1,4 @@ -{ bionix, nixpkgs }: +{ bionix }: with bionix; diff --git a/tools/snpeff-annotate.nix b/tools/snpeff-annotate.nix index a119c3c..dee99f1 100644 --- a/tools/snpeff-annotate.nix +++ b/tools/snpeff-annotate.nix @@ -1,21 +1,20 @@ {bionix -,nixpkgs ,db ,flags ? ""}: input: -with nixpkgs; -with bionix.types; +with bionix; +with types; assert (matchFiletype "snpeff-annotate" { vcf = _: true; } input); -stdenv.mkDerivation { +stage { name = "snpeff-annotate"; + buildInputs = with pkgs; [ snpeff ]; buildCommand = '' ln -s ${db} ${db.name} snpeff -nodownload -dataDir $TMPDIR ${db.name} ${input} > $out ''; - buildInputs = [ snpeff ]; passthru.filetype = input.filetype; } diff --git a/tools/snpeff-dbnsfp.nix b/tools/snpeff-dbnsfp.nix index f9fbdaa..5e7c91a 100644 --- a/tools/snpeff-dbnsfp.nix +++ b/tools/snpeff-dbnsfp.nix @@ -1,16 +1,15 @@ {bionix -,nixpkgs ,dbnsfp ,flags ? ""}: input: -with nixpkgs; -with bionix.types; +with bionix; +with types; assert (matchFiletype "snpeff-dbnsfp" { vcf = _: true; } input); -stdenv.mkDerivation { +stage { name = "snpeff-dbnsfp"; buildCommand = '' ln -s ${dbnsfp.db} dbNSFP.txt.gz diff --git a/tools/snpeff.nix b/tools/snpeff.nix index 2df8056..c5ef04d 100644 --- a/tools/snpeff.nix +++ b/tools/snpeff.nix @@ -1,4 +1,4 @@ -{bionix, nixpkgs}: +{bionix}: with bionix; diff --git a/tools/strelka-call.nix b/tools/strelka-call.nix index bcbb6d1..95ce0f6 100644 --- a/tools/strelka-call.nix +++ b/tools/strelka-call.nix @@ -1,5 +1,4 @@ { bionix -, nixpkgs , indexAttrs ? {} , bamIndexAttrs ? {} , flags ? null @@ -7,9 +6,9 @@ {normal, tumour}: -with nixpkgs; +with bionix; with lib; -with bionix.types; +with types; let filename = path: last (splitString "/" path); @@ -22,9 +21,9 @@ in assert (length (unique refs) == 1); -stdenv.mkDerivation { +pkgs.stdenv.mkDerivation { name = "strelka"; - buildInputs = [ strelka ]; + buildInputs = with pkgs; [ strelka ]; buildCommand = '' ln -s ${ref} ref.fa ln -s ${bionix.samtools.faidx indexAttrs ref} ref.fa.fai diff --git a/tools/strelka.nix b/tools/strelka.nix index d9d97b1..47d5832 100644 --- a/tools/strelka.nix +++ b/tools/strelka.nix @@ -1,4 +1,4 @@ -{ bionix, nixpkgs }: +{ bionix }: with bionix; -- cgit v1.2.3