From 53f9549eb4957654a18afdb6f5c1049a1eb7ee53 Mon Sep 17 00:00:00 2001 From: Justin Bedo Date: Mon, 19 Aug 2019 10:42:39 +1000 Subject: snver: require labelled samples SNVer does not extract sample names from the BAM files and labels the columns with the input file paths rather than sample names. We rename the paths to names. --- test-tnpair.nix | 2 +- tools/snver-call.nix | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/test-tnpair.nix b/test-tnpair.nix index 0e082d6..7fe5750 100644 --- a/test-tnpair.nix +++ b/test-tnpair.nix @@ -85,7 +85,7 @@ let "${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; } (with tnpairResult.alignments; [ normal tumour ]); + snver = snver.call { ploidy=1; } tnpairResult.alignments; mosdepth = mosdepth.plot {} { inputs = mapAttrsToList (_: mosdepth.depth {}) tnpairResult.alignments; names = [ "seq1" "seq2" ]; }; inherit alignments; }; diff --git a/tools/snver-call.nix b/tools/snver-call.nix index 5d80719..72562c7 100644 --- a/tools/snver-call.nix +++ b/tools/snver-call.nix @@ -10,9 +10,9 @@ with lib; with types; let - config = pkgs.writeText "pool.txt" (concatMapStringsSep "\n" (x: "${x}\t${toString ploidy}\t1") inputs); + config = pkgs.writeText "pool.txt" (concatMapStringsSep "\n" (x: "${x}\t${toString ploidy}\t1") (attrValues inputs)); getref = f: matchFiletype "SNVer-call" { bam = {ref, ...}: ref; } f; - refs = map getref inputs; + refs = mapAttrsToList (_: getref) inputs; ref = head refs; in @@ -25,6 +25,10 @@ stage { buildCommand = '' SNVerPool -i / -c ${config} -r ${ref} -o snver + for f in *.vcf ; do + ${concatStringsSep "\n" (mapAttrsToList (x: y: "sed -i 's|//${y}|${x}|' $f") inputs)} + done + mkdir $out cp snver.failed.log $log ln -s $log $out/snver.failed.log -- cgit v1.2.3