diff options
Diffstat (limited to 'tools')
46 files changed, 147 insertions, 183 deletions
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; } i |