# HG changeset patch # User hepcat72 # Date 1539719749 14400 # Node ID e5150e64206acbd17514db1011b99472d80a9495 planemo upload for repository https://github.com/hepcat72/robs_galaxy_tools/tree/master/tools/lumpyexpress commit 9c7264014db750b32a8fa78f511c7efbd12529d9-dirty diff -r 000000000000 -r e5150e64206a lumpy_wrapper.tcsh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lumpy_wrapper.tcsh Tue Oct 16 15:55:49 2018 -0400 @@ -0,0 +1,147 @@ +#!/bin/tcsh + +#USAGE: lumpy_pipeline.tcsh PAIREDENDRUN OUTVCF BAMS +#EXAMPLE: lumpy_pipeline.tcsh 1 lumpy.vcf *.bam + +#PAIREDENDRUN - 1=paired end 0=single end +#BAMS - Any bam files (will be sorted if not sorted & indexed if not indexed) + +#REQUIRED DEPENDENCIES: +#lumpy +#samtools +#samblaster + +setenv PAIREDENDRUN `echo $argv | cut -f 1 -d " "` +setenv OUTVCF `echo $argv | cut -f 2 -d " "` +setenv MYARGV `echo $argv | cut -f 3-999 -d " "` + +setenv BAMS '' +setenv SPLTS '' +setenv DSCDS '' +setenv SPLTOPTS '' + +foreach b ( $MYARGV ) + + echo + echo Preparing $b + + echo + echo Parsing sample name + set SAMPLE=`echo $b | perl -e 'while(<>){s/\.bam//;print}'` + + if ( $status ) then + echo "Unable to parse sample name in $b" + exit 1 + endif + + echo + echo "Checking BAM $b" + samtools view -H $b | perl -e '$y=0;while(<>){if(/SO:coordinate/){$y=1;}}if($y == 0){exit(2)}' + + if ( $status ) then + echo + echo "Sorting BAM $b" + samtools sort -o $b.sort -O BAM $b + if ( $status ) then + echo "Error sorting BAM $b" + exit 2 + endif + mv -f $b.sort $b + if ( $status ) then + echo "Error renaming BAM $b.sort $b" + exit 3 + endif + endif + + perl -e 'unless(-e "$ARGV[0].bai"){exit(3)}' $b + if ( $status ) then + echo + echo "Indexing BAM $b" + samtools index -b $b + if ( $status ) then + echo "Error indexing BAM" + exit 4 + endif + endif + + echo + echo Getting splitters + samtools sort -n -O sam $b | samblaster -q -s /dev/stdout -o /dev/null | samtools view -Sb - | samtools sort - -o ${SAMPLE}.splitters.bam + + if ( $status ) then + echo "Getting splitters from $b failed" + exit 5 + endif + + echo + echo Indexing splitters + samtools index -b ${SAMPLE}.splitters.bam + + if ( $status ) then + echo "Indexing discordants in $b failed" + exit 6 + endif + + if ( $PAIREDENDRUN ) then + echo + echo Getting discordants + samtools view -b -F 1294 $b | samtools sort - -o ${SAMPLE}.discordants.bam + + if ( $status ) then + echo "Getting discordants from $b failed" + exit 7 + endif + + echo + echo Indexing discordants + samtools index -b ${SAMPLE}.discordants.bam + + if ( $status ) then + echo "Indexing discordants in $b failed" + exit 8 + endif + + if ( ${?DSCDS} > 0 && ${%DSCDS} > 0 ) setenv DSCDS "$DSCDS,${SAMPLE}.discordants.bam" + if ( ${?DSCDS} == 0 || ${%DSCDS} == 0 ) setenv DSCDS ${SAMPLE}.discordants.bam + + if ( ${?SPLTS} > 0 && ${%SPLTS} > 0 ) setenv SPLTS "$SPLTS,${SAMPLE}.splitters.bam" + if ( ${?SPLTS} == 0 || ${%SPLTS} == 0 ) setenv SPLTS ${SAMPLE}.splitters.bam + + else + + if ( ${?SPLTOPTS} > 0 && ${%SPLTOPTS} > 0 ) setenv SPLTOPTS "$SPLTOPTS -sr id:${SAMPLE},bam_file:${SAMPLE}.splitters.bam,back_distance:10,weight:1,min_mapping_threshold:20" + if ( ${?SPLTOPTS} == 0 || ${%SPLTOPTS} == 0 ) setenv SPLTOPTS "-sr id:${SAMPLE},bam_file:${SAMPLE}.splitters.bam,back_distance:10,weight:1,min_mapping_threshold:20" + + endif + + if ( ${?BAMS} > 0 && ${%BAMS} > 0 ) setenv BAMS "$BAMS,$b" + if ( ${?BAMS} == 0 || ${%BAMS} == 0 ) setenv BAMS $b + +end + +if ( $PAIREDENDRUN ) then + + echo + echo "Running: lumpyexpress -B $BAMS -S $SPLTS -D $DSCDS -o $OUTVCF" + lumpyexpress -B $BAMS -S $SPLTS -D $DSCDS -o $OUTVCF + + if ( $status ) then + echo "lumpyexpress failed" + exit 9 + endif + +else + + echo + echo "Running lumpy: lumpy -mw 4 -tt 0 $SPLTOPTS > $OUTVCF" + lumpy -mw 4 -tt 0 $SPLTOPTS > $OUTVCF + + if ( $status ) then + echo "lumpy failed" + exit 10 + endif + +endif + +echo +echo DONE diff -r 000000000000 -r e5150e64206a lumpyexpress.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lumpyexpress.xml Tue Oct 16 15:55:49 2018 -0400 @@ -0,0 +1,74 @@ + + Single or paired end SV detection + + + python + pysam + numpy + lumpy-sv + samtools + samblaster + sambamba + gawk + + + ___COMMAND___ ___VERSION_FLAG___ + + + + + + + + + + + + + + + + + + + + + + + + + ,bam_file:.splitters.bam,back_distance:10,weight:1,min_mapping_threshold:20`. Submit an issue to the tool wrapper repo if you would like more options to be available: https://github.com/hepcat72/robs_galaxy_tools + + Split reads and discordant reads are extracted from the supplied bam files. Each bam file should represent a different sample. + ]]> + + + + 10.1186/gb-2014-15-6-r84 + + + diff -r 000000000000 -r e5150e64206a test-data/lumpy-test1.vcf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/lumpy-test1.vcf Tue Oct 16 15:55:49 2018 -0400 @@ -0,0 +1,36 @@ +##fileformat=VCFv4.2 +##source=LUMPY +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +##ALT= +##ALT= +##ALT= +##ALT= +##ALT= +##ALT= +##FORMAT= +##FORMAT= +##FORMAT= +##FORMAT= +##FORMAT= +#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT JSS-Vmut-01__Read JSS-Vmut-12__Read JSS-Vmut-14__Read +NC_009016.1 1417 1_1 N [NC_009016.1:19752[N . . SVTYPE=BND;STRANDS=--:5;EVENT=1;MATEID=1_2;CIPOS=-128,9;CIEND=-291,9;CIPOS95=-92,2;CIEND95=-121,2;IMPRECISE;SU=5;PE=5;SR=0 GT:SU:PE:SR ./.:1:1:0 ./.:4:4:0 ./.:0:0:0 +NC_009016.1 19752 1_2 N [NC_009016.1:1417[N . . SVTYPE=BND;STRANDS=--:5;SECONDARY;EVENT=1;MATEID=1_1;CIPOS=-291,9;CIEND=-128,9;CIPOS95=-121,2;CIEND95=-92,2;IMPRECISE;SU=5;PE=5;SR=0 GT:SU:PE:SR ./.:1:1:0 ./.:4:4:0 ./.:0:0:0 +NC_009016.1 10 2 N . . SVTYPE=DUP;STRANDS=-+:350;SVLEN=38187;END=38197;CIPOS=0,0;CIEND=0,0;CIPOS95=0,0;CIEND95=0,0;SU=350;PE=249;SR=101 GT:SU:PE:SR ./.:84:46:38 ./.:162:123:39 ./.:104:80:24 diff -r 000000000000 -r e5150e64206a test-data/test1-1.bam Binary file test-data/test1-1.bam has changed diff -r 000000000000 -r e5150e64206a test-data/test1-2.bam Binary file test-data/test1-2.bam has changed diff -r 000000000000 -r e5150e64206a test-data/test1-3.bam Binary file test-data/test1-3.bam has changed