aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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.nix71
-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, 933 insertions, 799 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;
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)
diff --git a/lib/google.nix b/lib/google.nix
index 354b5c5..06b80b3 100644
--- a/lib/google.nix
+++ b/lib/google.nix
@@ -10,7 +10,9 @@ let
"https://raw.githubusercontent.com/circulosmeos/gdown.pl/master/gdown.pl";
sha256 = "1pw3vg70bgf33akbbphpr6zn3jndv0khmsa3k0m877hgzg1v52qv";
};
-in runCommand "gdown" {
+in
+runCommand "gdown"
+{
nativeBuildInputs = [ perl wget ];
outputHashAlgo = "sha256";
outputHash = sha256;
diff --git a/lib/qsub.nix b/lib/qsub.nix
index a8827a8..2528162 100644
--- a/lib/qsub.nix
+++ b/lib/qsub.nix
@@ -4,76 +4,87 @@ with lib;
let escape = x: if builtins.typeOf x == "string" then escapeShellArg x else x;
-in { ppn, mem, walltime, queue ? null, qsubFlags ? null, tmpDir, sleepTime
-, qsubPath ? "/usr/bin" }:
+in
+{ ppn
+, mem
+, walltime
+, queue ? null
+, qsubFlags ? null
+, tmpDir
+, sleepTime
+, qsubPath ? "/usr/bin"
+}:
drv:
let ppnReified = if drv.multicore then ppn else 1;
-in overrideDerivation drv ({ args, builder, name, ... }: {
+in
+overrideDerivation drv ({ args, builder, name, ... }: {
builder = "/bin/bash";
- args = let
- script = writeScript "qsub-script" ''
- #!${stdenv.shell}
- while [ ! -e ${tmpDir}/qsub-$PBS_JOBID ] ; do
- sleep ${toString sleepTime}
- done
- set -a
- . ${tmpDir}/qsub-$PBS_JOBID/nix-set
- set +a
- TMPDIR=${tmpDir}/qsub-$PBS_JOBID
- TEMP=$TMPDIR
- TMP=$TMPDIR
- NIX_BUILD_TOP=$TMPDIR
- cd $TMPDIR
- ${builder} ${concatMapStringsSep " " escape args} &> qsub-log
- echo $? > qsub-exit
- '';
+ args =
+ let
+ script = writeScript "qsub-script" ''
+ #!${stdenv.shell}
+ while [ ! -e ${tmpDir}/qsub-$PBS_JOBID ] ; do
+ sleep ${toString sleepTime}
+ done
+ set -a
+ . ${tmpDir}/qsub-$PBS_JOBID/nix-set
+ set +a
+ TMPDIR=${tmpDir}/qsub-$PBS_JOBID
+ TEMP=$TMPDIR
+ TMP=$TMPDIR
+ NIX_BUILD_TOP=$TMPDIR
+ cd $TMPDIR
+ ${builder} ${concatMapStringsSep " " escape args} &> qsub-log
+ echo $? > qsub-exit
+ '';
- qsub = writeScript "qsub" ''
- #!${stdenv.shell}
- PATH=${qsubPath}
- SHELL=/bin/sh
- NIX_BUILD_CORES=${toString ppnReified}
+ qsub = writeScript "qsub" ''
+ #!${stdenv.shell}
+ PATH=${qsubPath}
+ SHELL=/bin/sh
+ NIX_BUILD_CORES=${toString ppnReified}
- while : ; do
- qsub -l nodes=1:ppn=${toString ppnReified},mem=${
- toString mem
- }gb,walltime=${walltime} \
- -N "${name}" \
- ${optionalString (queue != null) "-q ${queue}"} \
- ${optionalString (qsubFlags != null) qsubFlags} \
- ${script} 2>&1 > id
- if [ $? -eq 0 ] ; then
- break
- fi
- if ! grep "Please retry" id > /dev/null ; then
- cat id >&2
- exit 1
- fi
- sleep ${toString sleepTime}
- done
- id=$(cat id)
- echo $id
+ while : ; do
+ qsub -l nodes=1:ppn=${toString ppnReified},mem=${
+ toString mem
+ }gb,walltime=${walltime} \
+ -N "${name}" \
+ ${optionalString (queue != null) "-q ${queue}"} \
+ ${optionalString (qsubFlags != null) qsubFlags} \
+ ${script} 2>&1 > id
+ if [ $? -eq 0 ] ; then
+ break
+ fi
+ if ! grep "Please retry" id > /dev/null ; then
+ cat id >&2
+ exit 1
+ fi
+ sleep ${toString sleepTime}
+ done
+ id=$(cat id)
+ echo $id
- function cleanup {
- qdel $id 2>/dev/null || true
- sleep ${toString sleepTime}
- rm -rf ${tmpDir}/qsub-$id
- }
- trap cleanup INT TERM EXIT
+ function cleanup {
+ qdel $id 2>/dev/null || true
+ sleep ${toString sleepTime}
+ rm -rf ${tmpDir}/qsub-$id
+ }
+ trap cleanup INT TERM EXIT
- cp -r $TMPDIR ${tmpDir}/qsub-$id
- set > ${tmpDir}/qsub-$id/nix-set
- until qstat -f ''${id%%.} 2>&1 | grep "\(Unknown Job\|job_state = C\)" > /dev/null ; do
- sleep ${toString sleepTime}
- done
- cat ${tmpDir}/qsub-$id/qsub-log
- if [ -e ${tmpDir}/qsub-$id/qsub-exit ]; then
- exitCode=$(cat ${tmpDir}/qsub-$id/qsub-exit)
- else
- exitCode=1
- fi
- exit $exitCode
- '';
+ cp -r $TMPDIR ${tmpDir}/qsub-$id
+ set > ${tmpDir}/qsub-$id/nix-set
+ until qstat -f ''${id%%.} 2>&1 | grep "\(Unknown Job\|job_state = C\)" > /dev/null ; do
+ sleep ${toString sleepTime}
+ done
+ cat ${tmpDir}/qsub-$id/qsub-log
+ if [ -e ${tmpDir}/qsub-$id/qsub-exit ]; then
+ exitCode=$(cat ${tmpDir}/qsub-$id/qsub-exit)
+ else
+ exitCode=1
+ fi
+ exit $exitCode
+ '';
- in [ "-c" qsub ];
+ in
+ [ "-c" qsub ];
})
diff --git a/lib/references.nix b/lib/references.nix
index 23ccde3..fd8c3cc 100644
--- a/lib/references.nix
+++ b/lib/references.nix
@@ -26,7 +26,7 @@ rec {
buildInputs = with pkgs; [ gawk ];
buildCommand = ''
gunzip < $src | awk '/^[^#]/{print "chr" $0;next}{print}' > $out
- '';
+ '';
passthru.filetype = filetype.vcf { ref = seq; };
};
encode.blacklist = stage {
@@ -42,28 +42,30 @@ rec {
'';
};
- ensembl = let version = "74";
- in {
- cdna = stage {
- name = "ensembl-grch37-cdna-${version}";
- src = pkgs.fetchurl {
- url =
- "ftp://ftp.ensembl.org/pub/release-${version}/fasta/homo_sapiens/cdna/Homo_sapiens.GRCh37.${version}.cdna.all.fa.gz";
- sha256 = "1m62hiw17zcxg3sza0aq53885wb8g202j8lc1ilhmkg2izzbyihj";
+ ensembl =
+ let version = "74";
+ in
+ {
+ cdna = stage {
+ name = "ensembl-grch37-cdna-${version}";
+ src = pkgs.fetchurl {
+ url =
+ "ftp://ftp.ensembl.org/pub/release-${version}/fasta/homo_sapiens/cdna/Homo_sapiens.GRCh37.${version}.cdna.all.fa.gz";
+ sha256 = "1m62hiw17zcxg3sza0aq53885wb8g202j8lc1ilhmkg2izzbyihj";
+ };
+ buildCommand = "gunzip < $src > $out";
+ passthru.filetype = filetype.fa { };
};
- buildCommand = "gunzip < $src > $out";
- passthru.filetype = filetype.fa { };
- };
- gtf = stage {
- name = "ensembl-grch37-gtf-${version}";
- src = pkgs.fetchurl {
- url =
- "ftp://ftp.ensembl.org/pub/release-${version}/gtf/homo_sapiens/Homo_sapiens.GRCh37.${version}.gtf.gz";
- sha256 = "1m62hiw17zcxg3sza0aq53885wb8g202j8lc1ilhmkg2izzbyihj";
+ gtf = stage {
+ name = "ensembl-grch37-gtf-${version}";
+ src = pkgs.fetchurl {
+ url =
+ "ftp://ftp.ensembl.org/pub/release-${version}/gtf/homo_sapiens/Homo_sapiens.GRCh37.${version}.gtf.gz";
+ sha256 = "1m62hiw17zcxg3sza0aq53885wb8g202j8lc1ilhmkg2izzbyihj";
+ };
+ buildCommand = "gunzip < $src > $out";
};
- buildCommand = "gunzip < $src > $out";
};
- };
snpeff = {
db = pkgs.stdenv.mkDerivation rec {
name = "GRCh37.75";
@@ -114,7 +116,7 @@ rec {
buildInputs = with pkgs; [ gawk ];
buildCommand = ''
gunzip < $src | awk '/^[^#]/{print "chr" $0;next}{print}' > $out
- '';
+ '';
passthru.filetype = filetype.vcf { ref = seq; };
};
encode.blacklist = stage {
@@ -129,47 +131,49 @@ rec {
gunzip < $bed | awk '{print $1 ":" $2 "-" $3}' > $out
'';
};
- ensembl = let version = "97";
- in {
- cdna = stage {
- name = "ensembl-grch38-cdna-${version}";
- src = pkgs.fetchurl {
- url =
- "ftp://ftp.ensembl.org/pub/release-${version}/fasta/homo_sapiens/cdna/Homo_sapiens.GRCh38.cdna.all.fa.gz";
- sha256 = "1m6hvnvlrsi6bzcmq0lnv0igy3in1a7jp723yc74g4g6zjp3cy8c";
+ ensembl =
+ let version = "97";
+ in
+ {
+ cdna = stage {
+ name = "ensembl-grch38-cdna-${version}";
+ src = pkgs.fetchurl {
+ url =
+ "ftp://ftp.ensembl.org/pub/release-${version}/fasta/homo_sapiens/cdna/Homo_sapiens.GRCh38.cdna.all.fa.gz";
+ sha256 = "1m6hvnvlrsi6bzcmq0lnv0igy3in1a7jp723yc74g4g6zjp3cy8c";
+ };
+ buildCommand = "gunzip < $src > $out";
+ passthru.filetype = filetype.fa { };
};
- buildCommand = "gunzip < $src > $out";
- passthru.filetype = filetype.fa { };
- };
- ncrna = stage {
- name = "ensembl-grch38-ncrna-${version}";
- src = pkgs.fetchurl {
- url =
- "ftp://ftp.ensembl.org/pub/release-${version}/fasta/homo_sapiens/ncrna/Homo_sapiens.GRCh38.ncrna.fa.gz";
- sha256 = "1r0dmybn31wf6xc90z2c08ngivkv39hqa8wqg3vik6s4spwpdhj0";
+ ncrna = stage {
+ name = "ensembl-grch38-ncrna-${version}";
+ src = pkgs.fetchurl {
+ url =
+ "ftp://ftp.ensembl.org/pub/release-${version}/fasta/homo_sapiens/ncrna/Homo_sapiens.GRCh38.ncrna.fa.gz";
+ sha256 = "1r0dmybn31wf6xc90z2c08ngivkv39hqa8wqg3vik6s4spwpdhj0";
+ };
+ buildCommand = "gunzip < $src > $out";
+ passthru.filetype = filetype.fa { };
};
- buildCommand = "gunzip < $src > $out";
- passthru.filetype = filetype.fa { };
- };
- gtf = stage {
- name = "ensembl-grch38-gtf-${version}";
- src = pkgs.fetchurl {
- url =
- "ftp://ftp.ensembl.org/pub/release-${version}/gtf/homo_sapiens/Homo_sapiens.GRCh38.${version}.gtf.gz";
- sha256 = "068ab5jf87il301jcr0576c4q0smv6kxpv94gnrm3qzl6kvmaawd";
+ gtf = stage {
+ name = "ensembl-grch38-gtf-${version}";
+ src = pkgs.fetchurl {
+ url =
+ "ftp://ftp.ensembl.org/pub/release-${version}/gtf/homo_sapiens/Homo_sapiens.GRCh38.${version}.gtf.gz";
+ sha256 = "068ab5jf87il301jcr0576c4q0smv6kxpv94gnrm3qzl6kvmaawd";
+ };
+ buildCommand = "gunzip < $src > $out";
};
- buildCommand = "gunzip < $src > $out";
- };
- gff3 = stage {
- name = "ensembl-grch38-gff-${version}";
- src = pkgs.fetchurl {
- url =
- "ftp://ftp.ensembl.org/pub/release-${version}/gff3/homo_sapiens/Homo_sapiens.GRCh38.${version}.gff3.gz";
- sha256 = "1xvhsn938mw0032qgc9dvw3k2xrhpx77b8ms03fkrs2s67f7zli7";
+ gff3 = stage {
+ name = "ensembl-grch38-gff-${version}";
+ src = pkgs.fetchurl {
+ url =
+ "ftp://ftp.ensembl.org/pub/release-${version}/gff3/homo_sapiens/Homo_sapiens.GRCh38.${version}.gff3.gz";
+ sha256 = "1xvhsn938mw0032qgc9dvw3k2xrhpx77b8ms03fkrs2s67f7zli7";
+ };
+ buildCommand = "gunzip < $src > $out";
};
- buildCommand = "gunzip < $src > $out";
};
- };
snpeff = {
db = pkgs.stdenv.mkDerivation rec {
name = "GRCh38.86";
@@ -221,48 +225,50 @@ rec {
buildCommand = "gunzip < $src > $out";
passthru.filetype = filetype.fa { };
};
- ensembl = let version = "94";
- in {
- cdna = stage {
- name = "ensembl-grcm38-cdna-${version}";
- src = pkgs.fetchurl {
- url =
- "ftp://ftp.ensembl.org/pub/release-${version}/fasta/mus_musculus/cdna/Mus_musculus.GRCm38.cdna.all.fa.gz";
- sha256 = "0khp9l6s35lav2xqp7vkk6ybnz4wjihn7lapjf2lbpnbzjb4hp6d";
+ ensembl =
+ let version = "94";
+ in
+ {
+ cdna = stage {
+ name = "ensembl-grcm38-cdna-${version}";
+ src = pkgs.fetchurl {
+ url =
+ "ftp://ftp.ensembl.org/pub/release-${version}/fasta/mus_musculus/cdna/Mus_musculus.GRCm38.cdna.all.fa.gz";
+ sha256 = "0khp9l6s35lav2xqp7vkk6ybnz4wjihn7lapjf2lbpnbzjb4hp6d";
+ };
+ buildCommand = "gunzip < $src > $out";
+ passthru.filetype = filetype.fa { };
};
- buildCommand = "gunzip < $src > $out";
- passthru.filetype = filetype.fa { };
- };
- ncrna = stage {
- name = "ensembl-grcm38-ncrna-${version}";
- version = "94";
- src = pkgs.fetchurl {
- url =
- "ftp://ftp.ensembl.org/pub/release-${version}/fasta/mus_musculus/ncrna/Mus_musculus.GRCm38.ncrna.fa.gz";
- sha256 = "0d997gm8p2b89rm5d46m2x4vz9lijxarfr2lzylnbi8gyqrbagdd";
+ ncrna = stage {
+ name = "ensembl-grcm38-ncrna-${version}";
+ version = "94";
+ src = pkgs.fetchurl {
+ url =
+ "ftp://ftp.ensembl.org/pub/release-${version}/fasta/mus_musculus/ncrna/Mus_musculus.GRCm38.ncrna.fa.gz";
+ sha256 = "0d997gm8p2b89rm5d46m2x4vz9lijxarfr2lzylnbi8gyqrbagdd";
+ };
+ buildCommand = "gunzip < $src > $out";
+ passthru.filetype = filetype.fa { };
};
- buildCommand = "gunzip < $src > $out";
- passthru.filetype = filetype.fa { };
- };
- gtf = stage {
- name = "ensembl-grcm38-gtf-${version}";
- src = pkgs.fetchurl {
- url =
- "ftp://ftp.ensembl.org/pub/release-${version}/gtf/mus_musculus/Mus_musculus.GRCm38.${version}.gtf.gz";
- sha256 = "0i61jq5i5bcini5nxqxxp3rnz2xzgychvzdn0k451f5rv053lp3v";
+ gtf = stage {
+ name = "ensembl-grcm38-gtf-${version}";
+ src = pkgs.fetchurl {
+ url =
+ "ftp://ftp.ensembl.org/pub/release-${version}/gtf/mus_musculus/Mus_musculus.GRCm38.${version}.gtf.gz";
+ sha256 = "0i61jq5i5bcini5nxqxxp3rnz2xzgychvzdn0k451f5rv053lp3v";
+ };
+ buildCommand = "gunzip < $src > $out";
};
- buildCommand = "gunzip < $src > $out";
- };
- gff3 = stage {
- name = "ensembl-grcm38-gff-${version}";
- src = pkgs.fetchurl {
- url =
- "ftp://ftp.ensembl.org/pub/release-${version}/gff3/mus_musculus/Mus_musculus.GRCm38.${version}.gff3.gz";
- sha256 = "15fmdpx6g96fygwhs10jwrb2q5p9y64bc3d4clg856k57qzzgprg";
+ gff3 = stage {
+ name = "ensembl-grcm38-gff-${version}";
+ src = pkgs.fetchurl {
+ url =
+ "ftp://ftp.ensembl.org/pub/release-${version}/gff3/mus_musculus/Mus_musculus.GRCm38.${version}.gff3.gz";
+ sha256 = "15fmdpx6g96fygwhs10jwrb2q5p9y64bc3d4clg856k57qzzgprg";
+ };
+ buildCommand = "gunzip < $src > $out";
};
- buildCommand = "gunzip < $src > $out";
};
- };
};
mm10 = mm10-p4;
diff --git a/lib/shard-regex.nix b/lib/shard-regex.nix
index 06fba4d..9dc1720 100644
--- a/lib/shard-regex.nix
+++ b/lib/shard-regex.nix
@@ -1,54 +1,64 @@
-{bionix, n}:
+{ bionix, n }:
with bionix;
with lib.types;
input:
let
- re = let f = matchFiletype' "shard-regex" {
+ re =
+ let f = matchFiletype' "shard-regex" {
fa = _: "^>";
fq = _: "^@";
gz = f;
bz2 = f;
};
- in f input.filetype;
- decompress = matchFiletype "shard-regex-decompression" {
+ in f input.filetype;
+ decompress = matchFiletype "shard-regex-decompression"
+ {
fa = _: "cat";
fq = _: "cat";
gz = _: "gunzip";
bz2 = _: "bunzip2";
- } input;
- compress = matchFiletype "shard-regex-compression" {
+ }
+ input;
+ compress = matchFiletype "shard-regex-compression"
+ {
fa = _: "cat";
fq = _: "cat";
gz = _: "gzip";
bz2 = _: "bzip2";
- } input;
- compressPkgs = with bionix.pkgs; matchFiletype "shard-regex-compression" {
- fa = _: [];
- fq = _: [];
+ }
+ input;
+ compressPkgs = with bionix.pkgs; matchFiletype "shard-regex-compression"
+ {
+ fa = _: [ ];
+ fq = _: [ ];
gz = _: [ gzip ];
bz2 = _: [ bzip2 ];
- } input;
-in stage {
+ }
+ input;
+in
+stage {
name = "shard";
outputs = [ "out" ] ++ builtins.genList (i: "out" + toString (i + 2)) (n - 1);
buildInputs = [ pkgs.gawk ] ++ compressPkgs;
- buildCommand = let
- awkScript = pkgs.writeText "shard.awk" ''
- BEGIN{cout=0}
- FNR==NR{out[nout++] = $0;next}
- /${re}/{cout = (cout + 1) % nout}
- {print > out[cout]}
+ buildCommand =
+ let
+ awkScript = pkgs.writeText "shard.awk" ''
+ BEGIN{cout=0}
+ FNR==NR{out[nout++] = $0;next}
+ /${re}/{cout = (cout + 1) % nout}
+ {print > out[cout]}
+ '';
+ in
+ ''
+ for o in $outputs ; do
+ echo $(basename ''${!o}) >> outputs
+ done
+ awk -f ${awkScript} outputs <(${decompress} < ${input})
+ for o in $outputs ; do
+ ${compress} < $(basename ''${!o}) > ''${!o}
+ done
'';
- in ''
- for o in $outputs ; do
- echo $(basename ''${!o}) >> outputs
- done
- awk -f ${awkScript} outputs <(${decompress} < ${input})
- for o in $outputs ; do
- ${compress} < $(basename ''${!o}) > ''${!o}
- done
- '';
passthru.filetype = input.filetype;
}
diff --git a/lib/shard.nix b/lib/shard.nix
index 95cf251..9b85027 100644
--- a/lib/shard.nix
+++ b/lib/shard.nix
@@ -1,9 +1,9 @@
-{bionix}:
+{ bionix }:
with bionix;
with lib.types;
{
- regex = n: input: outputDrvs (callBionixE ./shard-regex.nix { n = n; } input);
- fastQPair = n: {input1, input2}: lib.zipListsWith (i: j: {input1 = i; input2 = j;}) (lib.shard.regex n input1) (lib.shard.regex n input2);
+ regex = n: input: outputDrvs (callBionixE ./shard-regex.nix { inherit n; } input);
+ fastQPair = n: { input1, input2 }: lib.zipListsWith (i: j: { input1 = i; input2 = j; }) (lib.shard.regex n input1) (lib.shard.regex n input2);
}
diff --git a/lib/slurm.nix b/lib/slurm.nix
index c050628..8c9ad50 100644
--- a/lib/slurm.nix
+++ b/lib/slurm.nix
@@ -4,23 +4,34 @@ with lib;
let escape = x: if builtins.typeOf x == "string" then escapeShellArg x else x;
-in { ppn, mem, walltime, partition ? null, slurmFlags ? null
-, salloc ? "/usr/bin/salloc", srun ? "/usr/bin/srun", ... }:
+in
+{ ppn
+, mem
+, walltime
+, partition ? null
+, slurmFlags ? null
+, salloc ? "/usr/bin/salloc"
+, srun ? "/usr/bin/srun"
+, ...
+}:
drv:
let ppnReified = if drv.multicore then ppn else 1;
-in overrideDerivation drv ({ args, builder, name, ... }: {
+in
+overrideDerivation drv ({ args, builder, name, ... }: {
builder = stdenv.shell;
- args = let
- slurm = writeScript "slurm" ''
- #!${stdenv.shell}
- NIX_BUILD_CORES=${toString ppnReified}
+ args =
+ let
+ slurm = writeScript "slurm" ''
+ #!${stdenv.shell}
+ NIX_BUILD_CORES=${toString ppnReified}
- ${salloc} -c $NIX_BUILD_CORES --mem=${toString mem}G -t ${walltime} \
- -J "${name}" \
- ${optionalString (partition != null) "-p ${partition}"} \
- ${optionalString (slurmFlags != null) slurmFlags} \
- ${srun} ${builder} ${concatMapStringsSep " " escape args}
- '';
+ ${salloc} -c $NIX_BUILD_CORES --mem=${toString mem}G -t ${walltime} \
+ -J "${name}" \
+ ${optionalString (partition != null) "-p ${partition}"} \
+ ${optionalString (slurmFlags != null) slurmFlags} \
+ ${srun} ${builder} ${concatMapStringsSep " " escape args}
+ '';
- in [ "-c" slurm ];
+ in
+ [ "-c" slurm ];
})
diff --git a/lib/types.nix b/lib/types.nix
index fbc7513..7e58ce0 100644
--- a/lib/types.nix
+++ b/lib/types.nix
@@ -1,4 +1,4 @@
-{bionix}:
+{ bionix }:
with bionix;
with lib;
@@ -25,30 +25,30 @@ rec {
matchFiletype = sym: y: x: if x ? filetype then matchFiletype' sym y x.filetype else abort "unknown filetype for ${sym}";
matchFiletype' = sym: y: x: match x (defError (idft sym) y filetype);
filetype = make-type "filetype" {
- fa = {};
- fq = {};
- bam = {ref = any; sorting = sort;};
- sam = {ref = any; sorting = sort;};
- cram = {ref = any; sorting = sort;};
- vcf = {ref = any;};
- bed = {ref = any;};
+ fa = { };
+ fq = { };
+ bam = { ref = any; sorting = sort; };
+ sam = { ref = any; sorting = sort; };
+ cram = { ref = any; sorting = sort; };
+ vcf = { ref = any; };
+ bed = { ref = any; };
gz = filetype;
bz2 = filetype;
};
- toCram = matchFiletype "bam2cram" { bam = filetype.cram; sam = filetype.cram; cram = filetype.cram; };
- toBam = matchFiletype "bam2cram" { bam = filetype.bam; sam = filetype.bam; cram = filetype.bam; };
- toSam = matchFiletype "bam2cram" { bam = filetype.sam; sam = filetype.sam; cram = filetype.sam; };
+ toCram = matchFiletype "bam2cram" { bam = filetype.cram; sam = filetype.cram; inherit (filetype) cram; };
+ toBam = matchFiletype "bam2cram" { inherit (filetype) bam; sam = filetype.bam; cram = filetype.bam; };
+ toSam = matchFiletype "bam2cram" { bam = filetype.sam; inherit (filetype) sam; cram = filetype.sam; };
matchSorting = sym: y: x: match x.sorting (defError (idst sym) y sort);
matchFileSorting = sym: y: let f = matchSorting sym y; in matchFiletype sym { bam = f; sam = f; cram = f; };
sort = make-type "sort" {
- none = {};
- coord = {};
- name = {};
+ none = { };
+ coord = { };
+ name = { };
};
- coordSort = f: matchFiletype "coordSort" { bam = x: filetype.bam (x // {sorting = sort.coord {};}); } {filetype = f;};
- nameSort = f: matchFiletype "nameSort" { bam = x: filetype.bam (x // {sorting = sort.name {};}); } {filetype = f;};
+ coordSort = f: matchFiletype "coordSort" { bam = x: filetype.bam (x // { sorting = sort.coord { }; }); } { filetype = f; };
+ nameSort = f: matchFiletype "nameSort" { bam = x: filetype.bam (x // { sorting = sort.name { }; }); } { filetype = f; };
gunzip = matchFiletype "gunzip" { gz = x: x; };
bunzip2 = matchFiletype "bunzip2" { bz2 = x: x; };
diff --git a/test-tnpair.nix b/test-tnpair.nix
index 6eb2e23..9ba0e51 100644
--- a/test-tnpair.nix
+++ b/test-tnpair.nix
@@ -1,4 +1,4 @@
-with import <bionix> {};
+with import <bionix> { };
with lib;
let
@@ -6,28 +6,32 @@ let
name = baseNameOf path;
buildCommand = "ln -s ${path} $out";
};
- fetchfq = attrs: types.tagFiletype (types.filetype.fq {}) (fetchlocal attrs);
- fetchfa = attrs: types.tagFiletype (types.filetype.fa {}) (fetchlocal attrs);
+ fetchfq = attrs: types.tagFiletype (types.filetype.fq { }) (fetchlocal attrs);
+ fetchfa = attrs: types.tagFiletype (types.filetype.fa { }) (fetchlocal attrs);
ref = fetchfa ./examples/ref.fa;
- alignWithRG = rg: x: nameSort (bwa.align { inherit ref; flags = "-R'@RG\\tID:${rg}\\tSM:${rg}'";} x);
- sort = samtools.sort {};
- nameSort = samtools.sort {nameSort = true;};
- flagstat = samtools.flagstat {};
- check-fastqc = fastqc.check {};
- check-fastp = fastp.check {};
- callVariants = strelka.callSomatic {};
- markdup = samtools.markdup {};
- fixmate = samtools.fixmate {};
+ alignWithRG = rg: x: nameSort (bwa.align { inherit ref; flags = "-R'@RG\\tID:${rg}\\tSM:${rg}'"; } x);
+ sort = sambamba.sort { };
+ nameSort = sambamba.sort { nameSort = true; };
+ flagstat = samtools.flagstat { };
+ check-fastqc = fastqc.check { };
+ check-fastp = fastp.check { };
+ callVariants = strelka.callSomatic { };
+ markdup = samtools.markdup { };
+ fixmate = samtools.fixmate { };
tnpair = {
- tumour = {name = "mysample1"; files = {
+ tumour = {
+ name = "mysample1";
+ files = {
input1 = fetchfq ./examples/sample1-1.fq;
input2 = fetchfq ./examples/sample1-2.fq;
};
};
- normal = {name = "mysample2"; files = {
+ normal = {
+ name = "mysample2";
+ files = {
input1 = fetchfq ./examples/sample2-1.fq;
input2 = fetchfq ./examples/sample2-2.fq;
};
@@ -37,36 +41,36 @@ let
processPair = { tumour, normal }: rec {
alignments = mapAttrs (_: x: markdup (sort (fixmate (alignWithRG x.name x.files)))) { inherit normal tumour; };
variants = callVariants alignments;
- octopusSomatic = octopus.callSomatic {} {inherit (alignments) normal; tumours = [ alignments.tumour ];};
- glvariants = strelka.call {} (builtins.attrValues alignments);
- platypusVars = platypus.call {} (builtins.attrValues alignments);
- octopusVars = octopus.call {} (builtins.attrValues alignments);
- shards = map (x: nameSort (bwa.align {inherit ref;} x)) (shard.fastQPair 2 normal.files);
+ octopusSomatic = octopus.callSomatic { } { inherit (alignments) normal; tumours = [ alignments.tumour ]; };
+ glvariants = strelka.call { } (builtins.attrValues alignments);
+ platypusVars = platypus.call { } (builtins.attrValues alignments);
+ octopusVars = octopus.call { } (builtins.attrValues alignments);
+ shards = map (x: nameSort (bwa.align { inherit ref; } x)) (shard.fastQPair 2 normal.files);
};
tnpairResult = processPair tnpair;
cnvkitResults = rec {
- cnvs = cnvkit.callCNV {} (with tnpairResult.alignments; { normals = [ normal ]; tumours = [ tumour ];});
- plot = cnvkit.scatterPlot {} cnvs.out1;
+ cnvs = cnvkit.callCNV { } (with tnpairResult.alignments; { normals = [ normal ]; tumours = [ tumour ]; });
+ plot = cnvkit.scatterPlot { } cnvs.out1;
};
alignments = {
- "bowtie-normal.bam" = bowtie.align {inherit ref;} tnpair.normal.files;
- "last.maf" = lastal.align {inherit ref;} tnpair.normal.files;
- "whisper.bam" = whisper.align {inherit ref;} tnpair.normal.files;
- "bwa-mem.bam" = bwa.mem {inherit ref;} tnpair.normal.files;
- "bwa-mem2.bam" = bwa.mem2 {inherit ref;} tnpair.normal.files;
- "minimap2-normal.bam" = minimap2.align {inherit ref; preset = "sr"; } tnpair.normal.files;
- "snap-normal.bam" = snap.align {inherit ref; } tnpair.normal.files;
+ "bowtie-normal.bam" = bowtie.align { inherit ref; } tnpair.normal.files;
+ "last.maf" = lastal.align { inherit ref; } tnpair.normal.files;
+ "whisper.bam" = whisper.align { inherit ref; } tnpair.normal.files;
+ "bwa-mem.bam" = bwa.mem { inherit ref; } tnpair.normal.files;
+ "bwa-mem2.bam" = bwa.mem2 { inherit ref; } tnpair.normal.files;
+ "minimap2-normal.bam" = minimap2.align { inherit ref; preset = "sr"; } tnpair.normal.files;
+ "snap-normal.bam" = snap.align { inherit ref; } tnpair.normal.files;
"${tnpair.tumour.name}.flagstat" = flagstat tnpairResult.alignments.tumour;
- "hisat2-normal.bam" = hisat2.align {inherit ref;} tnpair.normal.files;
+ "hisat2-normal.bam" = hisat2.align { inherit ref; } tnpair.normal.files;
};
testNaming = linkOutputs {
- crai = samtools.index {} (samtools.view { outfmt = types.toCram; } tnpairResult.alignments.tumour);
- kallisto = kallisto.quant {inherit ref;} (attrValues tnpair.tumour.files);
- facets = facets.callCNV {} {vcf = tnpairResult.platypusVars; bams = with tnpairResult.alignments; [ normal tumour ];};
+ crai = samtools.index { } (samtools.view { outfmt = types.toCram; } tnpairResult.alignments.tumour);
+ kallisto = kallisto.quant { inherit ref; } (attrValues tnpair.tumour.files);
+ facets = facets.callCNV { } { vcf = tnpairResult.platypusVars; bams = with tnpairResult.alignments; [ normal tumour ]; };
cnvkit = cnvkitResults.cnvs;
"cnvkit.pdf" = cnvkitResults.plot;
"octopus.vcf" = tnpairResult.octopusVars;
@@ -74,24 +78,25 @@ let
strelka-indels = tnpairResult.variants.indels;
"strelka.snvs.vcf" = tnpairResult.variants.snvs;
"strelka.gl.vcf" = tnpairResult.glvariants;
- delly = delly.call {} (with tnpairResult.alignments; [normal tumour]);
- lumpy = lumpy.call {} (with tnpairResult.alignments; [normal tumour]);
- manta = manta.call {} (with tnpairResult.alignments; {normals = [normal tumour]; });
- mantaTN = manta.call {} (with tnpairResult.alignments; {normals = [normal]; tumour = tumour;});
- mantaT = manta.call {} (with tnpairResult.alignments; {tumour = tumour;});
- gridss = gridss.callVariants {} (with tnpairResult.alignments; [normal tumour]);
- gridss2 = gridss.call (with tnpairResult.alignments; [normal tumour]);
- gridss3 = gridss.callAndAssemble (with tnpairResult.alignments; [normal tumour]);
- "merged-shards.bam" = samtools.merge {} tnpairResult.shards;
- "merged.bam" = samtools.merge {} [tnpairResult.alignments.tumour tnpairResult.alignments.normal];
- "merged-namesorted.bam" = samtools.merge {} [(nameSort tnpairResult.alignments.tumour) (nameSort tnpairResult.alignments.normal)];
- "${tnpair.tumour.name}.cram" = samtools.view { outfmt = types.toCram; } (tnpairResult.alignments.tumour);
+ delly = delly.call { } (with tnpairResult.alignments; [ normal tumour ]);
+ lumpy = lumpy.call { } (with tnpairResult.alignments; [ normal tumour ]);
+ manta = manta.call { } (with tnpairResult.alignments; { normals = [ normal tumour ]; });
+ mantaTN = manta.call { } (with tnpairResult.alignments; { normals = [ normal ]; inherit tumour; });
+ mantaT = manta.call { } (with tnpairResult.alignments; { inherit tumour; });
+ gridss = gridss.callVariants { } (with tnpairResult.alignments; [ normal tumour ]);
+ gridss2 = gridss.call (with tnpairResult.alignments; [ normal tumour ]);
+ gridss3 = gridss.callAndAssemble (with tnpairResult.alignments; [ normal tumour ]);
+ "merged-shards.bam" = samtools.merge { } tnpairResult.shards;
+ "merged.bam" = samtools.merge { } [ tnpairResult.alignments.tumour tnpairResult.alignments.normal ];
+ "merged-namesorted.bam" = samtools.merge { } [ (nameSort tnpairResult.alignments.tumour) (nameSort tnpairResult.alignments.normal) ];
+ "${tnpair.tumour.name}.cram" = samtools.view { outfmt = types.toCram; } tnpairResult.alignments.tumour;
"${tnpair.tumour.name}.fastqc.1" = check-fastqc tnpair.tumour.files.input1;
"${tnpair.tumour.name}.fastp" = check-fastp tnpair.tumour.files;
- snver = snver.call { ploidy=1; } tnpairResult.alignments;
- mosdepth = mosdepth.plot {} { inputs = mapAttrsToList (_: mosdepth.depth {}) tnpairResult.alignments; names = [ "seq1" "seq2" ]; };
- xenomapper = xenomapper.allocate {} { primary = nameSort tnpairResult.alignments.tumour; secondary = nameSort tnpairResult.alignments.tumour; };
+ snver = snver.call { ploidy = 1; } tnpairResult.alignments;
+ mosdepth = mosdepth.plot { } { inputs = mapAttrsToList (_: mosdepth.depth { }) tnpairResult.alignments; names = [ "seq1" "seq2" ]; };
+ xenomapper = xenomapper.allocate { } { primary = nameSort tnpairResult.alignments.tumour; secondary = nameSort tnpairResult.alignments.tumour; };
inherit alignments;
};
-in testNaming
+in
+testNaming
diff --git a/tools/ascat-app.nix b/tools/ascat-app.nix
index 51aa677..bd6d538 100644
--- a/tools/ascat-app.nix
+++ b/tools/ascat-app.nix
@@ -1,4 +1,4 @@
-{stdenv, callPackage, buildPerlPackage, fetchurl, fetchFromGitHub, perlPackages, R, bwa, samtools, pkgconfig, zlib, htslib, curl, bzip2, lzma, gnutls, nettle, gmp, p11-kit, libtasn1, perl, psmisc, time, vcftools, rWrapper, rPackages}:
+{ stdenv, callPackage, buildPerlPackage, fetchurl, fetchFromGitHub, perlPackages, R, bwa, samtools, pkgconfig, zlib, htslib, curl, bzip2, lzma, gnutls, nettle, gmp, p11-kit, libtasn1, perl, psmisc, time, vcftools, rWrapper, rPackages }:
let
ascat = fetchurl {
@@ -98,7 +98,7 @@ let
url = "mirror://cpan/authors/id/C/CD/CDRAUG/${name}.tar.gz";
sha256 = "0yvhgifs8g9rwdcq84zw4b005nq2jml6c75zgjscv6d2pd3lj1ss";
};
- propagatedBuildInputs = with perlPackages; [DBI DataStag Error GD Graph HTTPMessage HTTPMessage IOstringy IOString IPCRun LWP ListMoreUtils SetScalar TestMost TestRequiresInternet URI XMLDOM XMLDOMXPath XMLLibXML XMLLibXML libxml_perl XMLSAX XMLSAXBase XMLSAXWriter XMLTwig XMLWriter YAML DBFile ];
+ propagatedBuildInputs = with perlPackages; [ DBI DataStag Error GD Graph HTTPMessage HTTPMessage IOstringy IOString IPCRun LWP ListMoreUtils SetScalar TestMost TestRequiresInternet URI XMLDOM XMLDOMXPath XMLLibXML XMLLibXML libxml_perl XMLSAX XMLSAXBase XMLSAXWriter XMLTwig XMLWriter YAML DBFile ];
nativeBuildInputs = with perlPackages; [ TestException TestWarn TestDifferences TestDeep ];
};
@@ -108,7 +108,7 @@ let
url = "mirror://cpan/authors/id/C/CM/CMUNGALL/${name}.tar.gz";
sha256 = "0ncf4l39ka23nb01jlm6rzxdb5pqbip01x0m38bnvf1gim825caa";
};
- propagatedBuildInputs = with perlPackages; [IOString Graph XMLLibXSLT ];
+ propagatedBuildInputs = with perlPackages; [ IOString Graph XMLLibXSLT ];
};
XMLDOMXPath = buildPerlPackage rec {
@@ -117,7 +117,7 @@ let
url = "mirror://cpan/authors/id/M/MI/MIROD/${name}.tar.gz";
sha256 = "1si9m1pqih3ibbd6jnw69fh98dd4krxpx90p65x9j4aja55afwq1";
};
- propagatedBuildInputs= with perlPackages; [XMLDOM XMLXPathEngine];
+ propagatedBuildInputs = with perlPackages; [ XMLDOM XMLXPathEngine ];
doCheck = false;
};
@@ -215,10 +215,10 @@ let
name = "alleleCount.pl-${version}";
version = "4.0.1";
src = fetchFromGitHub {
- owner = "cancerit";
- repo = "alleleCount";
- rev = "v${version}";
- sha256 = "0nkwnjqglgshzhlmz1r0khdjai9mfz4ih8bzrzg0g18d1725k6gp";
+ owner = "cancerit";
+ repo = "alleleCount";
+ rev = "v${version}";
+ sha256 = "0nkwnjqglgshzhlmz1r0khdjai9mfz4ih8bzrzg0g18d1725k6gp";
};
preConfigure = ''
cd perl
@@ -266,4 +266,5 @@ let
];
};
-in ascatNGS
+in
+ascatNGS
diff --git a/tools/ascat-callCNV.nix b/tools/ascat-callCNV.nix
index f74bb18..aa1a8ec 100644
--- a/tools/ascat-callCNV.nix
+++ b/tools/ascat-callCNV.nix
@@ -1,12 +1,12 @@
{ bionix
, ref
, gc
-, indexAttrs ? {}
-, bamIndexAttrs ? {}
+, indexAttrs ? { }
+, bamIndexAttrs ? { }
, flags ? null
}:
-{tumour, normal, gender}:
+{ tumour, normal, gender }:
with bionix;
with lib;
diff --git a/tools/ascat.nix b/tools/ascat.nix
index 700cb4e..142e0d9 100644
--- a/tools/ascat.nix
+++ b/tools/ascat.nix
@@ -1,17 +1,17 @@
-{bionix}:
+{ bionix }:
with bionix;
{
- app = pkgs.callPackage ./ascat-app.nix {};
+ app = pkgs.callPackage ./ascat-app.nix { };
/* Generate GC correction file for ascatNGS.
- Type: gccorrect :: {ref :: fasta, chrPrefix :: string, ...} -> (snps :: VCF) -> (gc :: GC)
+ Type: gccorrect :: {ref :: fasta, chrPrefix :: string, ...} -> (snps :: VCF) -> (gc :: GC)
*/
gccorrect = callBionixE ./ascat-gccorrect.nix;
/* Call CNVs using ascatNGS. Gender is a string as per ascatNGS docs (e.g., "XX").
- Type: callCNV :: {ref :: fasta, gc :: GC, ...} -> {tumour :: bam, normal :: bam, gender :: string} -> CNVs
+ Type: callCNV :: {ref :: fasta, gc :: GC, ...} -> {tumour :: bam, normal :: bam, gender :: string} -> CNVs
*/
callCNV = callBionixE ./ascat-callCNV.nix;
}
diff --git a/tools/bowtie-align.nix b/tools/bowtie-align.nix
index c83c49c..8df3dba 100644
--- a/tools/bowtie-align.nix
+++ b/tools/bowtie-align.nix
@@ -2,7 +2,7 @@
, ref
, bamOutput ? true
, flags ? null
-, indexAttrs ? {}
+, indexAttrs ? { }
}:
{ input1
@@ -18,7 +18,8 @@ let
fa = f: matchFiletype "bowtie2-ref" { fa = _: f; } f;
fq = f: matchFiletype "bowtie2-input" { fq = _: f; gz = matchFiletype' "bowtie2-input" { fq = _: f; }; } f;
-in stage {
+in
+stage {
name = "bowtie2-align";
buildInputs = with pkgs; [ bowtie2 bc samtools ];
buildCommand = ''
@@ -32,6 +33,6 @@ in stage {
${optionalString bamOutput "| samtools view -b"} \
> $out
'';
- passthru.filetype = if bamOutput then filetype.bam {ref = ref; sorting = sort.none {};} else filetype.sam {ref = ref; sorting = sort.name {};};
+ passthru.filetype = if bamOutput then filetype.bam { inherit ref; sorting = sort.none { }; } else filetype.sam { inherit ref; sorting = sort.name { }; };
passthru.multicore = true;
}
diff --git a/tools/bowtie.nix b/tools/bowtie.nix
index df97d36..2208dff 100644
--- a/tools/bowtie.nix
+++ b/tools/bowtie.nix
@@ -4,12 +4,12 @@ with bionix;
{
/* Align a sequence against a reference
- Type: align :: {ref :: fasta, bamOutput :: bool, ...} -> {input1 :: fastq, input2 :: fastq} -> bam/sam
+ Type: align :: {ref :: fasta, bamOutput :: bool, ...} -> {input1 :: fastq, input2 :: fastq} -> bam/sam
*/
align = callBionixE ./bowtie-align.nix;
/* Create a Bowtie index
- Type: index :: {seed :: int, ...} -> fasta -> index
+ Type: index :: {seed :: int, ...} -> fasta -> index
*/
index = callBionixE ./bowtie-index.nix;
}
diff --git a/tools/bwa-mem.nix b/tools/bwa-mem.nix
index 31c9487..52e73d1 100644
--- a/tools/bwa-mem.nix
+++ b/tools/bwa-mem.nix
@@ -2,7 +2,7 @@
, ref
, bamOutput ? true
, flags ? null
-, indexAttrs ? {}
+, indexAttrs ? { }
}:
{ input1
@@ -18,7 +18,8 @@ let
fa = f: matchFiletype "bwa-ref" { fa = _: f; } f;
fq = f: matchFiletype "bwa-input" { fq = _: f; gz = matchFiletype' "bwa-input" { fq = _: f; }; } f;
-in stage {
+in
+stage {
name = "bwa-mem";
buildInputs = with pkgs; [ bwa bc ] ++ optional bamOutput samtools;
buildCommand = ''
@@ -35,6 +36,6 @@ in stage {
${optionalString bamOutput "| samtools view -b"} \
> $out
'';
- passthru.filetype = if bamOutput then filetype.bam {ref = ref; sorting = sort.none {};} else filetype.sam {ref = ref; sorting = sort.name {};};
+ passthru.filetype = if bamOutput then filetype.bam { inherit ref; sorting = sort.none { }; } else filetype.sam { inherit ref; sorting = sort.name { }; };
passthru.multicore = true;
}
diff --git a/tools/bwa-mem2-app.nix b/tools/bwa-mem2-app.nix
index 49f4af3..6ee2ab4 100644
--- a/tools/bwa-mem2-app.nix
+++ b/tools/bwa-mem2-app.nix
@@ -1,5 +1,5 @@
{ clangStdenv, fetchFromGitHub, zlib }:
- clangStdenv.mkDerivation rec {
+clangStdenv.mkDerivation rec {
pname = "bwa-mem2";
version = "2.1";
src = fetchFromGitHub {
diff --git a/tools/bwa-mem2.nix b/tools/bwa-mem2.nix
index b16b7ea..843c5b0 100644
--- a/tools/bwa-mem2.nix
+++ b/tools/bwa-mem2.nix
@@ -2,7 +2,7 @@
, ref
, bamOutput ? true
, flags ? null
-, indexAttrs ? {}
+, indexAttrs ? { }
}:
{ input1
@@ -18,7 +18,8 @@ let
fa = f: matchFiletype "bwa-ref" { fa = _: f; } f;
fq = f: matchFiletype "bwa-input" { fq = _: f; gz = matchFiletype' "bwa-input" { fq = _: f; }; } f;
-in stage {
+in
+stage {
name = "bwa-mem2";
buildInputs = with pkgs; [ bionix.bwa.app2 bc ] ++ optional bamOutput samtools;
buildCommand = ''
@@ -35,6 +36,6 @@ in stage {
${optionalString bamOutput "| samtools view -b"} \
> $out
'';
- passthru.filetype = if bamOutput then filetype.bam {ref = ref; sorting = sort.none {};} else filetype.sam {ref = ref; sorting = sort.name {};};
+ passthru.filetype = if bamOutput then filetype.bam { inherit ref; sorting = sort.none { }; } else filetype.sam { inherit ref; sorting = sort.name { }; };
passthru.multicore = true;
}
diff --git a/tools/bwa.nix b/tools/bwa.nix
index 90a8bd3..6fb7d71 100644
--- a/tools/bwa.nix
+++ b/tools/bwa.nix
@@ -3,18 +3,18 @@
with bionix;
rec {
- app2 = pkgs.callPackage ./bwa-mem2-app.nix {};
+ app2 = pkgs.callPackage ./bwa-mem2-app.nix { };
/* Align read against a reference: defaults to bwa-mem */
align = bionix.bwa.mem;
/* Align reads against a reference using bwa-mem
- Type: bwa-mem :: {ref :: fasta, bamOutput :: bool, ...} -> {input1, input2} -> bam/sam
+ Type: bwa-mem :: {ref :: fasta, bamOutput :: bool, ...} -> {input1, input2} -> bam/sam
*/
mem = callBionixE ./bwa-mem.nix;
mem2 = callBionixE ./bwa-mem2.nix;
/* Creates an reference index for BWA
- Type: index :: {...} -> fasta -> BWA index
+ Type: index :: {...} -> fasta -> BWA index
*/
index = callBionixE ./bwa-index.nix;
index2 = callBionixE ./bwa-index2.nix;
diff --git a/tools/cnvkit-batch.nix b/tools/cnvkit-batch.nix
index 113e0c9..7f7893f 100644
--- a/tools/cnvkit-batch.nix
+++ b/tools/cnvkit-batch.nix
@@ -1,17 +1,18 @@
-{bionix
-,targets ? null
-,annotations ? null
-,flags ? null
-,indexAttrs ? {}}:
+{ bionix
+, targets ? null
+, annotations ? null
+, flags ? null
+, indexAttrs ? { }
+}:
-{normals ? [], tumours}:
+{ normals ? [ ], tumours }:
with bionix;
with lib;
with types;
let
- getref = f: matchFiletype "cnvkit-batch" { bam = {ref, ...}: ref; } f;
+ getref = matchFiletype "cnvkit-batch" { bam = { ref, ... }: ref; };
refs = map getref normals ++ map getref tumours;
ref = head refs;
sorted = matchFileSorting "cnvkit-batch" { coord = _: true; };
diff --git a/tools/cnvkit-scatter.nix b/tools/cnvkit-scatter.nix
index 2899584..6cd5b96 100644
--- a/tools/cnvkit-scatter.nix
+++ b/tools/cnvkit-scatter.nix
@@ -1,5 +1,6 @@
-{bionix
-,flags ? null}:
+{ bionix
+, flags ? null
+}:
input:
diff --git a/tools/cnvkit.nix b/tools/cnvkit.nix
index fc55d94..812652a 100644
--- a/tools/cnvkit.nix
+++ b/tools/cnvkit.nix
@@ -1,15 +1,15 @@
-{bionix}:
+{ bionix }:
with bionix;
{
/* Call CNVs
- Type: callCNV :: {targets :: target file, annotations :: annotation file, ...} -> {normals :: [bam], tumours :: [bam]} -> CNVs
+ Type: callCNV :: {targets :: target file, annotations :: annotation file, ...} -> {normals :: [bam], tumours :: [bam]} -> CNVs
*/
callCNV = callBionixE ./cnvkit-batch.nix;
/* Scatter plot from CNV calls
- Type: scatterPlot :: {} -> CNVs -> PDF
+ Type: scatterPlot :: {} -> CNVs -> PDF
*/
scatterPlot = callBionixE ./cnvkit-scatter.nix;
}
diff --git a/tools/compression-bunzip2.nix b/tools/compression-bunzip2.nix
index 06fe682..a36b66d 100644
--- a/tools/compression-bunzip2.nix
+++ b/tools/compression-bunzip2.nix
@@ -1,4 +1,4 @@
-{bionix}:
+{ bionix }:
with bionix;
diff --git a/tools/compression-bzip2.nix b/tools/compression-bzip2.nix
index 6dfb749..5332e7d 100644
--- a/tools/compression-bzip2.nix
+++ b/tools/compression-bzip2.nix
@@ -1,4 +1,4 @@
-{bionix}:
+{ bionix }:
with bionix;
diff --git a/tools/compression-gunzip.nix b/tools/compression-gunzip.nix
index 6c98f91..96a4e49 100644
--- a/tools/compression-gunzip.nix
+++ b/tools/compression-gunzip.nix
@@ -1,4 +1,4 @@
-{bionix}:
+{ bionix }:
with bionix;
diff --git a/tools/compression-gzip.nix b/tools/compression-gzip.nix
index 50fca9e..0229b94 100644
--- a/tools/compression-gzip.nix
+++ b/tools/compression-gzip.nix
@@ -1,4 +1,4 @@
-{bionix}:
+{ bionix }:
with bionix;
diff --git a/tools/compression.nix b/tools/compression.nix
index bfcc292..c9c8777 100644
--- a/tools/compression.nix
+++ b/tools/compression.nix
@@ -1,4 +1,4 @@
-{bionix}:
+{ bionix }:
with bionix;
with types;
@@ -8,42 +8,51 @@ let
gunzip = callBionixE ./compression-gunzip.nix;
bunzip2 = callBionixE ./compression-bunzip2.nix;
-in {
- uncompress = attrs: f: matchFiletype "uncompress" {
- fa = _: f;
- fq = _: f;
- bam = _: f;
- sam = _: f;
- cram = _: f;
- vcf = _: f;
- bed = _: f;
- gz = _: gunzip attrs f;
- bz2 = _: bunzip2 attrs f;
- } f;
+in
+{
+ uncompress = attrs: f: matchFiletype "uncompress"
+ {
+ fa = _: f;
+ fq = _: f;
+ bam = _: f;
+ sam = _: f;
+ cram = _: f;
+ vcf = _: f;
+ bed = _: f;
+ gz = _: gunzip attrs f;
+ bz2 = _: bunzip2 attrs f;
+ }
+ f;
gzip = attrs: f:
let gz = gzip attrs f;
- in types.matchFiletype "compressed" {
- fa = _: gz;
- fq = _: gz;
- bam = _: gz;
- sam = _: gz;
- cram = _: gz;
- vcf = _: gz;
- bed = _: gz;
- gz = x: x;
- } f;
+ in
+ types.matchFiletype "compressed"
+ {
+ fa = _: gz;
+ fq = _: gz;
+ bam = _: gz;
+ sam = _: gz;
+ cram = _: gz;
+ vcf = _: gz;
+ bed = _: gz;
+ gz = x: x;
+ }
+ f;
bzip2 = attrs: f:
let bz2 = bzip2 attrs f;
- in types.matchFiletype "compressed" {
- fa = _: gz;
- fq = _: gz;
- bam = _: gz;
- sam = _: gz;
- cram = _: gz;
- vcf = _: gz;
- bed = _: gz;
- bz2 = x: x;
- } f;
+ in
+ types.matchFiletype "compressed"
+ {
+ fa = _: gz;
+ fq = _: gz;
+ bam = _: gz;
+ sam = _: gz;
+ cram = _: gz;
+ vcf = _: gz;
+ bed = _: gz;
+ bz2 = x: x;
+ }
+ f;
}
diff --git a/tools/crumble-app.nix b/tools/crumble-app.nix
index fc30d5a..d8ed1a7 100644
--- a/tools/crumble-app.nix
+++ b/tools/crumble-app.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchFromGitHub, autoreconfHook, htslib}:
+{ stdenv, fetchFromGitHub, autoreconfHook, htslib }:
stdenv.mkDerivation rec {
name = "crumble-${version}";
diff --git a/tools/crumble.nix b/tools/crumble.nix
index 4256f37..dfb4e31 100644
--- a/tools/crumble.nix
+++ b/tools/crumble.nix
@@ -3,5 +3,5 @@
with bionix;
{
- crumble = pkgs.callPackage ./crumble-app.nix {};
+ crumble = pkgs.callPackage ./crumble-app.nix { };
}
diff --git a/tools/delly-call.nix b/tools/delly-call.nix
index 5378810..80084be 100644
--- a/tools/delly-call.nix
+++ b/tools/delly-call.nix
@@ -1,4 +1,4 @@
-{ bionix, flags ? "", faidxAttrs ? {}, indexAttrs ? {}}:
+{ bionix, flags ? "", faidxAttrs ? { }, indexAttrs ? { } }:
inputs:
@@ -41,6 +41,6 @@ stage {
'';
passthru = {
multicore = true;
- filetype = filetype.vcf { ref = ref; };
+ filetype = filetype.vcf { inherit ref; };
};
}
diff --git a/tools/delly.nix b/tools/delly.nix
index d94457c..22d4d89 100644
--- a/tools/delly.nix
+++ b/tools/delly.nix
@@ -4,7 +4,7 @@ with bionix;
{
/* Call structural variants
- Type: call { ... } -> [bam] -> vcf
+ Type: call { ... } -> [bam] -> vcf
*/
call = callBionixE ./delly-call.nix;
}
diff --git a/tools/facets-app.nix b/tools/facets-app.nix
index 6553a67..fe2a31b 100644
--- a/tools/facets-app.nix
+++ b/tools/facets-app.nix
@@ -1,8 +1,9 @@
-{buildRPackage
-,fetchFromGitHub
-,R
-,htslib
-,zlib}:
+{ buildRPackage
+, fetchFromGitHub
+, R
+, htslib
+, zlib
+}:
let
pctGCdata = buildRPackage rec {
@@ -18,7 +19,8 @@ let
buildInputs = [ R ];
};
-in buildRPackage rec{
+in
+buildRPackage rec{
name = "facets-${version}";
version = "0.6.1";
requireX = false;
diff --git a/tools/facets-call.nix b/tools/facets-call.nix
index a736627..43c4c7f 100644
--- a/tools/facets-call.nix
+++ b/tools/facets-call.nix
@@ -1,6 +1,6 @@
-{bionix}:
+{ bionix }:
-{vcf, bams}:
+{ vcf, bams }:
with bionix;
with types;
diff --git a/tools/facets.nix b/tools/facets.nix
index 14110a9..b91e422 100644
--- a/tools/facets.nix
+++ b/tools/facets.nix
@@ -1,12 +1,12 @@
-{bionix}:
+{ bionix }:
with bionix;
{
- app = lib.callPackageWith (pkgs // pkgs.rPackages) ./facets-app.nix {};
+ app = lib.callPackageWith (pkgs // pkgs.rPackages) ./facets-app.nix { };
/* Call CNVs
- Type: callCnv :: {...} -> {vcf, bams :: [bams]} -> CNVs
+ Type: callCnv :: {...} -> {vcf, bams :: [bams]} -> CNVs
*/
callCNV = callBionixE ./facets-call.nix;
}
diff --git a/tools/fastp-check.nix b/tools/fastp-check.nix
index 06f00ae..9467cd9 100644
--- a/tools/fastp-check.nix
+++ b/tools/fastp-check.nix
@@ -1,10 +1,10 @@
{ bionix
, flags ? null
-} :
+}:
{ input1
, input2 ? null
-} :
+}:
with bionix;
with lib;
@@ -15,26 +15,27 @@ let
out =
stage {
- name = "fastp";
- buildInputs = [ pkgs.fastp ];
- outputs = [ "out" "fastq1" "json" ] ++ (if input2 != null then [ "fastq2" ] else []);
- buildCommand = ''
- mkdir -p $out
- fastp \
- ${optionalString (flags != null) flags} \
- -i ${fq input1} \
- -o fastq1.fq.gz \
- ${optionalString (input2 != null) ''
- -I ${fq input2} \
- -O fastq2.fq.gz \
+ name = "fastp";
+ buildInputs = [ pkgs.fastp ];
+ outputs = [ "out" "fastq1" "json" ] ++ (if input2 != null then [ "fastq2" ] else [ ]);
+ buildCommand = ''
+ mkdir -p $out
+ fastp \
+ ${optionalString (flags != null) flags} \
+ -i ${fq input1} \
+ -o fastq1.fq.gz \
+ ${optionalString (input2 != null) ''
+ -I ${fq input2} \
+ -O fastq2.fq.gz \
- cp fastq2.fq.gz $fastq2
- ''}
+ cp fastq2.fq.gz $fastq2
+ ''}
- cp fastq1.fq.gz $fastq1
- cp fastp.html $out
- cp fastp.json $json
- '';
+ cp fastq1.fq.gz $fastq1
+ cp fastp.html $out
+ cp fastp.json $json
+ '';
};
- fqgz = { filetype = filetype.gz (filetype.fastq {}); };
-in out // { fastq1 = out.fastq1 // fqgz; } // (if input2 != null then {fastq2 = out.fastq2 // fqgz; } else {})
+ fqgz = { filetype = filetype.gz (filetype.fastq { }); };
+in
+out // { fastq1 = out.fastq1 // fqgz; } // (if input2 != null then { fastq2 = out.fastq2 // fqgz; } else { })
diff --git a/tools/fastp.nix b/tools/fastp.nix
index 36bc690..454d100 100644
--- a/tools/fastp.nix
+++ b/tools/fastp.nix
@@ -3,9 +3,9 @@
with bionix;
rec {
- /* Check and filter fastqs
+ /* Check and filter fastqs
Type: { ... } -> { input1, input2 ? null } -> { out :: html, fastq1 :: fastq, fastq2 :: fastq, json :: JSON }
- */
- check = callBionixE ./fastp-check.nix;
+ */
+ check = callBionixE ./fastp-check.nix;
}
diff --git a/tools/fastqc.nix b/tools/fastqc.nix
index 6279682..8c448b9 100644
--- a/tools/fastqc.nix
+++ b/tools/fastqc.nix
@@ -3,10 +3,10 @@
with bionix;
{
- fastqc = pkgs.callPackage ./fastqc-app.nix {};
+ fastqc = pkgs.callPackage ./fastqc-app.nix { };
/* QC check
- Type: check :: {...} -> input :: fastq -> report
+ Type: check :: {...} -> input :: fastq -> report
*/
check = callBionixE ./fastqc-check.nix;
}
diff --git a/tools/gridss-assemble.nix b/tools/gridss-assemble.nix
index 1a46eae..15e5ca6 100644
--- a/tools/gridss-assemble.nix
+++ b/tools/gridss-assemble.nix
@@ -1,12 +1,12 @@
{ bionix
-, bwaIndexAttrs ? {}
-, faidxAttrs ? {}
-, indexAttrs ? {}
-, collectMetricsAttrs ? {}
+, bwaIndexAttrs ? { }
+, faidxAttrs ? { }
+, indexAttrs ? { }
+, collectMetricsAttrs ? { }
, flags ? null
, config ? null
, heapSize ? "31g"
-, workdirs ? []
+, workdirs ? [ ]
, jobIndex ? null
, jobNodes ? null
}:
@@ -36,7 +36,7 @@ let
in
assert (all sorted inputs);
-assert (homoRef);
+assert homoRef;
stage rec {
name = "gridss-assemble";
@@ -70,6 +70,6 @@ stage rec {
touch $out
cp -r out.gridss.working $work
'';
- passthru.filetype = filetype.bam { ref = ref; sorting = sort.none {}; };
+ passthru.filetype = filetype.bam { inherit ref; sorting = sort.none { }; };
passthru.multicore = true;
}
diff --git a/tools/gridss-callVariants.nix b/tools/gridss-callVariants.nix
index f42e3f3..ad659de 100644
--- a/tools/gridss-callVariants.nix
+++ b/tools/gridss-callVariants.nix
@@ -1,7 +1,7 @@
{ bionix
, blacklist ? null
-, bwaIndexAttrs ? {}
-, faidxAttrs ? {}
+, bwaIndexAttrs ? { }
+, faidxAttrs ? { }
, flags ? null
, config ? null
, heapSize ? "31g"
@@ -32,22 +32,22 @@ stage rec {
done
mkdir $out
java -ea -Xmx${heapSize} \
- -Dreference_fasta="ref.fa" \
- -Dsamjdk.create_index=true \
- -Dsamjdk.use_async_io_read_samtools=true \
- -Dsamjdk.use_async_io_write_samtools=true \
- -Dsamjdk.use_async_io_write_tribble=true \
- -Dgridss.gridss.output_to_temp_file=true \
- -cp ${bionix.gridss.jar} gridss.CallVariants \
+ -Dreference_fasta="ref.fa" \
+ -Dsamjdk.create_index=true \
+ -Dsamjdk.use_async_io_read_samtools=true \
+ -Dsamjdk.use_async_io_write_samtools=true \
+ -Dsamjdk.use_async_io_write_tribble=true \
+ -Dgridss.gridss.output_to_temp_file=true \
+ -cp ${bionix.gridss.jar} gridss.CallVariants \
VERBOSITY=WARNING \
WORKER_THREADS=$NIX_BUILD_CORES \
- TMP_DIR=. \
- WORKING_DIR=. \
+ TMP_DIR=. \
+ WORKING_DIR=. \
${optionalString (config != null) ("OPTIONS_FILE=" + bionix.gridss.gridssConfig config)} \
- REFERENCE_SEQUENCE="ref.fa" \
+ REFERENCE_SEQUENCE="ref.fa" \
${concatMapStringsSep " " (i: "INPUT=\"${i}\"") inputs} \
- OUTPUT="$out/gridss.vcf" \
- ASSEMBLY="$out/gridss.bam" \
+ OUTPUT="$out/gridss.vcf" \
+ ASSEMBLY="$out/gridss.bam" \
${optionalString (blacklist != null) ("BLACKLIST=" + blacklist)} \
${optionalString (flags != null) flags}
diff --git a/tools/gridss-computeSamTags.nix b/tools/gridss-computeSamTags.nix
index de44478..e07f6a5 100644
--- a/tools/gridss-computeSamTags.nix
+++ b/tools/gridss-computeSamTags.nix
@@ -1,5 +1,10 @@
-{ bionix, bwaIndexAttrs ? { }, faidxAttrs ? { }, flags ? null, config ? null
-, heapSize ? "1G" }:
+{ bionix
+, bwaIndexAttrs ? { }
+, faidxAttrs ? { }
+, flags ? null
+, config ? null
+, heapSize ? "1G"
+}:
with bionix;
with lib;
@@ -11,7 +16,8 @@ let
ref = matchFiletype "gridss-computeSamTags" { bam = x: x.ref; } input;
sorted = matchFileSorting "gridss-computeSamTags" { name = _: true; } input;
-in assert (sorted);
+in
+assert sorted;
stage rec {
name = "gridss-computeSamTags";
diff --git a/tools/gridss-configFile.nix b/tools/gridss-configFile.nix
index d6b600e..3d0d3f8 100644
--- a/tools/gridss-configFile.nix
+++ b/tools/gridss-configFile.nix
@@ -1,37 +1,41 @@
-{bionix}:
+{ bionix }:
with bionix;
with lib;
let
- attrsToGridssConfigString = attrsToGridssConfigStringPrepend "";
+ attrsToGridssConfigString = attrsToGridssConfigStringPrepend "";
- attrsToGridssConfigStringPrepend = prepend: attrs:
- concatStringsSep "\n" (
- attrValues (
- mapAttrs
- (name: attr: prepend + (iniLine name attr))
- attrs));
+ attrsToGridssConfigStringPrepend = prepend: attrs:
+ concatStringsSep "\n" (
+ attrValues (
+ mapAttrs
+ (name: attr: prepend + (iniLine name attr))
+ attrs));
- iniLine = name: attr:
- let attrType = builtins.typeOf attr;
- in
- if (iniLineByAttrType ? ${attrType})
- then (iniLineByAttrType.${attrType} name attr)
- else builtins.throw (
- "`gridssConfig` cannot convert attribute of type \"" + attrType + "\".");
+ iniLine = name: attr:
+ let attrType = builtins.typeOf attr;
+ in
+ if (iniLineByAttrType ? "${attrType}")
+ then (iniLineByAttrType."${attrType}" name attr)
+ else
+ builtins.throw (
+ "`gridssConfig` cannot convert attribute of type \"" + attrType + "\"."
+ );
- iniLineByAttrType = {
- string = name: attr: name + " = " + attr;
- int = name: attr: name + " = " + builtins.toString attr;
- float = name: attr: name + " = " + (
- builtins.head (
- builtins.match "([0-9]+\.0?[1-9]*)0+" (builtins.toString attr)));
- bool = name: attr: name + " = " + (if attr == true then "true" else "false");
- set = name: attr: attrsToGridssConfigStringPrepend (name + ".") attr;
- # Allows for repeated fields (e.g. for adapters):
- list = name: attr: concatStringsSep "\n" (map (x: iniLine name x) attr);
- };
-in configAttrs: (pkgs.writeText
- "gridss.properties.override"
- ((attrsToGridssConfigString configAttrs) + "\n"))
+ iniLineByAttrType = {
+ string = name: attr: name + " = " + attr;
+ int = name: attr: name + " = " + builtins.toString attr;
+ float = name: attr: name + " = " + (
+ builtins.head (
+ builtins.match "([0-9]+\.0?[1-9]*)0+" (builtins.toString attr)
+ ));
+ bool = name: attr: name + " = " + (if attr then "true" else "false");
+ set = name: attrsToGridssConfigStringPrepend (name + ".");
+ # Allows for repeated fields (e.g. for adapters):
+ list = name: attr: concatStringsSep "\n" (map (iniLine name) attr);
+ };
+in
+configAttrs: (pkgs.writeText
+ "gridss.properties.override"
+ ((attrsToGridssConfigString configAttrs) + "\n"))
diff --git a/tools/gridss-extractSVReads.nix b/tools/gridss-extractSVReads.nix
index 6691808..ea268cf 100644
--- a/tools/gridss-extractSVReads.nix
+++ b/tools/gridss-extractSVReads.nix
@@ -1,10 +1,10 @@
{ bionix
-, dictIndexAttrs ? {}
-, faidxAttrs ? {}
+, dictIndexAttrs ? { }
+, faidxAttrs ? { }
, flags ? null
, unmappedReads ? false
, minClipLength ? 5
-, collectMetricsAttrs ? {}
+, collectMetricsAttrs ? { }
, config ? null
}:
diff --git a/tools/gridss-softClipsToSplitReads.nix b/tools/gridss-softClipsToSplitReads.nix
index 93d02df..ef53322 100644
--- a/tools/gridss-softClipsToSplitReads.nix
+++ b/tools/gridss-softClipsToSplitReads.nix
@@ -1,6 +1,6 @@
{ bionix
-, bwaIndexAttrs ? {}
-, faidxAttrs ? {}
+, bwaIndexAttrs ? { }
+, faidxAttrs ? { }
, alignerStreaming ? false
, flags ? null
, config ? null
@@ -37,7 +37,7 @@ stage rec {
${optionalString (config != null) ("OPTIONS_FILE=" + bionix.gridss.gridssConfig config)} \
WORKER_THREADS=$NIX_BUILD_CORES \
${optionalString (flags != null) flags}
- '';
- passthru.filetype = filetype.bam { ref = ref; sorting = sort.none {}; };
+ '';
+ passthru.filetype = filetype.bam { inherit ref; sorting = sort.none { }; };
passthru.multicore = true;
}
diff --git a/tools/gridss-variants.nix b/tools/gridss-variants.nix
index a5c470a..62a89f6 100644
--- a/tools/gridss-variants.nix
+++ b/tools/gridss-variants.nix
@@ -1,7 +1,14 @@
-{ bionix, bwaIndexAttrs ? { }, faidxAttrs ? { }, indexAttrs ? { }
-, assemblyAttrs ? { }, collectMetricsAttrs ? { }
+{ bionix
+, bwaIndexAttrs ? { }
+, faidxAttrs ? { }
+, indexAttrs ? { }
+, assemblyAttrs ? { }
+, collectMetricsAttrs ? { }
, softClipsToSplitReadsAttrs ? { flags = "REALIGN_ENTIRE_READ=true"; }
-, config ? null, heapSize ? "4g", shards ? 10 }:
+, config ? null
+, heapSize ? "4g"
+, shards ? 10
+}:
with bionix;
with lib;
@@ -47,15 +54,16 @@ let
for f in ${bionix.bwa.index bwaIndexAttrs ref}/*; do
ln -s $f
done
- ${concatMapStringsSep "\n" (linkSV) inputs}
+ ${concatMapStringsSep "\n" linkSV inputs}
${linkSV assembly}
${concatMapStringsSep "\n" (linkInput collectMetrics collectMetricsAttrs)
inputs}
${linkInput collectMetrics collectMetricsAttrs assembly}
'';
-in assert (all sorted inputs);
-assert (homoRef);
+in
+assert (all sorted inputs);
+assert homoRef;
rec {
identify = stage rec {
@@ -80,7 +88,7 @@ rec {
mv out.vcf $out
'';
passthru = {
- filetype = filetype.vcf { ref = ref; };
+ filetype = filetype.vcf { inherit ref; };
gridss.assembly = assembly;
multicore = true;
};
@@ -115,7 +123,7 @@ rec {
mv out.vcf $out
'';
passthru = {
- filetype = filetype.vcf { ref = ref; };
+ filetype = filetype.vcf { inherit ref; };
gridss.assembly = assembly;
multicore = true;
};
diff --git a/tools/gridss.nix b/tools/gridss.nix
index 7372864..db577ad 100644
--- a/tools/gridss.nix
+++ b/tools/gridss.nix
@@ -10,60 +10,65 @@ rec {
};
/* Generate configuration file for GRIDSS. Takes attribute sets to GRIDSS ini style format.
- Type: genConfig :: attrSet -> ini file
+ Type: genConfig :: attrSet -> ini file
*/
genConfig = callBionix ./gridss-configFile.nix { };
/* Invoke the callVariants tool
- Type: callVariants :: {blacklist :: drv = null, config :: ini = null, heapSize :: String = "31g", ...} -> [bam] -> variants
+ Type: callVariants :: {blacklist :: drv = null, config :: ini = null, heapSize :: String = "31g", ...} -> [bam] -> variants
*/
callVariants = callBionixE ./gridss-callVariants.nix;
/* Invoke computeSamTags tool
- Type: computeSamTags :: {config :: ini = null, heapSize :: String = "1G", ...} -> bam -> bam
+ Type: computeSamTags :: {config :: ini = null, heapSize :: String = "1G", ...} -> bam -> bam
*/
computeSamTags = callBionixE ./gridss-computeSamTags.nix;
/* Invoke softClipsToSplitReads tool
- Type: softClipsToSplitReads :: {alignerStreaming :: Bool = false, config :: ini = null, heapSize :: String = "2G", ...} -> bam -> bam
+ Type: softClipsToSplitReads :: {alignerStreaming :: Bool = false, config :: ini = null, heapSize :: String = "2G", ...} -> bam -> bam
*/
softClipsToSplitReads = callBionixE ./gridss-softClipsToSplitReads.nix;
/* Invoke collectMetrics tool
- Type: collectMetrics :: {thresholdCoverage :: Int = 10000, config :: ini = null, heapSize :: String = "1G", ...} -> bam -> metrics
+ Type: collectMetrics :: {thresholdCoverage :: Int = 10000, config :: ini = null, heapSize :: String = "1G", ...} -> bam -> metrics
*/
collectMetrics = callBionixE ./gridss-collectMetrics.nix;
/* Invoke extractSVReads tool
- Type: extractSVReads :: {unmappedReads :: Bool = false, minClipLength :: Int = 5, config :: ini = null, ...} -> bam -> bam
+ Type: extractSVReads :: {unmappedReads :: Bool = false, minClipLength :: Int = 5, config :: ini = null, ...} -> bam -> bam
*/
extractSVReads = callBionixE ./gridss-extractSVReads.nix;
/* Invoke assembly tool
- Type: assemble :: {config :: ini = null, heapSize :: String = "31g", ...} -> [bam] -> bam
+ Type: assemble :: {config :: ini = null, heapSize :: String = "31g", ...} -> [bam] -> bam
*/
assemble = callBionixE ./gridss-assemble.nix;
shardedAssemble = n: a: input:
let
- assemblies = genList (i:
- bionix.gridss.assemble (a // {
- jobNodes = n;
- jobIndex = i;
- }) input) n;
- in if n <= 1 then
+ assemblies = genList
+ (i:
+ bionix.gridss.assemble
+ (a // {
+ jobNodes = n;
+ jobIndex = i;
+ })
+ input)
+ n;
+ in
+ if n <= 1 then
bionix.gridss.assemble a input
else
bionix.gridss.assemble (a // { workdirs = map (a: a.work) assemblies; })
- input;
+ input;
/* Invoke identifyVariants tool
- Type: identifyVariants :: {config :: ini = null, heapSize :: String = "4g", ...} -> [bam] -> VCF
+ Type: identifyVariants :: {config :: ini = null, heapSize :: String = "4g", ...} -> [bam] -> VCF
*/
identifyVariants = exec
(attrs: input: ((callBionix ./gridss-variants.nix attrs) input).identify);
/* Invoke annotateVariants tool
- Type: annotateVariants :: {config :: ini = null, heapSize :: String = "4g", ...} -> [bam] -> VCF
+ Type: annotateVariants :: {config :: ini = null, heapSize :: String = "4g", ...} -> [bam] -> VCF
*/
annotateVariants = exec
(attrs: input: ((callBionix ./gridss-variants.nix attrs) input).annotate);
@@ -73,7 +78,7 @@ rec {
((callBionix ./gridss-variants.nix attrs) input).annotateAndAssemble);
/* Preprocess BAM files to extract SV reads
- Type: preprocessBam :: bam -> bam
+ Type: preprocessBam :: bam -> bam
*/
preprocessBam = with samtools;
flip pipe [
@@ -84,7 +89,7 @@ rec {
];
/* Call SVs: entire pipeline including preprocessing. It is recommended to use this function rather than the individual above tools.
- Type: [bam] -> GRIDSS result
+ Type: [bam] -> GRIDSS result
*/
call = inputs: gridss.annotateVariants { } (map gridss.preprocessBam inputs);
diff --git a/tools/hisat2-align.nix b/tools/hisat2-align.nix
index 7a216a6..0a1eb25 100644
--- a/tools/hisat2-align.nix
+++ b/tools/hisat2-align.nix
@@ -2,7 +2,7 @@
, ref
, bamOutput ? true
, flags ? null
-, indexAttrs ? {}
+, indexAttrs ? { }
}:
{ input1
@@ -18,7 +18,8 @@ let
fa = f: matchFiletype "hisat2-ref" { fa = _: f; } f;
fq = f: matchFiletype "hisat2-input" { fq = _: f; gz = matchFiletype' "hisat2-input" { fq = _: "<(gunzip < ${f})"; }; } f;
-in stage {
+in
+stage {
name = "hisat2-align";
buildInputs = with pkgs; [ hisat2 bc samtools ];
buildCommand = ''
@@ -33,6 +34,6 @@ in stage {
| samtools sort -n \
> $out
'';
- passthru.filetype = if bamOutput then filetype.bam {ref = ref; sorting = sort.none {};} else filetype.sam {ref = ref; sorting = sort.name {};};
+ passthru.filetype = if bamOutput then filetype.bam { inherit ref; sorting = sort.none { }; } else filetype.sam { inherit ref; sorting = sort.name { }; };
passthru.multicore = true;
}
diff --git a/tools/hisat2-index.nix b/tools/hisat2-index.nix
index ffdb4ed..d9d5cd1 100644
--- a/tools/hisat2-index.nix
+++ b/tools/hisat2-index.nix
@@ -1,8 +1,8 @@
{ bionix
, gtf ? null
, flags ? null
-, extractSpliceSitesAttrs ? {}
-, extractExonsAttrs ? {}
+, extractSpliceSitesAttrs ? { }
+, extractExonsAttrs ? { }
}:
ref:
diff --git a/tools/hisat2.nix b/tools/hisat2.nix
index 8cc4ddf..e3e9995 100644
--- a/tools/hisat2.nix
+++ b/tools/hisat2.nix
@@ -4,12 +4,12 @@ with bionix;
rec {
/* Align read against a reference
- Type: hisat2-mem :: {ref :: fasta, bamOutput :: bool, ...} -> {input1, input2} -> bam/sam
+ Type: hisat2-mem :: {ref :: fasta, bamOutput :: bool, ...} -> {input1, input2} -> bam/sam
*/
align = callBionixE ./hisat2-align.nix;
/* Creates an reference index for HISAT2
- Type: index :: {...} -> fasta -> HISAT2 index
+ Type: index :: {...} -> fasta -> HISAT2 index
*/
index = callBionixE ./hisat2-index.nix;
diff --git a/tools/infercnv-app.nix b/tools/infercnv-app.nix
index 5114e2f..36b9956 100644
--- a/tools/infercnv-app.nix
+++ b/tools/infercnv-app.nix
@@ -1,21 +1,22 @@
-{stdenv
- ,fetchurl
- ,fetchFromGitHub
- ,callPackage
- ,nettools
- ,rPackages
- ,rWrapper
- ,R
- ,jre
- ,python
- ,pythonPackages
- ,darwin
- ,gettext
- ,gfortran
-,makeWrapper}:
+{ stdenv
+, fetchurl
+, fetchFromGitHub
+, callPackage
+, nettools
+, rPackages
+, rWrapper
+, R
+, jre
+, python
+, pythonPackages
+, darwin
+, gettext
+, gfortran
+, makeWrapper
+}:
let
- buildRPackage = rPackages.buildRPackage;
+ inherit (rPackages) buildRPackage;
GMD = buildRPackage rec {
name = "GMD-${version}";
@@ -59,7 +60,7 @@ let
owner = "broadinstitute";
repo = "inferCNV";
rev = "cf442af0db6191fa8ba57c4921ac2d1f98c2c39d";
- sha256 = "0cv8qiaqpd6b4152dplnzvgv77cmk961rmvzr27qgmlaazc5hblh";
+ sha256 = "0cv8qiaqpd6b4152dplnzvgv77cmk961rmvzr27qgmlaazc5hblh";
};
propagatedBuildInputs = with rPackages; [ R GMD NGCHMR RColorBrewer gplots optparse logging ];
};
@@ -75,9 +76,10 @@ let
sha256 = "1pz710ig8nnydz329ry8fydccbrp3arp614dgba3bcyy9flm3gnw";
};
-in stdenv.mkDerivation rec {
- name = inferCNV.name;
- src = inferCNV.src;
+in
+stdenv.mkDerivation rec {
+ inherit (inferCNV) name;
+ inherit (inferCNV) src;
buildInputs = [ r makeWrapper py ];
propagatedBuildInputs = [ jre ];
installPhase = ''
diff --git a/tools/infercnv-infer.nix b/tools/infercnv-infer.nix
index 0915691..e499f6c 100644
--- a/tools/infercnv-infer.nix
+++ b/tools/infercnv-infer.nix
@@ -1,12 +1,14 @@
-{bionix
-,flags ? null}:
+{ bionix
+, flags ? null
+}:
with bionix;
with lib;
-{ref
-,expr
-,pos}:
+{ ref
+, expr
+, pos
+}:
stage {
name = "inferCNV";
diff --git a/tools/infercnv.nix b/tools/infercnv.nix
index 71ed274..86ffb74 100644
--- a/tools/infercnv.nix
+++ b/tools/infercnv.nix
@@ -1,8 +1,8 @@
-{bionix}:
+{ bionix }:
with bionix;
{
- app = callPackage ./infercnv-app.nix {};
- infercnv = callBionixE ./infercnv-infer.nix {};
+ app = callPackage ./infercnv-app.nix { };
+ infercnv = callBionixE ./infercnv-infer.nix { };
}
diff --git a/tools/kallisto-index.nix b/tools/kallisto-index.nix
index 3b92d38..074a953 100644
--- a/tools/kallisto-index.nix
+++ b/tools/kallisto-index.nix
@@ -1,6 +1,7 @@
-{bionix
+{ bionix
, kmerSize ? 31
-, unique ? false}:
+, unique ? false
+}:
with bionix;
with lib;
diff --git a/tools/kallisto-quant.nix b/tools/kallisto-quant.nix
index 3efeaaa..b7481d8 100644
--- a/tools/kallisto-quant.nix
+++ b/tools/kallisto-quant.nix
@@ -1,5 +1,5 @@
-{bionix
-, indexFlags ? {}
+{ bionix
+, indexFlags ? { }
, bias ? false
, bootstrapSamples ? 0
, seed ? 42
@@ -10,7 +10,8 @@
, rfStranded ? false
, fragmentLength ? null
, fragmentSD ? null
-, ref}:
+, ref
+}:
with bionix;
with lib;
@@ -21,7 +22,7 @@ inputs:
let
inherit (bionix.types) matchFiletype';
- isFastQ = matchFiletype' "kallisto-quant" {fq = _: true; gz = isFastQ; };
+ isFastQ = matchFiletype' "kallisto-quant" { fq = _: true; gz = isFastQ; };
empty = ./kallisto-quant-empty.h5;
@@ -45,7 +46,7 @@ let
in
-assert (all (x: isFastQ (x.filetype)) inputs);
+assert (all (x: isFastQ x.filetype) inputs);
stage {
name = "kallisto-quant";
diff --git a/tools/kallisto.nix b/tools/kallisto.nix
index 13de61e..e096d11 100644
--- a/tools/kallisto.nix
+++ b/tools/kallisto.nix
@@ -1,4 +1,4 @@
-{bionix}:
+{ bionix }:
with bionix;
@@ -6,7 +6,7 @@ with bionix;
index = callBionixE ./kallisto-index.nix;
/* Quantify reads against a transcriptome
- Type: { bias :: bool, bootstrapSamples :: int, seed :: int, plaintext :: bool, fusion :: bool, single :: bool, frStranded :: bool, rfStranded :: bool, fragmentLength :: Int, fragmentSD :: real } -> [fastq] -> kallisto
+ Type: { bias :: bool, bootstrapSamples :: int, seed :: int, plaintext :: bool, fusion :: bool, single :: bool, frStranded :: bool, rfStranded :: bool, fragmentLength :: Int, fragmentSD :: real } -> [fastq] -> kallisto
*/
quant = callBionixE ./kallisto-quant.nix;
}
diff --git a/tools/last-align.nix b/tools/last-align.nix
index b2c8460..b326877 100644
--- a/tools/last-align.nix
+++ b/tools/last-align.nix
@@ -1,7 +1,7 @@
{ bionix
, ref
, flags ? null
-, indexAttrs ? {}
+, indexAttrs ? { }
}:
{ input1
@@ -16,10 +16,11 @@ let
fa = f: matchFiletype "last-ref" { fa = _: f; } f;
fq = f: matchFiletype "last-input" { fq = _: f; } f;
fqfa = f: matchFiletype "last-input" { fq = _: f; fa = _: f; } f;
- Q = f: matchFiletype "last-input" { fq = _: 1; fa = _: 0; } f;
- parallel = f: matchFiletype "last-input" { fq = _: "parallel-fastq"; fa = _: "parallel-fasta"; } f;
+ Q = matchFiletype "last-input" { fq = _: 1; fa = _: 0; };
+ parallel = matchFiletype "last-input" { fq = _: "parallel-fastq"; fa = _: "parallel-fasta"; };
-in stage {
+in
+stage {
name = "last-align";
buildInputs = with pkgs; [ last ];
buildCommand = ''
diff --git a/tools/last.nix b/tools/last.nix
index 3755bde..870bfe6 100644
--- a/tools/last.nix
+++ b/tools/last.nix
@@ -4,7 +4,7 @@ with bionix;
rec {
/* Align reads against a reference genome
- Type: { ref :: fastq, ... } -> { input1, input2} -> last
+ Type: { ref :: fastq, ... } -> { input1, input2} -> last
*/
align = callBionixE ./last-align.nix;
index = callBionixE ./last-index.nix;
diff --git a/tools/lumpy-call.nix b/tools/lumpy-call.nix
index fffc329..56ac650 100644
--- a/tools/lumpy-call.nix
+++ b/tools/lumpy-call.nix
@@ -21,7 +21,8 @@ let
'';
};
-in assert (length (unique refs) == 1);
+in
+assert (length (unique refs) == 1);
stage {
name = "lumpy";
@@ -36,5 +37,5 @@ stage {
${flags} \
-o $out
'';
- passthru.filetype = filetype.vcf { ref = ref; };
+ passthru.filetype = filetype.vcf { inherit ref; };
}
diff --git a/tools/lumpy.nix b/tools/lumpy.nix
index f82134e..59c968f 100644
--- a/tools/lumpy.nix
+++ b/tools/lumpy.nix
@@ -4,7 +4,7 @@ with bionix;
{
/* Call structural variants
- Type: { ... } -> [bam] -> vcf
+ Type: { ... } -> [bam] -> vcf
*/
call = callBionixE ./lumpy-call.nix;
}
diff --git a/tools/manta-call.nix b/tools/manta-call.nix
index 099d5e6..21cbeba 100644
--- a/tools/manta-call.nix
+++ b/tools/manta-call.nix
@@ -1,6 +1,6 @@
-{ bionix, indexAttrs ? {}, faidxAttrs ? {}, flags ? "" }:
+{ bionix, indexAttrs ? { }, faidxAttrs ? { }, flags ? "" }:
-{ normals ? [], tumour ? null }:
+{ normals ? [ ], tumour ? null }:
with bionix;
with lib;
@@ -8,7 +8,7 @@ with types;
let
getref = matchFiletype "manta-call" { bam = x: x.ref; };
- refs = map getref normals ++ optionals (tumour != null) [(getref tumour)];
+ refs = map getref normals ++ optionals (tumour != null) [ (getref tumour) ];
ref = head refs;
renameAndIndex = f: stage {
diff --git a/tools/manta.nix b/tools/manta.nix
index b34753f..dba8669 100644
--- a/tools/manta.nix
+++ b/tools/manta.nix
@@ -4,7 +4,7 @@ with bionix;
{
/* Call structural variants
- Type: { ... } -> { normals :: [bam], tumour :: bam } -> manta
+ Type: { ... } -> { normals :: [bam], tumour :: bam } -> manta
*/
call = callBionixE ./manta-call.nix;
}
diff --git a/tools/minimap2-align.nix b/tools/minimap2-align.nix
index a6de0b7..18bca35 100644
--- a/tools/minimap2-align.nix
+++ b/tools/minimap2-align.nix
@@ -18,7 +18,8 @@ let
fa = f: matchFiletype "minimap2-ref" { fa = _: f; } f;
fq = f: matchFiletype "minimap2-input" { fq = _: f; gz = matchFiletype' "minimap2-input" { fq = _: f; }; } f;
-in stage {
+in
+stage {
name = "minimap2-align";
buildInputs = with pkgs; [ minimap2 bc ] ++ optional bamOutput samtools;
buildCommand = ''
@@ -32,6 +33,6 @@ in stage {
${optionalString bamOutput "| samtools view -b"} \
> $out
'';
- passthru.filetype = if bamOutput then filetype.bam {ref = ref; sorting = sort.none {};} else filetype.sam {ref = ref; sorting = sort.none {};};
+ passthru.filetype = if bamOutput then filetype.bam { inherit ref; sorting = sort.none { }; } else filetype.sam { inherit ref; sorting = sort.none { }; };
passthru.multicore = true;
}
diff --git a/tools/minimap2.nix b/tools/minimap2.nix
index e1d6af5..59439ef 100644
--- a/tools/minimap2.nix
+++ b/tools/minimap2.nix
@@ -4,7 +4,7 @@ with bionix;
rec {
/* Align read against a reference
- * Type: align :: {ref :: fasta, bamOutput :: bool, preset :: string, ...} -> {input1, input2} -> bam/sam
+ * Type: align :: {ref :: fasta, bamOutput :: bool, preset :: string, ...} -> {input1, input2} -> bam/sam
*/
align = callBionixE ./minimap2-align.nix;
}
diff --git a/tools/mosdepth-depth.nix b/tools/mosdepth-depth.nix
index 2dbfc8d..2a72989 100644
--- a/tools/mosdepth-depth.nix
+++ b/tools/mosdepth-depth.nix
@@ -1,5 +1,5 @@
{ bionix
-, indexAttrs ? {}
+, indexAttrs ? { }
, flags ? null
}:
diff --git a/tools/mosdepth-plot.nix b/tools/mosdepth-plot.nix
index f98ae23..87eb67f 100644
--- a/tools/mosdepth-plot.nix
+++ b/tools/mosdepth-plot.nix
@@ -7,7 +7,8 @@ with bionix;
with lib;
{ inputs
-, names ? []}:
+, names ? [ ]
+}:
stage {
name = "mosdepth-plot";
diff --git a/tools/mosdepth.nix b/tools/mosdepth.nix
index cbebdfb..91c30e5 100644
--- a/tools/mosdepth.nix
+++ b/tools/mosdepth.nix
@@ -4,12 +4,12 @@ with bionix;
{
/* Compute coverage of a reference given an alignemnt
- Type: { ... } -> bam -> mosdepth
+ Type: { ... } -> bam -> mosdepth
*/
depth = callBionixE ./mosdepth-depth.nix;
/* Plot sample coverages. Names are optional.
- Type: { ... } -> { inputs :: [mosdepth], names :: [string] } -> html
+ Type: { ... } -> { inputs :: [mosdepth], names :: [string] } -> html
*/
plot = callBionixE ./mosdepth-plot.nix;
}
diff --git a/tools/mutect-app.nix b/tools/mutect-app.nix
index ca78d34..ad1515c 100644
--- a/tools/mutect-app.nix
+++ b/tools/mutect-app.nix
@@ -1,16 +1,19 @@
-{stdenv, fetchurl, makeWrapper, unzip, fetchFromGitHub}:
+{ stdenv, fetchurl, makeWrapper, unzip, fetchFromGitHub }:
let
- oldnix = import (fetchFromGitHub {
- owner = "NixOS";
- repo = "nixpkgs";
- rev = "83a893c38a83877588e3ca7ccfeabaa973c30acd";
- sha256 = "0q7214hag7h95irvhkdb648m09b9jspb0raw1qjrx7y4grzb165h";
- }) {};
+ oldnix = import
+ (fetchFromGitHub {
+ owner = "NixOS";
+ repo = "nixpkgs";
+ rev = "83a893c38a83877588e3ca7ccfeabaa973c30acd";
+ sha256 = "0q7214hag7h95irvhkdb648m09b9jspb0raw1qjrx7y4grzb165h";
+ })
+ { };
jre = oldnix.openjdk7;
-in stdenv.mkDerivation rec {
+in
+stdenv.mkDerivation rec {
name = "mutect-${version}";
version = "1.1.5";
diff --git a/tools/mutect-call.nix b/tools/mutect-call.nix
index e98ba4b..52c1e1d 100644
--- a/tools/mutect-call.nix
+++ b/tools/mutect-call.nix
@@ -1,21 +1,22 @@
-{bionix
+{ bionix
, cosmic
-, dbsnp}:
+, dbsnp
+}:
with bionix;
with lib;
let
inherit (types) matchFiletype;
- getVCFref = matchFiletype "mutect-call" {vcf = {ref}: ref;};
- getBAMref = matchFiletype "mutect-call" {bam = {ref, ...}: ref;};
+ getVCFref = matchFiletype "mutect-call" { vcf = { ref }: ref; };
+ getBAMref = matchFiletype "mutect-call" { bam = { ref, ... }: ref; };
refs = map getVCFref [ cosmic dbsnp ];
ref = head refs;
in
assert (length (unique refs) == 1);
-{normal, tumour}:
+{ normal, tumour }:
assert (ref == getBAMref normal && ref == getBAMref tumour);
diff --git a/tools/mutect.nix b/tools/mutect.nix
index addea77..8f40dee 100644
--- a/tools/mutect.nix
+++ b/tools/mutect.nix
@@ -1,12 +1,12 @@
-{bionix}:
+{ bionix }:
with bionix;
{
- app = pkgs.callPackage ./mutect-app.nix {};
+ app = pkgs.callPackage ./mutect-app.nix { };
/* Call somatic variants with mutect
- Type: { cosmic, dbsnp, ... } -> { normal :: bam, tumour :: bam } -> vcf
+ Type: { cosmic, dbsnp, ... } -> { normal :: bam, tumour :: bam } -> vcf
*/
call = callBionixE ./mutect-call.nix;
}
diff --git a/tools/octopus-call.nix b/tools/octopus-call.nix
index 80092e0..81619b6 100644
--- a/tools/octopus-call.nix
+++ b/tools/octopus-call.nix
@@ -18,7 +18,7 @@ with types;
inputs:
let
- getref = f: matchFiletype "octopus-call" { bam = { ref, ... }: ref; cram = { ref, ... }: ref; } f;
+ getref = matchFiletype "octopus-call" { bam = { ref, ... }: ref; cram = { ref, ... }: ref; };
refs = map getref inputs;
ref = head refs;
@@ -63,6 +63,6 @@ stage {
${optionalString (targets != null) (handleTarget targets)} \
${flags}
'';
- passthru.filetype = filetype.vcf { ref = ref; };
+ passthru.filetype = filetype.vcf { inherit ref; };
passthru.multicore = true;
}
diff --git a/tools/octopus-callSomatic.nix b/tools/octopus-callSomatic.nix
index 401eeb8..df41550 100644
--- a/tools/octopus-callSomatic.nix
+++ b/tools/octopus-callSomatic.nix
@@ -31,7 +31,7 @@ let
'';
inputs = [ normal ] ++ tumours;
- getref = f: matchFiletype "octopus-callSomatic" { bam = { ref, ... }: ref; cram = { ref, ... }: ref; } f;
+ getref = matchFiletype "octopus-callSomatic" { bam = { ref, ... }: ref; cram = { ref, ... }: ref; };
refs = map getref inputs;
ref = head refs;
@@ -77,6 +77,6 @@ stage {
-N $normal \
${flags}
'';
- passthru.filetype = filetype.vcf { ref = ref; };
+ passthru.filetype = filetype.vcf { inherit ref; };
passthru.multicore = true;
}
diff --git a/tools/octopus.nix b/tools/octopus.nix
index 858d133..7c21758 100644
--- a/tools/octopus.nix
+++ b/tools/octopus.nix
@@ -4,12 +4,12 @@ with bionix;
{
/* Call variants for a population
- Type: { fast :: bool, very-fast :: bool, max-genotypes :: int, targets :: FilePath + [string], ... } -> [bam] -> vcf
+ Type: { fast :: bool, very-fast :: bool, max-genotypes :: int, targets :: FilePath + [string], ... } -> [bam] -> vcf
*/
call = callBionixE ./octopus-call.nix;
-
+
/* Call somatic variants
- Type: { fast :: bool, very-fast :: bool, max-genotypes :: int, targets :: FilePath + [string], ... } -> { normal :: bam, tumours :: [bam] } -> vcf
+ Type: { fast :: bool, very-fast :: bool, max-genotypes :: int, targets :: FilePath + [string], ... } -> { normal :: bam, tumours :: [bam] } -> vcf
*/
callSomatic = callBionixE ./octopus-callSomatic.nix;
}
diff --git a/tools/picard-markDuplicates.nix b/tools/picard-markDuplicates.nix
index 957a05e..e4b6369 100644
--- a/tools/picard-markDuplicates.nix
+++ b/tools/picard-markDuplicates.nix
@@ -1,8 +1,8 @@
{ bionix
, flags ? null
-} :
+}:
-inputBam :
+inputBam:
with bionix;
with lib;
@@ -10,24 +10,24 @@ with types;
assert (matchFiletype "picard-markDuplicates" { bam = _: true; } inputBam);
assert (matchFileSorting
- "picard-markDuplicates"
- { coord = _: true; name = _: true; }
- inputBam);
+ "picard-markDuplicates"
+ { coord = _: true; name = _: true; }
+ inputBam);
# Note that picard markDuplicates has different behaviour depending on whether the input
# is name-sorted or coordinate-sorted.
stage {
- name = "picard-markDuplicates";
- buildInputs = with pkgs;
- [ picard-tools ];
- outputs = [ "out" "metrics" ];
- buildCommand = ''
- picard MarkDuplicates \
- I=${inputBam} \
- O=$out \
- M=$metrics \
- ${optionalString (flags != null) flags}
- '';
- passthru.filetype = inputBam.filetype;
+ name = "picard-markDuplicates";
+ buildInputs = with pkgs;
+ [ picard-tools ];
+ outputs = [ "out" "metrics" ];
+ buildCommand = ''
+ picard MarkDuplicates \
+ I=${inputBam} \
+ O=$out \
+ M=$metrics \
+ ${optionalString (flags != null) flags}
+ '';
+ passthru.filetype = inputBam.filetype;
}
diff --git a/tools/picard.nix b/tools/picard.nix
index 4246afe..3cb61a1 100644
--- a/tools/picard.nix
+++ b/tools/picard.nix
@@ -3,8 +3,8 @@
with bionix;
{
- /* Mark duplicates
+ /* Mark duplicates
Type: { ... } -> bam -> bam
- */
- markDuplicates = callBionixE ./picard-markDuplicates.nix;
-} \ No newline at end of file
+ */
+ markDuplicates = callBionixE ./picard-markDuplicates.nix;
+}
diff --git a/tools/platypus-callVariants.nix b/tools/platypus-callVariants.nix
index bb0faf1..59a224b 100644
--- a/tools/platypus-callVariants.nix
+++ b/tools/platypus-callVariants.nix
@@ -1,6 +1,6 @@
{ bionix
-, indexAttrs ? {}
-, bamIndexAttrs ? {}
+, indexAttrs ? { }
+, bamIndexAttrs ? { }
, flags ? null
}:
@@ -13,7 +13,7 @@ with types;
let
filename = path: last (splitString "/" path);
- getref = f: matchFiletype "platypus-callVariants" { bam = {ref, ...}: ref; } f;
+ getref = matchFiletype "platypus-callVariants" { bam = { ref, ... }: ref; };
refs = map getref inputs;
ref = head refs;
in
@@ -38,6 +38,6 @@ stage {
# Remove timestamps from output
sed -i '/^##fileDate/d' $out
'';
- passthru.filetype = filetype.vcf {ref = ref;};
+ passthru.filetype = filetype.vcf { inherit ref; };
passthru.multicore = true;
}
diff --git a/tools/platypus.nix b/tools/platypus.nix
index c93a2d8..29e7e08 100644
--- a/tools/platypus.nix
+++ b/tools/platypus.nix
@@ -4,7 +4,7 @@ with bionix;
{
/* Call variants
- Type: { ... } -> [bam] -> vcf
+ Type: { ... } -> [bam] -> vcf
*/
call = callBionixE ./platypus-callVariants.nix;
}
diff --git a/tools/sambamba.nix b/tools/sambamba.nix
index 3c1d1fd..77289fe 100644
--- a/tools/sambamba.nix
+++ b/tools/sambamba.nix
@@ -5,34 +5,35 @@ with bionix;
let
gen = callBionixE ./sambamba-generic.nix;
-in {
+in
+{
/* Sort aligned reads
- Type: { nameSort :: bool, ... } -> bam -> bam
+ Type: { nameSort :: bool, ... } -> bam -> bam
*/
sort = callBionixE ./sambamba-sort.nix;
/* Build an index
- Type: { ... } -> bam -> index
+ Type: { ... } -> bam -> index
*/
- index = def gen {tool = "index"; };
+ index = def gen { tool = "index"; };
/* Merge bam files
- Type: { ... } -> [bam] -> bam
+ Type: { ... } -> [bam] -> bam
*/
- merge = def gen {tool = "merge"; };
+ merge = def gen { tool = "merge"; };
/* Slice a region out of a bam file
- Type: { region, ... } -> bam -> bam
+ Type: { region, ... } -> bam -> bam
*/
- slice = def gen {tool = "slice"; };
+ slice = def gen { tool = "slice"; };
/* Compute flag statistics
- Type: { ... } -> bam -> flagstat
+ Type: { ... } -> bam -> flagstat
*/
- flagstat = def gen {tool = "flagstat"; };
+ flagstat = def gen { tool = "flagstat"; };
/* Mark duplicates
- Type: { ... } -> bam -> bam
+ Type: { ... } -> bam -> bam
*/
- markdup = def gen {tool = "markdup"; };
+ markdup = def gen { tool = "markdup"; };
}
diff --git a/tools/samtools-merge.nix b/tools/samtools-merge.nix
index 792ee52..ff8ea00 100644
--- a/tools/samtools-merge.nix
+++ b/tools/samtools-merge.nix
@@ -10,8 +10,8 @@ with lib;
let
inherit (bionix.types) matchFiletype matchSorting;
- inputIsHomogenous = length (unique (map (matchFiletype "samtools-merge" {bam = x: x // {sorting = matchSorting "samtools-merge" {coord = _: "coord"; name = _: "name"; } x;};}) inputs)) == 1;
- nameSorted = matchFiletype "samtools-merge" { bam = x: matchSorting "samtools-merge" {coord = _: false; name = _: true;} x;} (lib.head inputs);
+ inputIsHomogenous = length (unique (map (matchFiletype "samtools-merge" { bam = x: x // { sorting = matchSorting "samtools-merge" { coord = _: "coord"; name = _: "name"; } x; }; }) inputs)) == 1;
+ nameSorted = matchFiletype "samtools-merge" { bam = matchSorting "samtools-merge" { coord = _: false; name = _: true; }; } (lib.head inputs);
in
assert inputIsHomogenous;
diff --git a/tools/samtools-sort.nix b/tools/samtools-sort.nix
index e3fbff8..30439f1 100644
--- a/tools/samtools-sort.nix
+++ b/tools/samtools-sort.nix
@@ -17,9 +17,10 @@ assert (matchFiletype "samtools-sort" { bam = _: true; sam = _: true; cram = _:
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 stage {
+ 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
+stage {
name = "samtools-sort";
buildInputs = with pkgs; [ samtools ];
buildCommand =
diff --git a/tools/samtools-view.nix b/tools/samtools-view.nix
index 35a3fcb..4d2bdc7 100644
--- a/tools/samtools-view.nix
+++ b/tools/samtools-view.nix
@@ -15,8 +15,9 @@ assert (matchFiletype "samtools-view" { bam = _: true; sam = _: true; cram = _:
let
outfmtR = if outfmt != null then (if builtins.typeOf outfmt == "string" then { "bam" = toBam; "cram" = toCram; "sam" = toSam; }."${outfmt}" else 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 stage {
+ outfmtFlags = matchFiletype "samtools-view-outfmt" { bam = _: "-O BAM"; sam = _: "-O SAM"; cram = x: "-O CRAM -T ${fa x.ref}"; } { filetype = outfmtR; };
+in
+stage {
name = "samtools-view";
buildInputs = with pkgs; [ samtools ];
buildCommand = ''
diff --git a/tools/snap-align.nix b/tools/snap-align.nix
index 279cf20..f0bcb21 100644
--- a/tools/snap-align.nix
+++ b/tools/snap-align.nix
@@ -2,7 +2,7 @@
, ref
, bamOutput ? true
, flags ? null
-, indexAttrs ? {}
+, indexAttrs ? { }
}:
{ input1
@@ -18,7 +18,8 @@ let
fa = f: matchFiletype "snap-ref" { fa = _: f; } f;
fq = f: matchFiletype "snap-input" { fq = _: f; gz = matchFiletype' "snap-input" { fq = _: f; }; } f;
-in stage {
+in
+stage {
name = "snap-align";
buildInputs = with pkgs; [ bionix.snap.app bc ] ++ optional bamOutput samtools;
buildCommand = ''
@@ -32,6 +33,6 @@ in stage {
${optionalString (flags != null) flags} \
| samtools sort -n > $out
'';
- passthru.filetype = if bamOutput then filetype.bam {ref = ref; sorting = sort.none {};} else filetype.sam {ref = ref; sorting = sort.name {};};
+ passthru.filetype = if bamOutput then filetype.bam { inherit ref; sorting = sort.none { }; } else filetype.sam { inherit ref; sorting = sort.name { }; };
passthru.multicore = true;
}
diff --git a/tools/snap-app.nix b/tools/snap-app.nix
index c845d1f..0e74a20 100644
--- a/tools/snap-app.nix
+++ b/tools/snap-app.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchFromGitHub, zlib}:
+{ stdenv, fetchFromGitHub, zlib }:
stdenv.mkDerivation rec {
name = "snap-git";
diff --git a/tools/snap.nix b/tools/snap.nix
index 851c51a..51df5dc 100644
--- a/tools/snap.nix
+++ b/tools/snap.nix
@@ -3,15 +3,15 @@
with bionix;
rec {
- app = pkgs.callPackage ./snap-app.nix {};
+ app = pkgs.callPackage ./snap-app.nix { };
/* Align reads against a reference
- Type: snap :: {ref :: fasta, bamOutput :: bool, ...} -> {input1, input2} -> bam/sam
+ Type: snap :: {ref :: fasta, bamOutput :: bool, ...} -> {input1, input2} -> bam/sam
*/
align = callBionixE ./snap-align.nix;
/* Creates an reference index for SNAP
- Type: index :: {...} -> fasta -> SNAP index
+ Type: index :: {...} -> fasta -> SNAP index
*/
index = callBionixE ./snap-index.nix;
}
diff --git a/tools/snpeff-annotate.nix b/tools/snpeff-annotate.nix
index 317d303..9324f47 100644
--- a/tools/snpeff-annotate.nix
+++ b/tools/snpeff-annotate.nix
@@ -1,7 +1,8 @@
-{bionix
-,db
-,heapSize ? "31g"
-,flags ? ""}:
+{ bionix
+, db
+, heapSize ? "31g"
+, flags ? ""
+}:
input:
diff --git a/tools/snpeff-dbnsfp.nix b/tools/snpeff-dbnsfp.nix
index 518c121..003f7f8 100644
--- a/tools/snpeff-dbnsfp.nix
+++ b/tools/snpeff-dbnsfp.nix
@@ -1,7 +1,8 @@
-{bionix
-,dbnsfp
-,heapSize ? "31g"
-,flags ? ""}:
+{ bionix
+, dbnsfp
+, heapSize ? "31g"
+, flags ? ""
+}:
input:
diff --git a/tools/snpeff.nix b/tools/snpeff.nix
index fb3f4a9..45a0edc 100644
--- a/tools/snpeff.nix
+++ b/tools/snpeff.nix
@@ -1,15 +1,15 @@
-{bionix}:
+{ bionix }:
with bionix;
{
/* Annotate variants with SNPEff database. Some annotation DBs available in bionix.ref (e.g., bionix.ref.grch38.snpeff.db).
- Type: { db, ... } -> vcf -> vcf
+ Type: { db, ... } -> vcf -> vcf
*/
annotate = callBionixE ./snpeff-annotate.nix;
-
+
/* Annotate variants with dbNSFP database. Some dbNSFP annotation DBs available in bionix.ref (e.g., bionix.ref.grch38.snpeff.dbNSFP).
- Type: { dbnsfp, ... } -> vcf -> vcf
+ Type: { dbnsfp, ... } -> vcf -> vcf
*/
dbnsfp = callBionixE ./snpeff-dbnsfp.nix;
}
diff --git a/tools/snver-call.nix b/tools/snver-call.nix
index 72562c7..2ad4b72 100644
--- a/tools/snver-call.nix
+++ b/tools/snver-call.nix
@@ -11,7 +11,7 @@ with types;
let
config = pkgs.writeText "pool.txt" (concatMapStringsSep "\n" (x: "${x}\t${toString ploidy}\t1") (attrValues inputs));
- getref = f: matchFiletype "SNVer-call" { bam = {ref, ...}: ref; } f;
+ getref = matchFiletype "SNVer-call" { bam = { ref, ... }: ref; };
refs = mapAttrsToList (_: getref) inputs;
ref = head refs;
in
diff --git a/tools/snver.nix b/tools/snver.nix
index 6f95e1b..c5799ec 100644
--- a/tools/snver.nix
+++ b/tools/snver.nix
@@ -4,10 +4,10 @@ with bionix;
with pkgs;
{
- app = callPackage ./snver-app.nix {};
+ app = callPackage ./snver-app.nix { };
/* Call variants
- Type: { ploidy, ... } -> [bam] -> vcf
+ Type: { ploidy, ... } -> [bam] -> vcf
*/
call = callBionix ./snver-call.nix;
}
diff --git a/tools/star-align.nix b/tools/star-align.nix
index 44dd7f2..670c6bf 100644
--- a/tools/star-align.nix
+++ b/tools/star-align.nix
@@ -2,7 +2,7 @@
, ref
, bamOutput ? true
, flags ? null
-, indexAttrs ? {}
+, indexAttrs ? { }
}:
{ input1
@@ -18,7 +18,8 @@ let
fa = f: matchFiletype "star-ref" { fa = _: f; } f;
fq = f: matchFiletype "star-input" { fq = _: f; gz = matchFiletype' "star-input" { fq = _: "<(gunzip < ${f})"; }; } f;
-in stage {
+in
+stage {
name = "star-align";
buildInputs = with pkgs; [ star bc samtools ];
buildCommand = ''
@@ -33,6 +34,6 @@ in stage {
--readFilesIn ${fq input1} ${optionalString (input2 != null) (fq input2)}
${if bamOutput then "samtools view -b Aligned.out.sam > $out" else "cp Aligned.out.sam $out"}
'';
- passthru.filetype = if bamOutput then filetype.bam {ref = ref; sorting = sort.none {};} else filetype.sam {ref = ref; sorting = sort.name {};};
+ passthru.filetype = if bamOutput then filetype.bam { inherit ref; sorting = sort.none { }; } else filetype.sam { inherit ref; sorting = sort.name { }; };
passthru.multicore = true;
}
diff --git a/tools/star-index.nix b/tools/star-index.nix
index 4bc8399..9b7c819 100644
--- a/tools/star-index.nix
+++ b/tools/star-index.nix
@@ -1,8 +1,8 @@
{ bionix
, gtf
, flags ? null
-, extractSpliceSitesAttrs ? {}
-, extractExonsAttrs ? {}
+, extractSpliceSitesAttrs ? { }
+, extractExonsAttrs ? { }
, overhang ? 100
}:
diff --git a/tools/star.nix b/tools/star.nix
index 744c4e0..1209d4d 100644
--- a/tools/star.nix
+++ b/tools/star.nix
@@ -4,7 +4,7 @@ with bionix;
{
/* Align RNA against a reference genome
- Type: { ref, ... } -> { input1, input2 } -> bam
+ Type: { ref, ... } -> { input1, input2 } -> bam
*/
align = callBionixE ./star-align.nix;
index = callBionixE ./star-index.nix;
diff --git a/tools/strelka-call.nix b/tools/strelka-call.nix
index 74dfd0b..6a84b24 100644
--- a/tools/strelka-call.nix
+++ b/tools/strelka-call.nix
@@ -1,6 +1,6 @@
{ bionix
-, indexAttrs ? {}
-, bamIndexAttrs ? {}
+, indexAttrs ? { }
+, bamIndexAttrs ? { }
, flags ? null
}:
@@ -12,7 +12,7 @@ with types;
let
filename = path: last (splitString "/" path);
- getref = f: matchFiletype "strelka-call" { bam = x: x.ref; } f;
+ getref = matchFiletype "strelka-call" { bam = x: x.ref; };
refs = map getref inputs;
ref = head refs;
@@ -21,38 +21,39 @@ in
assert (length (unique refs) == 1);
let
-out = stage {
- name = "strelka-call";
- buildInputs = with pkgs; [ strelka ];
- buildCommand = ''
- ln -s ${ref} ref.fa
- ln -s ${bionix.samtools.faidx indexAttrs ref} ref.fa.fai
- ${concatMapStringsSep "\n" (p: "ln -s ${p} ${filename p}.bam") inputs}
- ${concatMapStringsSep "\n" (p: "ln -s ${bionix.samtools.index bamIndexAttrs p} ${filename p}.bai") inputs}
+ out = stage {
+ name = "strelka-call";
+ buildInputs = with pkgs; [ strelka ];
+ buildCommand = ''
+ ln -s ${ref} ref.fa
+ ln -s ${bionix.samtools.faidx indexAttrs ref} ref.fa.fai
+ ${concatMapStringsSep "\n" (p: "ln -s ${p} ${filename p}.bam") inputs}
+ ${concatMapStringsSep "\n" (p: "ln -s ${bionix.samtools.index bamIndexAttrs p} ${filename p}.bai") inputs}
- configureStrelkaGermlineWorkflow.py \
- ${concatMapStringsSep " " (i: "--bam ${filename i}.bam") inputs} \
- --ref ref.fa \
- --runDir $TMPDIR
+ configureStrelkaGermlineWorkflow.py \
+ ${concatMapStringsSep " " (i: "--bam ${filename i}.bam") inputs} \
+ --ref ref.fa \
+ --runDir $TMPDIR
- ./runWorkflow.py \
- -m local \
- -j $NIX_BUILD_CORES 2>&1
+ ./runWorkflow.py \
+ -m local \
+ -j $NIX_BUILD_CORES 2>&1
- # Strelka writes runtime stats and timestamps;
- # both have to be stripped to provide determinism
- cd results/variants
- rm *.tbi genome.vcf.gz
- for f in *.vcf.gz; do
- gunzip $f
- g=$(basename $f .gz)
- sed -i '/^##fileDate/d' $g
- sed -i '/^##startTime/d' $g
- sed -i '/^##cmd/d' $g
- done
- mv variants.vcf $out
- '';
- passthru.multicore = true;
- passthru.filetype = types.filetype.vcf {ref = ref;};
-};
-in out
+ # Strelka writes runtime stats and timestamps;
+ # both have to be stripped to provide determinism
+ cd results/variants
+ rm *.tbi genome.vcf.gz
+ for f in *.vcf.gz; do
+ gunzip $f
+ g=$(basename $f .gz)
+ sed -i '/^##fileDate/d' $g
+ sed -i '/^##startTime/d' $g
+ sed -i '/^##cmd/d' $g
+ done
+ mv variants.vcf $out
+ '';
+ passthru.multicore = true;
+ passthru.filetype = types.filetype.vcf { inherit ref; };
+ };
+in
+out
diff --git a/tools/strelka-callSomatic.nix b/tools/strelka-callSomatic.nix
index b409344..6a8f252 100644
--- a/tools/strelka-callSomatic.nix
+++ b/tools/strelka-callSomatic.nix
@@ -1,10 +1,10 @@
{ bionix
-, indexAttrs ? {}
-, bamIndexAttrs ? {}
+, indexAttrs ? { }
+, bamIndexAttrs ? { }
, flags ? null
}:
-{normal, tumour}:
+{ normal, tumour }:
with bionix;
with lib;
@@ -12,7 +12,7 @@ with types;
let
filename = path: last (splitString "/" path);
- getref = f: matchFiletype "strelka-callSomatic" { bam = x: x.ref; } f;
+ getref = matchFiletype "strelka-callSomatic" { bam = x: x.ref; };
inputs = [ normal tumour ];
refs = map getref inputs;
ref = head refs;
@@ -23,44 +23,45 @@ assert (length (unique refs) == 1);
let
-out = stage {
- name = "strelka-callSomatic";
- buildInputs = with pkgs; [ strelka ];
- outputs = [ "out" "indels" "snvs" ];
- buildCommand = ''
- ln -s ${ref} ref.fa
- ln -s ${bionix.samtools.faidx indexAttrs ref} ref.fa.fai
- ${concatMapStringsSep "\n" (p: "ln -s ${p} ${filename p}.bam") inputs}
- ${concatMapStringsSep "\n" (p: "ln -s ${bionix.samtools.index bamIndexAttrs p} ${filename p}.bai") inputs}
+ out = stage {
+ name = "strelka-callSomatic";
+ buildInputs = with pkgs; [ strelka ];
+ outputs = [ "out" "indels" "snvs" ];
+ buildCommand = ''
+ ln -s ${ref} ref.fa
+ ln -s ${bionix.samtools.faidx indexAttrs ref} ref.fa.fai
+ ${concatMapStringsSep "\n" (p: "ln -s ${p} ${filename p}.bam") inputs}
+ ${concatMapStringsSep "\n" (p: "ln -s ${bionix.samtools.index bamIndexAttrs p} ${filename p}.bai") inputs}
- configureStrelkaSomaticWorkflow.py \
- --normalBam ${filename normal}.bam \
- --tumourBam ${filename tumour}.bam \
- --ref ref.fa \
- --runDir $TMPDIR
+ configureStrelkaSomaticWorkflow.py \
+ --normalBam ${filename normal}.bam \
+ --tumourBam ${filename tumour}.bam \
+ --ref ref.fa \
+ --runDir $TMPDIR
- ./runWorkflow.py \
- -m local \
- -j $NIX_BUILD_CORES
+ ./runWorkflow.py \
+ -m local \
+ -j $NIX_BUILD_CORES
- # Strelka writes runtime stats and timestamps;
- # both have to be stripped to provide determinism
- cd results/variants
- rm *.tbi
- for f in *.vcf.gz; do
- gunzip $f
- g=$(basename $f .gz)
- sed -i '/^##fileDate/d' $g
- sed -i '/^##startTime/d' $g
- sed -i '/^##cmd/d' $g
- done
- mv somatic.indels.vcf $indels
- mv somatic.snvs.vcf $snvs
+ # Strelka writes runtime stats and timestamps;
+ # both have to be stripped to provide determinism
+ cd results/variants
+ rm *.tbi
+ for f in *.vcf.gz; do
+ gunzip $f
+ g=$(basename $f .gz)
+ sed -i '/^##fileDate/d' $g
+ sed -i '/^##startTime/d' $g
+ sed -i '/^##cmd/d' $g
+ done
+ mv somatic.indels.vcf $indels
+ mv somatic.snvs.vcf $snvs
- ln -s $snvs $out
- '';
- passthru.multicore = true;
- passthru.filetype = types.filetype.vcf {ref = ref;};
-};
+ ln -s $snvs $out
+ '';
+ passthru.multicore = true;
+ passthru.filetype = types.filetype.vcf { inherit ref; };
+ };
-in out
+in
+out
diff --git a/tools/strelka.nix b/tools/strelka.nix
index 16f4a2b..c71f07b 100644
--- a/tools/strelka.nix
+++ b/tools/strelka.nix
@@ -5,11 +5,11 @@ with types;
{
/* Calls somatic variants
- Type: callSomatic :: {...} -> {tumour, normal} -> somatic results
+ Type: callSomatic :: {...} -> {tumour, normal} -> somatic results
*/
callSomatic = callBionixE ./strelka-callSomatic.nix;
/* Calls variants
- Type: call :: {...} -> [input] -> results
+ Type: call :: {...} -> [input] -> results
*/
call = callBionixE ./strelka-call.nix;
}
diff --git a/tools/whisper-align.nix b/tools/whisper-align.nix
index 1731bfe..19eef0d 100644
--- a/tools/whisper-align.nix
+++ b/tools/whisper-align.nix
@@ -2,7 +2,7 @@
, ref
, bamOutput ? true
, flags ? null
-, indexAttrs ? {}
+, indexAttrs ? { }
}:
{ input1
@@ -18,7 +18,8 @@ let
fa = f: matchFiletype "whisper-ref" { fa = _: f; } f;
fq = f: matchFiletype "whisper-input" { fq = _: f; gz = matchFiletype' "whisper-input" { fq = _: f; }; } f;
-in stage {
+in
+stage {
name = "whisper-mem";
buildInputs = with pkgs; [ whisper ];
buildCommand = ''
@@ -34,6 +35,6 @@ in stage {
${optionalString (input2 != null) (fq input2)} \
> $out
'';
- passthru.filetype = if bamOutput then filetype.bam {ref = ref; sorting = sort.none {};} else filetype.sam {ref = ref; sorting = sort.name {};};
+ passthru.filetype = if bamOutput then filetype.bam { inherit ref; sorting = sort.none { }; } else filetype.sam { inherit ref; sorting = sort.name { }; };
passthru.multicore = true;
}
diff --git a/tools/whisper.nix b/tools/whisper.nix
index ff56f8a..8b89cb2 100644
--- a/tools/whisper.nix
+++ b/tools/whisper.nix
@@ -6,7 +6,7 @@ rec {
index = callBionixE ./whisper-index.nix;
/* Align reads against a reference
- Type: { ref, ... } -> { input1, input2 } -> bam
+ Type: { ref, ... } -> { input1, input2 } -> bam
*/
align = callBionixE ./whisper-align.nix;
}
diff --git a/tools/xenomapper-allocate.nix b/tools/xenomapper-allocate.nix
index 3c0fc08..adac472 100644
--- a/tools/xenomapper-allocate.nix
+++ b/tools/xenomapper-allocate.nix
@@ -2,7 +2,7 @@
, flags ? null
}:
-{primary, secondary}:
+{ primary, secondary }:
with bionix;
with lib;
@@ -10,8 +10,8 @@ with types;
let
- isSortedBam = matchFiletype "xenomapper-allocate" {bam = matchSorting "xenomapper-allocate" { coord = _: false; name = _: true; none = _: false; }; };
- outs = [ "primary_specific" "primary_multi" "secondary_specific" "secondary_multi" "unassigned" "unresolved"];
+ isSortedBam = matchFiletype "xenomapper-allocate" { bam = matchSorting "xenomapper-allocate" { coord = _: false; name = _: true; none = _: false; }; };
+ outs = [ "primary_specific" "primary_multi" "secondary_specific" "secondary_multi" "unassigned" "unresolved" ];
in
diff --git a/tools/xenomapper.nix b/tools/xenomapper.nix
index d22f84b..5ac903e 100644
--- a/tools/xenomapper.nix
+++ b/tools/xenomapper.nix
@@ -1,10 +1,10 @@
-{bionix}:
+{ bionix }:
with bionix;
{
/* Split aligned reads based on primary and secondary alignments
- Type: { ... } -> { primary :: bam, secondary :: bam } -> { primary_specific :: bam, primary_multi :: bam, secondary_specific :: bam, secondary_multi :: bam, unassigned :: bam, unresolved :: bam }
+ Type: { ... } -> { primary :: bam, secondary :: bam } -> { primary_specific :: bam, primary_multi :: bam, secondary_specific :: bam, secondary_multi :: bam, unassigned :: bam, unresolved :: bam }
*/
allocate = callBionixE ./xenomapper-allocate.nix;
-} \ No newline at end of file
+}