aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Bedo <cu@cua0.org>2021-07-28 08:07:32 +1000
committerJustin Bedo <cu@cua0.org>2021-07-28 09:17:56 +1000
commited98174bbefc85f9895c870fdb7518e2a534a150 (patch)
tree913c1eb5cb384213d22af6cf4f4e2b8fd2a51276
parent134f5e0bfcd5f22e3adee4b707e10693cf71e635 (diff)
bugfix: use unsorted type for alignment output
Most aligners are only pseudo-name sorted (i.e., pairs adjacant).
-rw-r--r--examples/call.nix1
-rw-r--r--examples/ex-tnpair/tnpair.nix1
-rw-r--r--test-tnpair.nix4
-rw-r--r--tools/bowtie-align.nix2
-rw-r--r--tools/bwa-mem.nix2
-rw-r--r--tools/bwa-mem2.nix2
-rw-r--r--tools/gridss-assemble.nix2
-rw-r--r--tools/hisat2-align.nix2
-rw-r--r--tools/minimap2-align.nix2
-rw-r--r--tools/snap-align.nix2
-rw-r--r--tools/star-align.nix2
-rw-r--r--tools/whisper-align.nix2
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;
}