diff options
author | Justin Bedo <cu@cua0.org> | 2021-10-29 17:39:01 +1100 |
---|---|---|
committer | Justin Bedo <cu@cua0.org> | 2021-10-29 17:39:01 +1100 |
commit | bac9248a5e08e8afdf5485a6e27cfe72e1ca5090 (patch) | |
tree | 8719a280b56122017d46b582cd3da8547dd3f548 /tools | |
parent | ab809b8c77efdad9fb54d3591a0193a1cbe888d1 (diff) |
treewide reformatting and simplification
- simplify with statix
- reformat with nixpkgs-fmt
Diffstat (limited to 'tools')
87 files changed, 524 insertions, 458 deletions
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 |