From bac9248a5e08e8afdf5485a6e27cfe72e1ca5090 Mon Sep 17 00:00:00 2001 From: Justin Bedo Date: Fri, 29 Oct 2021 17:39:01 +1100 Subject: treewide reformatting and simplification - simplify with statix - reformat with nixpkgs-fmt --- examples/call.nix | 16 ++++++++------- examples/default.nix | 9 ++++---- examples/ex-nextflow/nextflow-example1.nix | 8 +++++--- examples/ex-tnpair/cluster.nix | 14 +++++++------ examples/ex-tnpair/default.nix | 3 ++- examples/ex-tnpair/tnpair.nix | 33 +++++++++++++++++------------- examples/ex-wdl/wdl-scatter-gather.nix | 5 +++-- 7 files changed, 51 insertions(+), 37 deletions(-) (limited to 'examples') 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 {} -,inputs -,ref ? bionix.ref.grch38.seq }: +{ bionix ? import { } +, 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 ? import { } }: 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 { 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 {}, pair, fetch}: +{ bionix ? import { }, pair, fetch }: with bionix; with lib; @@ -13,7 +13,7 @@ let fetch (align { preset = "sr"; ref = ref.grch38.seq; flags = "-R'@RG\\tID:${s.type}\\tSM:${s.type}'"; }) (sort { nameSort = true; }) - (fixmate {}) + (fixmate { }) (sort { }) (markdup { }) ]; @@ -28,21 +28,26 @@ let bams = mapAttrs (_: preprocess) pair; - variants = let - somatic = strelka.callSomatic { } bams; in mapAttrs (_: flip pipe [ - (compression.uncompress { }) - (snpeff.annotate { db = ref.grch38.snpeff.db; }) - dropErrors - (snpeff.dbnsfp { dbnsfp = ref.grch38.snpeff.dbnsfp; }) - ]) { - "snvs.vcf" = somatic.snvs; - "indels.vcf" = somatic.snvs; - "germline.vcf" = strelka.call { } [bams.normal]; - }; + variants = + let + somatic = strelka.callSomatic { } bams; in + mapAttrs + (_: flip pipe [ + (compression.uncompress { }) + (snpeff.annotate { inherit (ref.grch38.snpeff) db; }) + dropErrors + (snpeff.dbnsfp { inherit (ref.grch38.snpeff) dbnsfp; }) + ]) + { + "snvs.vcf" = somatic.snvs; + "indels.vcf" = somatic.snvs; + "germline.vcf" = strelka.call { } [ bams.normal ]; + }; cnvs = cnvkit.callCNV { } { normals = [ bams.normal ]; tumours = [ bams.tumour ]; }; -in linkOutputs { +in +linkOutputs { inherit variants; alignments = linkOutputs (mapAttrs' (n: nameValuePair (n + ".bam")) bams); cnvkit = cnvs; diff --git a/examples/ex-wdl/wdl-scatter-gather.nix b/examples/ex-wdl/wdl-scatter-gather.nix index 61dc441..5245662 100644 --- a/examples/ex-wdl/wdl-scatter-gather.nix +++ b/examples/ex-wdl/wdl-scatter-gather.nix @@ -1,6 +1,6 @@ # The scatter-gather example from https://github.com/openwdl/wdl # translated to bionix -{ bionix ? import ./../.. {} }: +{ bionix ? import ./../.. { } }: with bionix; with lib; @@ -30,4 +30,5 @@ let ''; }; -in gather (map analysis prepare) +in +gather (map analysis prepare) -- cgit v1.2.3