aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-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
7 files changed, 259 insertions, 219 deletions
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; };