aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/gridss-annotateVariants.nix18
-rw-r--r--tools/gridss-assemble.nix7
-rw-r--r--tools/gridss-extractSVReads.nix1
-rw-r--r--tools/gridss-identifyVariants.nix12
-rw-r--r--tools/gridss-softClipsToSplitReads.nix2
-rw-r--r--tools/gridss.nix4
6 files changed, 30 insertions, 14 deletions
diff --git a/tools/gridss-annotateVariants.nix b/tools/gridss-annotateVariants.nix
index 4422cd6..cae5daf 100644
--- a/tools/gridss-annotateVariants.nix
+++ b/tools/gridss-annotateVariants.nix
@@ -2,8 +2,8 @@
, nixpkgs
, bwaIndexAttrs ? {}
, faidxAttrs ? {}
+, indexAttrs ? {}
, assemblyAttrs ? {}
-, extractSVReadsAttrs ? {}
, collectMetricsAttrs ? {}
, softClipsToSplitReadsAttrs ? {}
, identifyVariantsAttrs ? {}
@@ -35,6 +35,16 @@ let
done
'';
+ linkSV = input: ''
+ BASENAME=$(basename ${input})
+ WRKDIR="''${BASENAME}.gridss.working"
+ if [[ ! -e $WRKDIR ]] ; then
+ mkdir $WRKDIR
+ fi
+ ln -s ${input} $WRKDIR/$BASENAME.sv.bam
+ ln -s ${bionix.samtools.index indexAttrs input} $WRKDIR/$BASENAME.sv.bai
+ '';
+
assembly = bionix.samtools.sort {} (softClipsToSplitReads softClipsToSplitReadsAttrs (bionix.samtools.sort { nameSort = true;} (bionix.gridss.assemble assemblyAttrs inputs)));
in
@@ -50,12 +60,10 @@ stdenv.mkDerivation rec {
for f in ${bionix.bwa.index bwaIndexAttrs ref}/*; do
ln -s $f
done
- ${concatMapStringsSep "\n" (linkInput extractSVReads extractSVReadsAttrs) inputs}
+ ${concatMapStringsSep "\n" (linkSV) inputs}
+ ${linkSV assembly}
${concatMapStringsSep "\n" (linkInput collectMetrics collectMetricsAttrs) inputs}
${linkInput collectMetrics collectMetricsAttrs assembly}
- ASSBASE=$(basename ${assembly})
- ln -s ${assembly} $ASSBASE.gridss.working/$ASSBASE.sv.bam
- ln -s ${bionix.samtools.index {} assembly} $ASSBASE.gridss.working/$ASSBASE.sv.bai
ln -s ${identifyVariants identifyVariantsAttrs inputs} input.vcf
java -Xmx4g -Dsamjdk.create_index=true \
-cp ${jar} gridss.AnnotateVariants \
diff --git a/tools/gridss-assemble.nix b/tools/gridss-assemble.nix
index cdda748..1bda91f 100644
--- a/tools/gridss-assemble.nix
+++ b/tools/gridss-assemble.nix
@@ -2,8 +2,8 @@
, nixpkgs
, bwaIndexAttrs ? {}
, faidxAttrs ? {}
+, indexAttrs ? {}
, collectMetricsAttrs ? {}
-, extractSVReadsAttrs ? {}
, flags ? null
}:
@@ -23,9 +23,8 @@ let
BASENAME=$(basename ${input})
WRKDIR="''${BASENAME}.gridss.working"
mkdir $WRKDIR
- for f in ${bionix.gridss.extractSVReads extractSVReadsAttrs input}/* ; do
- ln -s $f $WRKDIR/$BASENAME.''${f#*.}
- done
+ ln -s ${input} $WRKDIR/$BASENAME.sv.bam
+ ln -s ${bionix.samtools.index indexAttrs input} $WRKDIR/$BASENAME.sv.bai
for f in ${bionix.gridss.collectMetrics collectMetricsAttrs input}/* ; do
ln -s $f $WRKDIR/$BASENAME.''${f#*.}
done
diff --git a/tools/gridss-extractSVReads.nix b/tools/gridss-extractSVReads.nix
index b5ceffb..d260086 100644
--- a/tools/gridss-extractSVReads.nix
+++ b/tools/gridss-extractSVReads.nix
@@ -5,6 +5,7 @@
, flags ? null
, unmappedReads ? false
, minClipLength ? 5
+, collectMetricsAttrs ? {}
, config ? null
}:
diff --git a/tools/gridss-identifyVariants.nix b/tools/gridss-identifyVariants.nix
index c91de00..d37e7ae 100644
--- a/tools/gridss-identifyVariants.nix
+++ b/tools/gridss-identifyVariants.nix
@@ -2,8 +2,8 @@
, nixpkgs
, bwaIndexAttrs ? {}
, faidxAttrs ? {}
+, indexAttrs ? {}
, assemblyAttrs ? {}
-, extractSVReadsAttrs ? {}
, collectMetricsAttrs ? {}
, softClipsToSplitReadsAttrs ? {}
, flags ? null
@@ -34,6 +34,16 @@ let
done
'';
+ linkSV = input: ''
+ BASENAME=$(basename ${input})
+ WRKDIR="''${BASENAME}.gridss.working"
+ if [[ ! -e $WRKDIR ]] ; then
+ mkdir $WRKDIR
+ fi
+ ln -s ${input} $WRKDIR/$BASENAME.sv.bam
+ ln -s ${bionix.samtools.index indexAttrs input} $WRKDIR/$BASENAME.sv.bai
+ '';
+
assembly = bionix.samtools.sort {} (softClipsToSplitReads softClipsToSplitReadsAttrs (bionix.samtools.sort { nameSort = true;} (bionix.gridss.assemble assemblyAttrs inputs)));
in
diff --git a/tools/gridss-softClipsToSplitReads.nix b/tools/gridss-softClipsToSplitReads.nix
index 1f9c8b4..2fff15c 100644
--- a/tools/gridss-softClipsToSplitReads.nix
+++ b/tools/gridss-softClipsToSplitReads.nix
@@ -17,8 +17,6 @@ let
ref = matchFiletype "gridss-softClipsToSplitReads" { bam = x: x.ref; } input;
in
-assert (matchFileSorting "gridss-softClipsToSplitReads" { name = _: true; } input);
-
stdenv.mkDerivation rec {
name = "gridss-softClipsToSplitReads";
buildInputs = [ jre bwa ];
diff --git a/tools/gridss.nix b/tools/gridss.nix
index 1e4e2d1..b85e84e 100644
--- a/tools/gridss.nix
+++ b/tools/gridss.nix
@@ -17,6 +17,6 @@ rec {
assemble = callBionix ./gridss-assemble.nix;
identifyVariants = callBionix ./gridss-identifyVariants.nix;
annotateVariants = callBionix ./gridss-annotateVariants.nix;
- preprocessBam = input: with samtools; markdup {} (sort {} (fixmate {mateScore = true;} (bionix.gridss.softClipsToSplitReads {} (bionix.gridss.computeSamTags {} (sort {nameSort = true;} input)))));
- call = inputs: bionix.gridss.annotateVariants {} (map bionix.gridss.preprocessBam inputs);
+ preprocessBam = input: with samtools; sort {} (gridss.softClipsToSplitReads {} (gridss.computeSamTags {} (sort {nameSort = true;} (gridss.extractSVReads {} (markdup {} (sort {} (fixmate {mateScore = true;} (sort {nameSort = true;} input))))))));
+ call = inputs: bionix.gridss.annotateVariants {} (map gridss.preprocessBam inputs);
}