From ed98174bbefc85f9895c870fdb7518e2a534a150 Mon Sep 17 00:00:00 2001 From: Justin Bedo Date: Wed, 28 Jul 2021 08:07:32 +1000 Subject: bugfix: use unsorted type for alignment output Most aligners are only pseudo-name sorted (i.e., pairs adjacant). --- examples/call.nix | 1 + examples/ex-tnpair/tnpair.nix | 1 + test-tnpair.nix | 4 ++-- tools/bowtie-align.nix | 2 +- tools/bwa-mem.nix | 2 +- tools/bwa-mem2.nix | 2 +- tools/gridss-assemble.nix | 2 +- tools/hisat2-align.nix | 2 +- tools/minimap2-align.nix | 2 +- tools/snap-align.nix | 2 +- tools/star-align.nix | 2 +- tools/whisper-align.nix | 2 +- 12 files changed, 13 insertions(+), 11 deletions(-) diff --git a/examples/call.nix b/examples/call.nix index 8c4f073..8a38fdb 100644 --- a/examples/call.nix +++ b/examples/call.nix @@ -12,6 +12,7 @@ with lib; let preprocess = flip pipe [ (bwa.align { inherit ref; }) + (samtools.sort { nameSort = true; }) (samtools.fixmate {}) (samtools.sort {}) (samtools.markdup {}) diff --git a/examples/ex-tnpair/tnpair.nix b/examples/ex-tnpair/tnpair.nix index 70f5514..9e6befe 100644 --- a/examples/ex-tnpair/tnpair.nix +++ b/examples/ex-tnpair/tnpair.nix @@ -12,6 +12,7 @@ let preprocess = s: pipe s [ fetch (align { preset = "sr"; ref = ref.grch38.seq; flags = "-R'@RG\\tID:${s.type}\\tSM:${s.type}'"; }) + (sort { nameSort = true; }) (fixmate {}) (sort { }) (markdup { }) diff --git a/test-tnpair.nix b/test-tnpair.nix index 7cc5453..6eb2e23 100644 --- a/test-tnpair.nix +++ b/test-tnpair.nix @@ -11,7 +11,7 @@ let ref = fetchfa ./examples/ref.fa; - alignWithRG = rg: bwa.align { inherit ref; flags = "-R'@RG\\tID:${rg}\\tSM:${rg}'";}; + 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 {}; @@ -41,7 +41,7 @@ let glvariants = strelka.call {} (builtins.attrValues alignments); platypusVars = platypus.call {} (builtins.attrValues alignments); octopusVars = octopus.call {} (builtins.attrValues alignments); - shards = map (bwa.align {inherit ref;}) (shard.fastQPair 2 normal.files); + shards = map (x: nameSort (bwa.align {inherit ref;} x)) (shard.fastQPair 2 normal.files); }; tnpairResult = processPair tnpair; diff --git a/tools/bowtie-align.nix b/tools/bowtie-align.nix index 57b0b01..c83c49c 100644 --- a/tools/bowtie-align.nix +++ b/tools/bowtie-align.nix @@ -32,6 +32,6 @@ in stage { ${optionalString bamOutput "| samtools view -b"} \ > $out ''; - passthru.filetype = if bamOutput then filetype.bam {ref = ref; sorting = sort.name {};} else filetype.sam {ref = ref; sorting = sort.name {};}; + passthru.filetype = if bamOutput then filetype.bam {ref = ref; sorting = sort.none {};} else filetype.sam {ref = ref; sorting = sort.name {};}; passthru.multicore = true; } diff --git a/tools/bwa-mem.nix b/tools/bwa-mem.nix index e58ef03..31c9487 100644 --- a/tools/bwa-mem.nix +++ b/tools/bwa-mem.nix @@ -35,6 +35,6 @@ in stage { ${optionalString bamOutput "| samtools view -b"} \ > $out ''; - passthru.filetype = if bamOutput then filetype.bam {ref = ref; sorting = sort.name {};} else filetype.sam {ref = ref; sorting = sort.name {};}; + passthru.filetype = if bamOutput then filetype.bam {ref = ref; sorting = sort.none {};} else filetype.sam {ref = ref; sorting = sort.name {};}; passthru.multicore = true; } diff --git a/tools/bwa-mem2.nix b/tools/bwa-mem2.nix index 3de1944..b16b7ea 100644 --- a/tools/bwa-mem2.nix +++ b/tools/bwa-mem2.nix @@ -35,6 +35,6 @@ in stage { ${optionalString bamOutput "| samtools view -b"} \ > $out ''; - passthru.filetype = if bamOutput then filetype.bam {ref = ref; sorting = sort.name {};} else filetype.sam {ref = ref; sorting = sort.name {};}; + passthru.filetype = if bamOutput then filetype.bam {ref = ref; sorting = sort.none {};} else filetype.sam {ref = ref; sorting = sort.name {};}; passthru.multicore = true; } diff --git a/tools/gridss-assemble.nix b/tools/gridss-assemble.nix index 9e51cab..1a46eae 100644 --- a/tools/gridss-assemble.nix +++ b/tools/gridss-assemble.nix @@ -70,6 +70,6 @@ stage rec { touch $out cp -r out.gridss.working $work ''; - passthru.filetype = filetype.bam { ref = ref; sorting = sort.name {}; }; + passthru.filetype = filetype.bam { ref = ref; sorting = sort.none {}; }; passthru.multicore = true; } diff --git a/tools/hisat2-align.nix b/tools/hisat2-align.nix index dfd9601..7a216a6 100644 --- a/tools/hisat2-align.nix +++ b/tools/hisat2-align.nix @@ -33,6 +33,6 @@ in stage { | samtools sort -n \ > $out ''; - passthru.filetype = if bamOutput then filetype.bam {ref = ref; sorting = sort.name {};} else filetype.sam {ref = ref; sorting = sort.name {};}; + passthru.filetype = if bamOutput then filetype.bam {ref = ref; sorting = sort.none {};} else filetype.sam {ref = ref; sorting = sort.name {};}; passthru.multicore = true; } diff --git a/tools/minimap2-align.nix b/tools/minimap2-align.nix index 7164ace..a6de0b7 100644 --- a/tools/minimap2-align.nix +++ b/tools/minimap2-align.nix @@ -32,6 +32,6 @@ in stage { ${optionalString bamOutput "| samtools view -b"} \ > $out ''; - passthru.filetype = if bamOutput then filetype.bam {ref = ref; sorting = sort.name {};} else filetype.sam {ref = ref; sorting = sort.name {};}; + passthru.filetype = if bamOutput then filetype.bam {ref = ref; sorting = sort.none {};} else filetype.sam {ref = ref; sorting = sort.none {};}; passthru.multicore = true; } diff --git a/tools/snap-align.nix b/tools/snap-align.nix index 4647142..279cf20 100644 --- a/tools/snap-align.nix +++ b/tools/snap-align.nix @@ -32,6 +32,6 @@ in stage { ${optionalString (flags != null) flags} \ | samtools sort -n > $out ''; - passthru.filetype = if bamOutput then filetype.bam {ref = ref; sorting = sort.name {};} else filetype.sam {ref = ref; sorting = sort.name {};}; + passthru.filetype = if bamOutput then filetype.bam {ref = ref; sorting = sort.none {};} else filetype.sam {ref = ref; sorting = sort.name {};}; passthru.multicore = true; } diff --git a/tools/star-align.nix b/tools/star-align.nix index 0cf9ab9..44dd7f2 100644 --- a/tools/star-align.nix +++ b/tools/star-align.nix @@ -33,6 +33,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.name {};} else filetype.sam {ref = ref; sorting = sort.name {};}; + passthru.filetype = if bamOutput then filetype.bam {ref = ref; sorting = sort.none {};} else filetype.sam {ref = ref; sorting = sort.name {};}; passthru.multicore = true; } diff --git a/tools/whisper-align.nix b/tools/whisper-align.nix index c44205a..1731bfe 100644 --- a/tools/whisper-align.nix +++ b/tools/whisper-align.nix @@ -34,6 +34,6 @@ in stage { ${optionalString (input2 != null) (fq input2)} \ > $out ''; - passthru.filetype = if bamOutput then filetype.bam {ref = ref; sorting = sort.name {};} else filetype.sam {ref = ref; sorting = sort.name {};}; + passthru.filetype = if bamOutput then filetype.bam {ref = ref; sorting = sort.none {};} else filetype.sam {ref = ref; sorting = sort.name {};}; passthru.multicore = true; } -- cgit v1.2.3