aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Bedo <cu@cua0.org>2021-10-29 17:39:01 +1100
committerJustin Bedo <cu@cua0.org>2021-10-29 17:39:01 +1100
commitbac9248a5e08e8afdf5485a6e27cfe72e1ca5090 (patch)
tree8719a280b56122017d46b582cd3da8547dd3f548
parentab809b8c77efdad9fb54d3591a0193a1cbe888d1 (diff)
treewide reformatting and simplification
- simplify with statix - reformat with nixpkgs-fmt
-rw-r--r--default.nix87
-rw-r--r--doc/default.nix2
-rw-r--r--examples/call.nix16
-rw-r--r--examples/default.nix9
-rw-r--r--examples/ex-nextflow/nextflow-example1.nix8
-rw-r--r--examples/ex-tnpair/cluster.nix14
-rw-r--r--examples/ex-tnpair/default.nix3
-rw-r--r--examples/ex-tnpair/tnpair.nix33
-rw-r--r--examples/ex-wdl/wdl-scatter-gather.nix5
-rw-r--r--lib/google.nix4
-rw-r--r--lib/qsub.nix139
-rw-r--r--lib/references.nix194
-rw-r--r--lib/shard-regex.nix64
-rw-r--r--lib/shard.nix6
-rw-r--r--lib/slurm.nix39
-rw-r--r--lib/types.nix32
-rw-r--r--test-tnpair.nix101
-rw-r--r--tools/ascat-app.nix19
-rw-r--r--tools/ascat-callCNV.nix6
-rw-r--r--tools/ascat.nix8
-rw-r--r--tools/bowtie-align.nix7
-rw-r--r--tools/bowtie.nix4
-rw-r--r--tools/bwa-mem.nix7
-rw-r--r--tools/bwa-mem2-app.nix2
-rw-r--r--tools/bwa-mem2.nix7
-rw-r--r--tools/bwa.nix6
-rw-r--r--tools/cnvkit-batch.nix15
-rw-r--r--tools/cnvkit-scatter.nix5
-rw-r--r--tools/cnvkit.nix6
-rw-r--r--tools/compression-bunzip2.nix2
-rw-r--r--tools/compression-bzip2.nix2
-rw-r--r--tools/compression-gunzip.nix2
-rw-r--r--tools/compression-gzip.nix2
-rw-r--r--tools/compression.nix75
-rw-r--r--tools/crumble-app.nix2
-rw-r--r--tools/crumble.nix2
-rw-r--r--tools/delly-call.nix4
-rw-r--r--tools/delly.nix2
-rw-r--r--tools/facets-app.nix14
-rw-r--r--tools/facets-call.nix4
-rw-r--r--tools/facets.nix6
-rw-r--r--tools/fastp-check.nix45
-rw-r--r--tools/fastp.nix6
-rw-r--r--tools/fastqc.nix4
-rw-r--r--tools/gridss-assemble.nix14
-rw-r--r--tools/gridss-callVariants.nix28
-rw-r--r--tools/gridss-computeSamTags.nix12
-rw-r--r--tools/gridss-configFile.nix62
-rw-r--r--tools/gridss-extractSVReads.nix6
-rw-r--r--tools/gridss-softClipsToSplitReads.nix8
-rw-r--r--tools/gridss-variants.nix24
-rw-r--r--tools/gridss.nix41
-rw-r--r--tools/hisat2-align.nix7
-rw-r--r--tools/hisat2-index.nix4
-rw-r--r--tools/hisat2.nix4
-rw-r--r--tools/infercnv-app.nix42
-rw-r--r--tools/infercnv-infer.nix12
-rw-r--r--tools/infercnv.nix6
-rw-r--r--tools/kallisto-index.nix5
-rw-r--r--tools/kallisto-quant.nix11
-rw-r--r--tools/kallisto.nix4
-rw-r--r--tools/last-align.nix9
-rw-r--r--tools/last.nix2
-rw-r--r--tools/lumpy-call.nix5
-rw-r--r--tools/lumpy.nix2
-rw-r--r--tools/manta-call.nix6
-rw-r--r--tools/manta.nix2
-rw-r--r--tools/minimap2-align.nix5
-rw-r--r--tools/minimap2.nix2
-rw-r--r--tools/mosdepth-depth.nix2
-rw-r--r--tools/mosdepth-plot.nix3
-rw-r--r--tools/mosdepth.nix4
-rw-r--r--tools/mutect-app.nix19
-rw-r--r--tools/mutect-call.nix11
-rw-r--r--tools/mutect.nix6
-rw-r--r--tools/octopus-call.nix4
-rw-r--r--tools/octopus-callSomatic.nix4
-rw-r--r--tools/octopus.nix6
-rw-r--r--tools/picard-markDuplicates.nix34
-rw-r--r--tools/picard.nix8
-rw-r--r--tools/platypus-callVariants.nix8
-rw-r--r--tools/platypus.nix2
-rw-r--r--tools/sambamba.nix25
-rw-r--r--tools/samtools-merge.nix4
-rw-r--r--tools/samtools-sort.nix7
-rw-r--r--tools/samtools-view.nix5
-rw-r--r--tools/snap-align.nix7
-rw-r--r--tools/snap-app.nix2
-rw-r--r--tools/snap.nix6
-rw-r--r--tools/snpeff-annotate.nix9
-rw-r--r--tools/snpeff-dbnsfp.nix9
-rw-r--r--tools/snpeff.nix8
-rw-r--r--tools/snver-call.nix2
-rw-r--r--tools/snver.nix4
-rw-r--r--tools/star-align.nix7
-rw-r--r--tools/star-index.nix4
-rw-r--r--tools/star.nix2
-rw-r--r--tools/strelka-call.nix77
-rw-r--r--tools/strelka-callSomatic.nix81
-rw-r--r--tools/strelka.nix4
-rw-r--r--tools/whisper-align.nix7
-rw-r--r--tools/whisper.nix2
-rw-r--r--tools/xenomapper-allocate.nix6
-rw-r--r--tools/xenomapper.nix6
104 files changed, 936 insertions, 802 deletions
diff --git a/default.nix b/default.nix
index 1944de0..59357b2 100644
--- a/default.nix
+++ b/default.nix
@@ -5,10 +5,11 @@ let
bionix = nixpkgs.lib.makeExtensible (self:
let callBionix = file: attrs: import file ({ bionix = self; } // attrs);
- in with self; {
- callBionix = callBionix;
+ in
+ with self; {
+ inherit callBionix;
id = x: x;
- exec = f: x: y: f x y;
+ exec = id;
exec' = f: exec (_: f) { };
exec'' = f: exec' (_: f) { };
callBionixE = p: exec (callBionix p);
@@ -52,15 +53,17 @@ let
slurm-run = callPackage ./lib/slurm.nix { };
slurm-exec = f: x: y:
- slurm-run x (f (builtins.removeAttrs x [
- "ppn"
- "mem"
- "walltime"
- "partition"
- "slurmFlags"
- "salloc"
- "srun"
- ]) y);
+ slurm-run x (f
+ (builtins.removeAttrs x [
+ "ppn"
+ "mem"
+ "walltime"
+ "partition"
+ "slurmFlags"
+ "salloc"
+ "srun"
+ ])
+ y);
slurm = bionix.extend (self: super: { exec = super.slurm-run; });
qsub = attrs:
bionix.extend (self: super:
@@ -78,7 +81,8 @@ let
qsub = attrs: (callPackage ./lib/qsub.nix { }) (qsubDefs // attrs);
exec = f: x: y:
qsub (builtins.intersectAttrs qsubDefs x) (super.exec f
- (builtins.removeAttrs x (builtins.attrNames qsubDefs)) y);
+ (builtins.removeAttrs x (builtins.attrNames qsubDefs))
+ y);
});
def = f: defs: attrs: f (defs // attrs);
@@ -88,22 +92,24 @@ let
name = "link-outputs";
outputs = [ "out" ] ++ attrNames x;
nativeBuildInputs = [ pkgs.perl ];
- buildCommand = let
- recurse = x:
- if x ? type && x.type == "derivation" then
- x
- else if builtins.typeOf x == "set" then
- linkOutputs x
- else
- abort "linkOutputs: unsupported type";
- link = dst: src: ''
- ln -s ${recurse src} $(perl -e 'print $ENV{"${dst}"}') ; ln -s ${
- recurse src
- } $out/${dst}
- '';
- in ''
- mkdir $out
- '' + (concatStringsSep "\n" (mapAttrsToList link x));
+ buildCommand =
+ let
+ recurse = x:
+ if x ? type && x.type == "derivation" then
+ x
+ else if builtins.typeOf x == "set" then
+ linkOutputs x
+ else
+ abort "linkOutputs: unsupported type";
+ link = dst: src: ''
+ ln -s ${recurse src} $(perl -e 'print $ENV{"${dst}"}') ; ln -s ${
+ recurse src
+ } $out/${dst}
+ '';
+ in
+ ''
+ mkdir $out
+ '' + (concatStringsSep "\n" (mapAttrsToList link x));
passthru.linkInputs = x;
};
@@ -127,15 +133,15 @@ let
# Export nixpkgs and standard library lib
pkgs = nixpkgs;
lib = nixpkgs.lib // {
- types = types;
+ inherit types;
shard = callBionix ./lib/shard.nix { };
};
stage = x@{ name, stripStorePaths ? true, multicore ? false, ... }:
(if stripStorePaths then strip else x: x)
- (nixpkgs.stdenvNoCC.mkDerivation (x // {
- name = "bionix-" + name;
- inherit multicore;
- }));
+ (nixpkgs.stdenvNoCC.mkDerivation (x // {
+ name = "bionix-" + name;
+ inherit multicore;
+ }));
strip = drv:
let
stripCommand = ''
@@ -156,7 +162,8 @@ let
rewriteOutput $o
done
'';
- in drv.overrideAttrs (attrs:
+ in
+ drv.overrideAttrs (attrs:
if attrs ? buildCommand then {
buildCommand = attrs.buildCommand + stripCommand;
} else {
@@ -186,13 +193,15 @@ let
overlayByType = {
lambda = bionix: overlay:
bionix.extend
- (self: super: nixpkgs.lib.recursiveUpdate super (overlay self super));
+ (self: super: nixpkgs.lib.recursiveUpdate super (overlay self super));
path = bionix: path: overlay bionix (import path);
};
overlay = bionix: overlay:
let overlayType = builtins.typeOf overlay;
- in if overlayByType ? ${overlayType} then
- overlayByType.${overlayType} bionix overlay
+ in
+ if overlayByType ? "${overlayType}" then
+ overlayByType."${overlayType}" bionix overlay
else
builtins.throw ("cannot overlay type " + overlayType);
-in with nixpkgs.lib; foldl overlay bionix overlays
+in
+with nixpkgs.lib; foldl overlay bionix overlays
diff --git a/doc/default.nix b/doc/default.nix
index d68a6b1..ac8bfeb 100644
--- a/doc/default.nix
+++ b/doc/default.nix
@@ -1,4 +1,4 @@
-{ bionix ? import ./.. {} }:
+{ bionix ? import ./.. { } }:
with bionix;
diff --git a/examples/call.nix b/examples/call.nix
index 8a38fdb..81a112e 100644
--- a/examples/call.nix
+++ b/examples/call.nix
@@ -2,9 +2,10 @@
# with the Platypus variant caller. Each input is preprocessed by aligning
# against a reference genome (defaults to GRCH38), fixing mate information, and
# marking duplicates. Finally platypus is called over all samples.
-{bionix ? import <bionix> {}
-,inputs
-,ref ? bionix.ref.grch38.seq }:
+{ bionix ? import <bionix> { }
+, inputs
+, ref ? bionix.ref.grch38.seq
+}:
with bionix;
with lib;
@@ -13,9 +14,10 @@ let
preprocess = flip pipe [
(bwa.align { inherit ref; })
(samtools.sort { nameSort = true; })
- (samtools.fixmate {})
- (samtools.sort {})
- (samtools.markdup {})
+ (samtools.fixmate { })
+ (samtools.sort { })
+ (samtools.markdup { })
];
-in platypus.call {} (map preprocess inputs)
+in
+platypus.call { } (map preprocess inputs)
diff --git a/examples/default.nix b/examples/default.nix
index 9aace38..ef57341 100644
--- a/examples/default.nix
+++ b/examples/default.nix
@@ -1,6 +1,6 @@
# This example uses the pipelines specified in the call.nix file on the
# synthetic data in this directory.
-{bionix ? import <bionix> {}}:
+{ bionix ? import <bionix> { } }:
with bionix;
@@ -15,7 +15,7 @@ let
sha256 = "0kh29i6fg14dn0fb1xj6pkpk6d83y7zg7aphkbvjrhm82braqkm8";
};
- input2 = fetchFastQ {
+ input2 = fetchFastQ {
url = "https://github.com/PapenfussLab/bionix/raw/master/examples/sample1-2.fq";
sha256 = "0czk85km6a91y0fn4b7f9q7ps19b5jf7jzwbly4sgznps7ir2kdk";
};
@@ -28,7 +28,7 @@ let
sha256 = "08gixavfklqvk1m2ic6v56z82vl00qnpsd9xb64z6zl03nz98mcy";
};
- input2 = fetchFastQ {
+ input2 = fetchFastQ {
url = "https://github.com/PapenfussLab/bionix/raw/master/examples/sample2-2.fq";
sha256 = "1xxwm2vq52axpdhm14rh5mg5nzzpxaqnvhzrqhajm27fqksgzjjw";
};
@@ -41,4 +41,5 @@ let
sha256 = "0sy9hq8n55knfkiblam50dzaiwhrx6pv8b8l1njdn6kfj4wflz2p";
};
-in import ./call.nix {inherit inputs ref bionix;}
+in
+import ./call.nix { inherit inputs ref bionix; }
diff --git a/examples/ex-nextflow/nextflow-example1.nix b/examples/ex-nextflow/nextflow-example1.nix
index 4f00431..687505c 100644
--- a/examples/ex-nextflow/nextflow-example1.nix
+++ b/examples/ex-nextflow/nextflow-example1.nix
@@ -1,7 +1,8 @@
# This is a translation of the Nextflow example found at
# https://www.nextflow.io/example1.html
-{ bionix ? import ./../.. {}
-, input ? ./sample.fa}:
+{ bionix ? import ./../.. { }
+, input ? ./sample.fa
+}:
with bionix;
with lib;
@@ -24,7 +25,8 @@ let
'';
};
-in pipe input [
+in
+pipe input [
splitSequences
(each reverse)
]
diff --git a/examples/ex-tnpair/cluster.nix b/examples/ex-tnpair/cluster.nix
index 8d54995..5d4e1de 100644
--- a/examples/ex-tnpair/cluster.nix
+++ b/examples/ex-tnpair/cluster.nix
@@ -4,11 +4,12 @@ let
bionix = import <bionix> {
overlays = [
(_: super:
- super."${if tmpDir == null then "slurm" else "qsub"}" {
- ppn = 24;
- mem = 7;
- walltime = "3:00:00";
- } // super.lib.optionalAttrs (tmpDir != null) { inherit tmpDir; })
+ super."${if tmpDir == null then "slurm" else "qsub"}"
+ {
+ ppn = 24;
+ mem = 7;
+ walltime = "3:00:00";
+ } // super.lib.optionalAttrs (tmpDir != null) { inherit tmpDir; })
(self: super:
with super; {
@@ -27,4 +28,5 @@ let
})
];
};
-in import ./. { inherit bionix; }
+in
+import ./. { inherit bionix; }
diff --git a/examples/ex-tnpair/default.nix b/examples/ex-tnpair/default.nix
index f9581f8..65a2265 100644
--- a/examples/ex-tnpair/default.nix
+++ b/examples/ex-tnpair/default.nix
@@ -45,6 +45,7 @@ let
fetch = s: mapAttrs (_: fetchFastQGZ) s.inputs;
-in import ./tnpair.nix {
+in
+import ./tnpair.nix {
inherit pair fetch bionix;
}
diff --git a/examples/ex-tnpair/tnpair.nix b/examples/ex-tnpair/tnpair.nix
index 9e6befe..414a391 100644
--- a/examples/ex-tnpair/tnpair.nix
+++ b/examples/ex-tnpair/tnpair.nix
@@ -1,4 +1,4 @@
-{bionix ? import <bionix> {}, pair, fetch}:
+{ bionix ? import <bionix> { }, pair, fetch }:
with bionix;