├── Setup.hs ├── docs ├── plus.gif ├── minus.gif ├── hslogo-16.png ├── synopsis.png ├── bioshake.haddock ├── src │ ├── hscolour.css │ ├── Bioshake-Cutadapt.html │ ├── Bioshake-Cluster-Cutadapt.html │ ├── Bioshake-BWA.html │ ├── Bioshake-Bedtools.html │ ├── Bioshake-Cluster-Platypus.html │ ├── Bioshake-Platypus.html │ ├── Bioshake-Cluster-BWA.html │ ├── Bioshake-Cluster-Bedtools.html │ ├── Bioshake-ADTEx.html │ ├── Bioshake-FREEC.html │ ├── Bioshake-Cluster-ADTEx.html │ ├── Bioshake-Cluster-FREEC.html │ ├── Bioshake-Sequenza.html │ ├── Bioshake-Cluster-Varscan.html │ ├── Bioshake-SnpEff.html │ ├── Bioshake-Varscan.html │ ├── Bioshake-Cluster-SnpEff.html │ └── Bioshake-Cluster-Sequenza.html ├── mini_Bioshake-BWA.html ├── mini_Bioshake-ADTEx.html ├── mini_Bioshake-FREEC.html ├── mini_Bioshake-Cutadapt.html ├── mini_Bioshake-Platypus.html ├── mini_Bioshake-Bedtools.html ├── mini_Bioshake-Cluster-BWA.html ├── mini_Bioshake-Cluster-ADTEx.html ├── mini_Bioshake-Cluster-FREEC.html ├── mini_Bioshake-Cluster-Cutadapt.html ├── mini_Bioshake-Cluster-Platypus.html ├── mini_Bioshake-Cluster-Bedtools.html ├── mini_Bioshake-SnpEff.html ├── mini_Bioshake-Varscan.html ├── mini_Bioshake-Cluster-SnpEff.html ├── mini_Bioshake-Cluster-Varscan.html ├── mini_Bioshake-Picard.html ├── mini_Bioshake-Sequenza.html ├── mini_Bioshake-Cluster-Picard.html ├── mini_Bioshake-Cluster-Sequenza.html ├── mini_Bioshake-Implicit.html ├── mini_Bioshake-Samtools.html ├── mini_Bioshake-Cluster-Samtools.html ├── Bioshake-Cluster-BWA.html ├── Bioshake-Cluster-ADTEx.html ├── Bioshake-Cluster-FREEC.html ├── Bioshake-Cluster-Platypus.html ├── mini_Bioshake.html ├── Bioshake-Varscan.html ├── Bioshake-Cluster-Bedtools.html ├── Bioshake-Cluster-Cutadapt.html ├── Bioshake-ADTEx.html ├── Bioshake-Bedtools.html ├── mini_Bioshake-Types.html ├── Bioshake-Cutadapt.html ├── Bioshake-Cluster-SnpEff.html ├── mini_Bioshake-Cluster-Torque.html ├── Bioshake-BWA.html ├── Bioshake-FREEC.html ├── Bioshake-SnpEff.html ├── Bioshake-Platypus.html ├── Bioshake-Cluster-Varscan.html ├── Bioshake-Picard.html ├── Bioshake-Cluster-Picard.html ├── mini_Bioshake-TH.html └── mini_Bioshake-Tags.html ├── .gitignore ├── .gitattributes ├── examples ├── ref.fa ├── sample1-1.fq ├── sample1-2.fq ├── sample2-1.fq ├── sample2-2.fq └── README ├── stack.yaml ├── Bioshake ├── Cutadapt.hs ├── Hisat2.hs ├── Cluster │ ├── Hisat2.hs │ ├── Cutadapt.hs │ ├── Platypus.hs │ ├── Strelka.hs │ ├── ADTEx.hs │ ├── FREEC.hs │ ├── Gridss.hs │ ├── Bedtools.hs │ ├── SomaticSniper.hs │ ├── Sequenza.hs │ ├── SnpEff.hs │ ├── Varscan.hs │ ├── Picard.hs │ ├── Octopus.hs │ ├── BWA.hs │ ├── GATK.hs │ ├── CNVkit.hs │ ├── Samtools.hs │ ├── Kallisto.hs │ └── Torque.hs ├── ContextMap.hs ├── SomaticSniper.hs ├── Sequenza.hs ├── FREEC.hs ├── ADTEx.hs ├── Platypus.hs ├── Strelka.hs ├── Facets.hs ├── Bedtools.hs ├── SnpEff.hs ├── Octopus.hs ├── Picard.hs ├── Varscan.hs ├── Internal │ ├── ADTEx.hs │ ├── SomaticSniper.hs │ ├── Hisat2.hs │ ├── Platypus.hs │ ├── Cutadapt.hs │ ├── Bedtools.hs │ ├── SnpEff.hs │ ├── ContextMap.hs │ ├── Picard.hs │ ├── Varscan.hs │ ├── Strelka.hs │ ├── Octopus.hs │ ├── Sequenza.hs │ ├── FREEC.hs │ ├── Facets.hs │ ├── CNVkit.hs │ ├── BWA.hs │ ├── Samtools.hs │ └── Kallisto.hs ├── BWA.hs ├── Gridss.hs ├── CNVkit.hs ├── Samtools.hs ├── Kallisto.hs ├── Tags.hs └── Types.hs ├── default.nix ├── LICENSE ├── shell.nix └── edam-to-map.awk /Setup.hs: -------------------------------------------------------------------------------- 1 | import Distribution.Simple 2 | main = defaultMain 3 | -------------------------------------------------------------------------------- /docs/plus.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PapenfussLab/bioshake/HEAD/docs/plus.gif -------------------------------------------------------------------------------- /docs/minus.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PapenfussLab/bioshake/HEAD/docs/minus.gif -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .envrc 2 | .gitignore 3 | .stack-work/* 4 | doc/* 5 | *.dyn* 6 | *.o 7 | *.hi 8 | -------------------------------------------------------------------------------- /docs/hslogo-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PapenfussLab/bioshake/HEAD/docs/hslogo-16.png -------------------------------------------------------------------------------- /docs/synopsis.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PapenfussLab/bioshake/HEAD/docs/synopsis.png -------------------------------------------------------------------------------- /docs/bioshake.haddock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PapenfussLab/bioshake/HEAD/docs/bioshake.haddock -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.fa filter=lfs diff=lfs merge=lfs -text 2 | *.fq filter=lfs diff=lfs merge=lfs -text 3 | -------------------------------------------------------------------------------- /examples/ref.fa: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:577cea38916e1adba40d142db4afe919f2a87e03a52abae2747696621186c96b 3 | size 60909 4 | -------------------------------------------------------------------------------- /examples/sample1-1.fq: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:a84eacf212a8c22cf79af0aaf3fef1033533efbc46f6b01cb08d84e74c4c024e 3 | size 1822259 4 | -------------------------------------------------------------------------------- /examples/sample1-2.fq: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:b34d91e3d1d7fea789a78b7f799c2c2b057d0f4eee2c621df02129536741f333 3 | size 1822259 4 | -------------------------------------------------------------------------------- /examples/sample2-1.fq: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:9e5594be1d807ef389593d357d2d06806e81be29dbb0286a981bd3e9b6eaf121 3 | size 1821986 4 | -------------------------------------------------------------------------------- /examples/sample2-2.fq: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:5ccafff4c4ee882a15c4f9c36db1eaf77f5b5e2d30935061bb5d8982b7a8bcf7 3 | size 1821986 4 | -------------------------------------------------------------------------------- /stack.yaml: -------------------------------------------------------------------------------- 1 | resolver: lts-12.26 2 | flags: {} 3 | extra-package-dbs: [] 4 | packages: 5 | - . 6 | extra-deps: 7 | - basement-0.0.10 8 | - cryptonite-0.25 9 | - extra-1.6.14 10 | -------------------------------------------------------------------------------- /docs/src/hscolour.css: -------------------------------------------------------------------------------- 1 | .hs-keyglyph, .hs-layout {color: red;} 2 | .hs-keyword {color: blue;} 3 | .hs-comment, .hs-comment a {color: green;} 4 | .hs-str, .hs-chr {color: teal;} 5 | .hs-keyword, .hs-conid, .hs-varid, .hs-conop, .hs-varop, .hs-num, .hs-cpp, .hs-sel, .hs-definition {} 6 | -------------------------------------------------------------------------------- /Bioshake/Cutadapt.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleInstances #-} 2 | {-# LANGUAGE MultiParamTypeClasses #-} 3 | {-# LANGUAGE TemplateHaskell #-} 4 | {-# LANGUAGE TypeOperators #-} 5 | module Bioshake.Cutadapt where 6 | 7 | import Bioshake 8 | import Bioshake.Internal.Cutadapt 9 | import Bioshake.TH 10 | import Development.Shake 11 | 12 | $(makeSingleThread ''Trim [''IsFastQ] 'buildTrim) 13 | {- $trim Removes the given adaptor 'Seq' from fastq files using cutadapt. -} 14 | -------------------------------------------------------------------------------- /Bioshake/Hisat2.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleContexts #-} 2 | {-# LANGUAGE FlexibleInstances #-} 3 | {-# LANGUAGE MultiParamTypeClasses #-} 4 | {-# LANGUAGE TemplateHaskell #-} 5 | module Bioshake.Hisat2 where 6 | 7 | import Bioshake 8 | import Bioshake.Internal.Hisat2 9 | import Bioshake.TH 10 | import Data.List 11 | import Development.Shake 12 | import Development.Shake.FilePath 13 | 14 | $(makeThreaded ''Align [''Referenced, ''IsFastQ] 'buildHisat2) 15 | -------------------------------------------------------------------------------- /Bioshake/Cluster/Hisat2.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleContexts #-} 2 | {-# LANGUAGE FlexibleInstances #-} 3 | {-# LANGUAGE MultiParamTypeClasses #-} 4 | {-# LANGUAGE TemplateHaskell #-} 5 | module Bioshake.Cluster.Hisat2 where 6 | 7 | import Bioshake 8 | import Bioshake.Internal.Hisat2 9 | import Bioshake.TH 10 | import Data.List 11 | import Development.Shake 12 | import Development.Shake.FilePath 13 | 14 | $(makeCluster ''Align [''Referenced, ''IsFastQ] 'buildHisat2) 15 | -------------------------------------------------------------------------------- /Bioshake/Cluster/Cutadapt.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleContexts #-} 2 | {-# LANGUAGE FlexibleInstances #-} 3 | {-# LANGUAGE MultiParamTypeClasses #-} 4 | {-# LANGUAGE TemplateHaskell #-} 5 | {-# LANGUAGE TypeOperators #-} 6 | module Bioshake.Cluster.Cutadapt where 7 | 8 | import Bioshake 9 | import Bioshake.Cluster.Torque 10 | import Bioshake.Internal.Cutadapt 11 | import Bioshake.TH 12 | import Development.Shake 13 | 14 | $(makeSingleCluster ''Trim [''IsFastQ] 'buildTrim) 15 | -------------------------------------------------------------------------------- /Bioshake/ContextMap.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleContexts #-} 2 | {-# LANGUAGE FlexibleInstances #-} 3 | {-# LANGUAGE MultiParamTypeClasses #-} 4 | {-# LANGUAGE TemplateHaskell #-} 5 | {-# LANGUAGE TypeOperators #-} 6 | module Bioshake.ContextMap where 7 | 8 | import Bioshake 9 | import Bioshake.Implicit 10 | import Bioshake.Internal.ContextMap 11 | import Bioshake.TH 12 | import Development.Shake 13 | 14 | $(makeThreaded ''Align [''Referenced, ''IsFastQ] 'buildContextMap) 15 | -------------------------------------------------------------------------------- /Bioshake/Cluster/Platypus.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleContexts #-} 2 | {-# LANGUAGE FlexibleInstances #-} 3 | {-# LANGUAGE MultiParamTypeClasses #-} 4 | {-# LANGUAGE TemplateHaskell #-} 5 | module Bioshake.Cluster.Platypus where 6 | 7 | import Bioshake 8 | import Bioshake.Internal.Platypus 9 | import Bioshake.TH 10 | import Data.List 11 | import Development.Shake 12 | import Development.Shake.FilePath 13 | 14 | $(makeCluster ''Call [''Referenced, ''IsBam, ''Sorted] 'buildPlatypus) 15 | -------------------------------------------------------------------------------- /Bioshake/SomaticSniper.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleInstances #-} 2 | {-# LANGUAGE MultiParamTypeClasses #-} 3 | {-# LANGUAGE TemplateHaskell #-} 4 | {-# LANGUAGE TypeOperators #-} 5 | module Bioshake.SomaticSniper where 6 | 7 | import Bioshake 8 | import Bioshake.Internal.SomaticSniper 9 | import Bioshake.TH 10 | import Data.List 11 | import Development.Shake 12 | import Development.Shake.FilePath 13 | 14 | $(makeSingleThread ''CallSomatic [''IsBam, ''Referenced] 'buildSomaticSniper) 15 | -------------------------------------------------------------------------------- /Bioshake/Cluster/Strelka.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleContexts #-} 2 | {-# LANGUAGE FlexibleInstances #-} 3 | {-# LANGUAGE MultiParamTypeClasses #-} 4 | {-# LANGUAGE TemplateHaskell #-} 5 | module Bioshake.Cluster.Strelka where 6 | 7 | import Bioshake 8 | import Bioshake.Internal.Strelka 9 | import Bioshake.TH 10 | import Data.List 11 | import Development.Shake 12 | import Development.Shake.FilePath 13 | 14 | $(makeCluster ''CallSomatic [''Referenced, ''IsBam, ''Sorted] 'buildStrelkaSomatic) 15 | -------------------------------------------------------------------------------- /Bioshake/Sequenza.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleInstances #-} 2 | {-# LANGUAGE MultiParamTypeClasses #-} 3 | {-# LANGUAGE TemplateHaskell #-} 4 | module Bioshake.Sequenza (pileup2Seqz, bin, GC(..)) where 5 | 6 | import Bioshake 7 | import Bioshake.Internal.Sequenza 8 | import Bioshake.TH 9 | import Data.List 10 | import Development.Shake 11 | import Development.Shake.FilePath 12 | 13 | $(makeSingleThread ''Pileup2Seqz [''IsMPileup, ''GC] 'buildPileup2Seqz) 14 | $(makeSingleThread ''Bin [''IsSeqzGZ] 'buildBin) 15 | -------------------------------------------------------------------------------- /default.nix: -------------------------------------------------------------------------------- 1 | { mkDerivation, base, binary, bytestring, containers, cryptonite 2 | , directory, free, mtl, shake, split, stdenv, template-haskell 3 | , temporary, transformers, unix, reflection 4 | }: 5 | mkDerivation { 6 | pname = "bioshake"; 7 | version = "0.1.0.0"; 8 | src = ./.; 9 | libraryHaskellDepends = [ 10 | base binary bytestring containers cryptonite directory free mtl 11 | shake split template-haskell temporary transformers unix reflection 12 | ]; 13 | description = "Bioinformatics pipelines with shake"; 14 | license = stdenv.lib.licenses.isc; 15 | } 16 | -------------------------------------------------------------------------------- /Bioshake/Cluster/ADTEx.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleContexts #-} 2 | {-# LANGUAGE FlexibleInstances #-} 3 | {-# LANGUAGE MultiParamTypeClasses #-} 4 | {-# LANGUAGE TemplateHaskell #-} 5 | module Bioshake.Cluster.ADTEx where 6 | 7 | import Bioshake 8 | import Bioshake.Cluster.Torque 9 | import Bioshake.Internal.ADTEx 10 | import Bioshake.TH 11 | import Data.List 12 | import Development.Shake 13 | import Development.Shake.FilePath 14 | 15 | $(makeSingleCluster ''Call [''Capture, ''IsBam, ''DeDuped] 'buildADTEx) 16 | -------------------------------------------------------------------------------- /Bioshake/FREEC.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleContexts #-} 2 | {-# LANGUAGE FlexibleInstances #-} 3 | {-# LANGUAGE MultiParamTypeClasses #-} 4 | {-# LANGUAGE TemplateHaskell #-} 5 | module Bioshake.FREEC where 6 | 7 | import Bioshake 8 | import Bioshake.Internal.FREEC 9 | import Bioshake.TH 10 | import Data.List 11 | import Development.Shake 12 | import Development.Shake.FilePath 13 | 14 | $(makeThreaded ''CNVExome [''Referenced, ''Capture, ''IsMPileup] 'buildFREECExome) 15 | {- $CNVExome CNV calling on exomes using FREEC -} 16 | -------------------------------------------------------------------------------- /Bioshake/ADTEx.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleInstances #-} 2 | {-# LANGUAGE MultiParamTypeClasses #-} 3 | {-# LANGUAGE TemplateHaskell #-} 4 | module Bioshake.ADTEx where 5 | 6 | import Bioshake 7 | import Bioshake.Internal.ADTEx 8 | import Bioshake.TH 9 | import Data.List 10 | import Development.Shake 11 | import Development.Shake.FilePath 12 | 13 | $(makeSingleThread ''Call [''Capture, ''IsBam, ''DeDuped] 'buildADTEx) 14 | {- $call Call CNVs for whole exomes using ADTEx. Expects deduplicated BAM files as input, and a capture region. -} 15 | -------------------------------------------------------------------------------- /Bioshake/Cluster/FREEC.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleContexts #-} 2 | {-# LANGUAGE FlexibleInstances #-} 3 | {-# LANGUAGE MultiParamTypeClasses #-} 4 | {-# LANGUAGE TemplateHaskell #-} 5 | module Bioshake.Cluster.FREEC where 6 | 7 | import Bioshake 8 | import Bioshake.Cluster.Torque 9 | import Bioshake.Internal.FREEC 10 | import Bioshake.TH 11 | import Data.List 12 | import Development.Shake 13 | import Development.Shake.FilePath 14 | 15 | $(makeCluster ''CNVExome [''Referenced, ''Capture, ''IsMPileup] 'buildFREECExome) 16 | -------------------------------------------------------------------------------- /Bioshake/Platypus.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleContexts #-} 2 | {-# LANGUAGE FlexibleInstances #-} 3 | {-# LANGUAGE MultiParamTypeClasses #-} 4 | {-# LANGUAGE TemplateHaskell #-} 5 | module Bioshake.Platypus where 6 | 7 | import Bioshake 8 | import Bioshake.Internal.Platypus 9 | import Bioshake.TH 10 | import Data.List 11 | import Development.Shake 12 | import Development.Shake.FilePath 13 | 14 | $(makeThreaded ''Call [''Referenced, ''IsBam, ''Sorted] 'buildPlatypus) 15 | {- $call Call variants using Platypus. Can call multiple samples. -} 16 | -------------------------------------------------------------------------------- /Bioshake/Strelka.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleContexts #-} 2 | {-# LANGUAGE FlexibleInstances #-} 3 | {-# LANGUAGE MultiParamTypeClasses #-} 4 | {-# LANGUAGE TemplateHaskell #-} 5 | module Bioshake.Strelka where 6 | 7 | import Bioshake 8 | import Bioshake.Internal.Strelka 9 | import Bioshake.TH 10 | import Data.List 11 | import Development.Shake 12 | import Development.Shake.FilePath 13 | 14 | $(makeThreaded ''CallSomatic [''Referenced, ''IsBam, ''Sorted] 'buildStrelkaSomatic) 15 | {- $call Call variants using Strelka. Can call multiple samples. -} 16 | -------------------------------------------------------------------------------- /Bioshake/Cluster/Gridss.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleContexts #-} 2 | {-# LANGUAGE FlexibleInstances #-} 3 | {-# LANGUAGE MultiParamTypeClasses #-} 4 | {-# LANGUAGE TemplateHaskell #-} 5 | {-# LANGUAGE TypeOperators #-} 6 | module Bioshake.Cluster.Gridss where 7 | 8 | import Bioshake 9 | import Bioshake.Internal.Gridss 10 | import Bioshake.TH 11 | import Development.Shake 12 | import System.Directory 13 | import System.IO.Temp 14 | 15 | $(makeCluster ''Call [''IsBam, ''Sorted, ''Referenced] 'buildCall) 16 | 17 | variants = Variants 18 | assemblies = Assemblies 19 | -------------------------------------------------------------------------------- /Bioshake/Cluster/Bedtools.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleContexts #-} 2 | {-# LANGUAGE FlexibleInstances #-} 3 | {-# LANGUAGE MultiParamTypeClasses #-} 4 | {-# LANGUAGE TemplateHaskell #-} 5 | module Bioshake.Cluster.Bedtools where 6 | 7 | import Bioshake 8 | import Bioshake.Cluster.Torque 9 | import Bioshake.Internal.Bedtools 10 | import Bioshake.TH 11 | import Development.Shake 12 | import Development.Shake.FilePath 13 | 14 | $(makeSingleCluster ''FilterCaptureBam [''Capture, ''IsVCF] 'buildBedtoolsCaptureBam) 15 | $(makeSingleCluster ''FilterCapture [''Capture, ''IsBam] 'buildBedtoolsCapture) 16 | -------------------------------------------------------------------------------- /Bioshake/Cluster/SomaticSniper.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleContexts #-} 2 | {-# LANGUAGE FlexibleInstances #-} 3 | {-# LANGUAGE MultiParamTypeClasses #-} 4 | {-# LANGUAGE TemplateHaskell #-} 5 | {-# LANGUAGE TypeOperators #-} 6 | module Bioshake.Cluster.SomaticSniper where 7 | 8 | import Bioshake 9 | import Bioshake.Cluster.Torque 10 | import Bioshake.Internal.SomaticSniper 11 | import Bioshake.TH 12 | import Data.List 13 | import Development.Shake 14 | import Development.Shake.FilePath 15 | 16 | $(makeSingleCluster ''CallSomatic [''IsBam,''Referenced] 'buildSomaticSniper) 17 | -------------------------------------------------------------------------------- /Bioshake/Facets.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleContexts #-} 2 | {-# LANGUAGE FlexibleInstances #-} 3 | {-# LANGUAGE MultiParamTypeClasses #-} 4 | {-# LANGUAGE TemplateHaskell #-} 5 | {-# LANGUAGE TypeOperators #-} 6 | module Bioshake.Facets where 7 | 8 | import Bioshake 9 | import Bioshake.Internal.Facets 10 | import Bioshake.TH 11 | import Development.Shake 12 | import Development.Shake.FilePath 13 | 14 | $(makeSingleThread ''Pileup [''IsVCF, ''Sorted, ''NoContigs, ''HasBams] 'buildFacets) 15 | $(makeSingleThread ''Sort [''IsVCF] 'buildSort) 16 | $(makeSingleThread ''FilterContigs [''IsVCF] 'buildNoContigs) 17 | -------------------------------------------------------------------------------- /Bioshake/Cluster/Sequenza.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleContexts #-} 2 | {-# LANGUAGE FlexibleInstances #-} 3 | {-# LANGUAGE MultiParamTypeClasses #-} 4 | {-# LANGUAGE TemplateHaskell #-} 5 | module Bioshake.Cluster.Sequenza (pileup2Seqz, bin, GC(..)) where 6 | 7 | import Bioshake 8 | import Bioshake.Cluster.Torque 9 | import Bioshake.Internal.Sequenza 10 | import Bioshake.TH 11 | import Data.List 12 | import Development.Shake 13 | import Development.Shake.FilePath 14 | 15 | $(makeSingleCluster ''Pileup2Seqz [''IsMPileup, ''GC] 'buildPileup2Seqz) 16 | $(makeSingleCluster ''Bin [''IsSeqzGZ] 'buildBin) 17 | -------------------------------------------------------------------------------- /Bioshake/Cluster/SnpEff.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleContexts #-} 2 | {-# LANGUAGE FlexibleInstances #-} 3 | {-# LANGUAGE MultiParamTypeClasses #-} 4 | {-# LANGUAGE TemplateHaskell #-} 5 | module Bioshake.Cluster.SnpEff where 6 | 7 | import Bioshake 8 | import Bioshake.Cluster.Torque 9 | import Bioshake.Internal.SnpEff 10 | import Bioshake.TH 11 | import Data.List 12 | import Development.Shake 13 | import Development.Shake.FilePath 14 | 15 | $(makeSingleCluster ''Annotate [''Referenced, ''IsVCF] 'buildAnnot) 16 | $(makeSingleCluster ''DBNSFP [''Referenced, ''IsVCF, ''SnpEffAnnotated] 'buildDBNSFP) 17 | -------------------------------------------------------------------------------- /Bioshake/Bedtools.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleContexts #-} 2 | {-# LANGUAGE FlexibleInstances #-} 3 | {-# LANGUAGE MultiParamTypeClasses #-} 4 | {-# LANGUAGE TemplateHaskell #-} 5 | module Bioshake.Bedtools where 6 | 7 | import Bioshake 8 | import Bioshake.Internal.Bedtools 9 | import Bioshake.TH 10 | import Development.Shake 11 | import Development.Shake.FilePath 12 | 13 | $(makeSingleThread ''FilterCaptureBam [''Capture, ''IsBam] 'buildBedtoolsCaptureBam) 14 | $(makeSingleThread ''FilterCapture [''Capture, ''IsVCF] 'buildBedtoolsCapture) 15 | {- $captureOnly Reduces VCF files to the capture region only using bedtools. -} 16 | 17 | -------------------------------------------------------------------------------- /Bioshake/Cluster/Varscan.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleContexts #-} 2 | {-# LANGUAGE FlexibleInstances #-} 3 | {-# LANGUAGE MultiParamTypeClasses #-} 4 | {-# LANGUAGE TemplateHaskell #-} 5 | {-# LANGUAGE TypeOperators #-} 6 | module Bioshake.Cluster.Varscan where 7 | 8 | import Bioshake 9 | import Bioshake.Cluster.Torque 10 | import Bioshake.Internal.Varscan 11 | import Bioshake.TH 12 | import Data.List 13 | import Development.Shake 14 | import Development.Shake.FilePath 15 | 16 | $(makeSingleCluster ''CallSomatic [''IsMPileup] 'buildVarscan) 17 | $(makeSingleCluster ''CopyNumber [''IsMPileup] 'buildCopyNumber) 18 | -------------------------------------------------------------------------------- /Bioshake/SnpEff.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleContexts #-} 2 | {-# LANGUAGE FlexibleInstances #-} 3 | {-# LANGUAGE MultiParamTypeClasses #-} 4 | {-# LANGUAGE TemplateHaskell #-} 5 | module Bioshake.SnpEff where 6 | 7 | import Bioshake 8 | import Bioshake.Internal.SnpEff 9 | import Bioshake.TH 10 | import Data.List 11 | import Development.Shake 12 | import Development.Shake.FilePath 13 | 14 | $(makeSingleThread ''Annotate [''Referenced, ''IsVCF] 'buildAnnot) 15 | {- $Annotate Annotate using snpEFF -} 16 | $(makeSingleThread ''DBNSFP [''Referenced, ''IsVCF, ''SnpEffAnnotated] 'buildDBNSFP) 17 | {- $Annotate Annotate with DBNSFP using snpEFF. -} 18 | -------------------------------------------------------------------------------- /Bioshake/Octopus.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleContexts #-} 2 | {-# LANGUAGE FlexibleInstances #-} 3 | {-# LANGUAGE MultiParamTypeClasses #-} 4 | {-# LANGUAGE TemplateHaskell #-} 5 | module Bioshake.Octopus(call, callWith, normalSample, fast, veryFast, debug, noFilter) where 6 | 7 | import Bioshake 8 | import Bioshake.Internal.Octopus 9 | import Bioshake.TH 10 | import Data.List 11 | import Development.Shake 12 | import Development.Shake.FilePath 13 | 14 | callWith :: Given Threads => [OctopusOpts] -> Call Threads 15 | callWith = Call given 16 | 17 | call :: Given Threads => Call Threads 18 | call = callWith [] 19 | 20 | $(makeThreaded' ''Call [''Referenced, ''IsBam, ''Sorted] 'buildOctopus) 21 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017 Justin Bedo 2 | 3 | Permission to use, copy, modify, and/or distribute this software for any purpose 4 | with or without fee is hereby granted, provided that the above copyright notice 5 | and this permission notice appear in all copies. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 8 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 9 | FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 10 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 11 | OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 12 | TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF 13 | THIS SOFTWARE. 14 | -------------------------------------------------------------------------------- /Bioshake/Cluster/Picard.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleContexts #-} 2 | {-# LANGUAGE FlexibleInstances #-} 3 | {-# LANGUAGE GADTs #-} 4 | {-# LANGUAGE MultiParamTypeClasses #-} 5 | {-# LANGUAGE TemplateHaskell #-} 6 | {-# LANGUAGE TypeOperators #-} 7 | module Bioshake.Cluster.Picard where 8 | 9 | import Bioshake 10 | import Bioshake.Cluster.Torque 11 | import Bioshake.Internal.Picard 12 | import Bioshake.TH 13 | import Development.Shake 14 | import Development.Shake.FilePath 15 | 16 | $(makeSingleCluster ''MarkDups [''Sorted, ''PairedEnd, ''IsBam] 'buildMarkDups) 17 | $(makeSingleCluster ''DeDup [''Sorted, ''PairedEnd, ''IsBam] 'buildDeDup) 18 | $(makeSingleCluster ''FixMates [''Sorted, ''PairedEnd, ''IsBam] 'buildFixMates) 19 | -------------------------------------------------------------------------------- /Bioshake/Picard.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleInstances #-} 2 | {-# LANGUAGE GADTs #-} 3 | {-# LANGUAGE MultiParamTypeClasses #-} 4 | {-# LANGUAGE TemplateHaskell #-} 5 | {-# LANGUAGE TypeOperators #-} 6 | module Bioshake.Picard where 7 | 8 | import Bioshake 9 | import Bioshake.Internal.Picard 10 | import Bioshake.TH 11 | import Development.Shake 12 | import Development.Shake.FilePath 13 | 14 | $(makeSingleThread ''MarkDups [''Sorted, ''PairedEnd, ''IsBam] 'buildMarkDups) 15 | {- $markDups Mark duplicates using picard tools -} 16 | $(makeSingleThread ''DeDup [''Sorted, ''PairedEnd, ''IsBam] 'buildDeDup) 17 | {- $markDups De-duplicate using picard tools -} 18 | $(makeSingleThread ''FixMates [''Sorted, ''PairedEnd, ''IsBam] 'buildFixMates) 19 | -------------------------------------------------------------------------------- /Bioshake/Cluster/Octopus.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleContexts #-} 2 | {-# LANGUAGE FlexibleInstances #-} 3 | {-# LANGUAGE MultiParamTypeClasses #-} 4 | {-# LANGUAGE TemplateHaskell #-} 5 | module Bioshake.Cluster.Octopus(call, callWith, normalSample, fast, veryFast, debug, noFilter) where 6 | 7 | import Bioshake 8 | import Bioshake.Cluster.Torque 9 | import Bioshake.Internal.Octopus 10 | import Bioshake.TH 11 | import Data.List 12 | import Development.Shake 13 | import Development.Shake.FilePath 14 | 15 | callWith :: Given Config => [OctopusOpts] -> Call Config 16 | callWith = Call given 17 | 18 | call :: Given Config => Call Config 19 | call = callWith [] 20 | 21 | $(makeCluster' ''Call [''Referenced, ''IsBam, ''Sorted] 'buildOctopus) 22 | -------------------------------------------------------------------------------- /Bioshake/Varscan.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleInstances #-} 2 | {-# LANGUAGE MultiParamTypeClasses #-} 3 | {-# LANGUAGE TemplateHaskell #-} 4 | {-# LANGUAGE TypeOperators #-} 5 | module Bioshake.Varscan where 6 | 7 | import Bioshake 8 | import Bioshake.Internal.Varscan 9 | import Bioshake.TH 10 | import Data.List 11 | import Development.Shake 12 | import Development.Shake.FilePath 13 | 14 | $(makeSingleThread ''CallSomatic [''IsMPileup] 'buildVarscan) 15 | $(makeSingleThread ''CopyNumber [''IsMPileup] 'buildCopyNumber) 16 | 17 | --callSomatic :: CallSomatic () 18 | --callSomatic = CallSomatic () 19 | -- 20 | --instance IsMPileup a => Buildable (a :-> CallSomatic ()) where 21 | -- build pipe@(a :-> b) = 22 | -- let outs = paths pipe in 23 | -- withCmd 1 $ buildVarscan b a outs 24 | -------------------------------------------------------------------------------- /docs/mini_Bioshake-BWA.html: -------------------------------------------------------------------------------- 1 | Bioshake.BWA

Bioshake.BWA

align

-------------------------------------------------------------------------------- /docs/mini_Bioshake-ADTEx.html: -------------------------------------------------------------------------------- 1 | Bioshake.ADTEx

Bioshake.ADTEx

call

-------------------------------------------------------------------------------- /docs/mini_Bioshake-FREEC.html: -------------------------------------------------------------------------------- 1 | Bioshake.FREEC

Bioshake.FREEC

cNVExome

-------------------------------------------------------------------------------- /docs/mini_Bioshake-Cutadapt.html: -------------------------------------------------------------------------------- 1 | Bioshake.Cutadapt

Bioshake.Cutadapt

trim

-------------------------------------------------------------------------------- /docs/mini_Bioshake-Platypus.html: -------------------------------------------------------------------------------- 1 | Bioshake.Platypus

Bioshake.Platypus

call

-------------------------------------------------------------------------------- /docs/mini_Bioshake-Bedtools.html: -------------------------------------------------------------------------------- 1 | Bioshake.Bedtools

Bioshake.Bedtools

captureOnly

-------------------------------------------------------------------------------- /docs/mini_Bioshake-Cluster-BWA.html: -------------------------------------------------------------------------------- 1 | Bioshake.Cluster.BWA

Bioshake.Cluster.BWA

align

-------------------------------------------------------------------------------- /docs/mini_Bioshake-Cluster-ADTEx.html: -------------------------------------------------------------------------------- 1 | Bioshake.Cluster.ADTEx

Bioshake.Cluster.ADTEx

call

-------------------------------------------------------------------------------- /docs/mini_Bioshake-Cluster-FREEC.html: -------------------------------------------------------------------------------- 1 | Bioshake.Cluster.FREEC

Bioshake.Cluster.FREEC

cNVExome

-------------------------------------------------------------------------------- /Bioshake/Internal/ADTEx.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleInstances #-} 2 | {-# LANGUAGE TemplateHaskell #-} 3 | {-# LANGUAGE ViewPatterns #-} 4 | module Bioshake.Internal.ADTEx where 5 | 6 | import Bioshake 7 | import Bioshake.TH 8 | import Control.Monad 9 | import Control.Monad.Trans (lift) 10 | import Data.List 11 | import Development.Shake 12 | import Development.Shake.FilePath 13 | 14 | data Call c = Call c deriving Show 15 | 16 | buildADTEx _ a@(paths -> [normal, tumour]) [out] = 17 | let bed = getBED a 18 | in withTempDirectory' "tmp" "adtex" $ \tmpDir -> do 19 | let tmpDir' = tmpDir "out" 20 | () <- run "ADTEx.py" 21 | ["-n", normal] 22 | ["-t", tumour] 23 | ["-b", bed] 24 | ["-o", tmpDir'] 25 | lift $ copyFile' (tmpDir' "cnv.result") out 26 | 27 | $(makeSingleTypes ''Call [''IsTSV] []) 28 | -------------------------------------------------------------------------------- /docs/mini_Bioshake-Cluster-Cutadapt.html: -------------------------------------------------------------------------------- 1 | Bioshake.Cluster.Cutadapt

Bioshake.Cluster.Cutadapt

trim

-------------------------------------------------------------------------------- /docs/mini_Bioshake-Cluster-Platypus.html: -------------------------------------------------------------------------------- 1 | Bioshake.Cluster.Platypus

Bioshake.Cluster.Platypus

call

-------------------------------------------------------------------------------- /docs/mini_Bioshake-Cluster-Bedtools.html: -------------------------------------------------------------------------------- 1 | Bioshake.Cluster.Bedtools

Bioshake.Cluster.Bedtools

captureOnly

-------------------------------------------------------------------------------- /Bioshake/Internal/SomaticSniper.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleContexts #-} 2 | {-# LANGUAGE FlexibleInstances #-} 3 | {-# LANGUAGE TemplateHaskell #-} 4 | {-# LANGUAGE ViewPatterns #-} 5 | module Bioshake.Internal.SomaticSniper where 6 | 7 | import Bioshake 8 | import Bioshake.TH 9 | import Control.Monad 10 | import Control.Monad.Trans (lift) 11 | import Data.List 12 | import Development.Shake 13 | import Development.Shake.FilePath 14 | import System.Directory (copyFile) 15 | import System.Posix.Files (createLink, rename) 16 | 17 | data CallSomatic c = CallSomatic c deriving Show 18 | 19 | buildSomaticSniper _ a@(paths -> [normal, tumour]) [out] = do 20 | run "bam-somaticsniper -Q 40 -G -L -F vcf" 21 | ["-f", getRef a] 22 | [tumour] 23 | [normal] 24 | [out] 25 | 26 | $(makeSingleTypes ''CallSomatic [''IsVCF] [''Sorted]) 27 | 28 | -------------------------------------------------------------------------------- /Bioshake/Internal/Hisat2.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleContexts #-} 2 | {-# LANGUAGE FlexibleInstances #-} 3 | {-# LANGUAGE TemplateHaskell #-} 4 | {-# LANGUAGE ViewPatterns #-} 5 | module Bioshake.Internal.Hisat2 where 6 | 7 | import Bioshake 8 | import Bioshake.TH 9 | import Control.Monad 10 | import Control.Monad.Trans (lift) 11 | import Data.List 12 | import Development.Shake 13 | import Development.Shake.FilePath 14 | import System.Posix.Files (createLink, rename) 15 | 16 | data Align c = Align c deriving Show 17 | 18 | buildHisat2 t _ a [out] = 19 | run "hisat2" 20 | ["-x", getRef a] 21 | (case paths a of 22 | [input] -> ["-U", input] 23 | [i1, i2] -> ["-1", i1, "-2", i2] 24 | _ -> error "hisat2: need 1 single-end read set or 2 paired-end read sets") 25 | ["-S", out] 26 | ["-p", show t] 27 | 28 | $(makeSingleTypes ''Align [''IsSam] []) 29 | -------------------------------------------------------------------------------- /docs/mini_Bioshake-SnpEff.html: -------------------------------------------------------------------------------- 1 | Bioshake.SnpEff

Bioshake.SnpEff

annotate

dBNSFP

-------------------------------------------------------------------------------- /Bioshake/Internal/Platypus.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleContexts #-} 2 | {-# LANGUAGE FlexibleInstances #-} 3 | {-# LANGUAGE TemplateHaskell #-} 4 | {-# LANGUAGE ViewPatterns #-} 5 | module Bioshake.Internal.Platypus where 6 | 7 | import Bioshake 8 | import Bioshake.TH 9 | import Control.Monad 10 | import Control.Monad.Trans (lift) 11 | import Data.List 12 | import Development.Shake 13 | import Development.Shake.FilePath 14 | import System.Posix.Files (createLink, rename) 15 | 16 | data Call c = Call c deriving Show 17 | 18 | buildPlatypus t _ a@(paths -> inputs) [out] = do 19 | let bais = map ( <.> "bai" ) inputs 20 | fai = getRef a <.> "fai" 21 | lift . need $ fai:bais 22 | run "platypus callVariants" 23 | ["--bamFiles=" ++ intercalate "," inputs] 24 | ["--refFile=" ++ getRef a] 25 | ["--output=" ++ out] 26 | ["--nCPU=" ++ show t] 27 | 28 | $(makeSingleTypes ''Call [''IsVCF] []) 29 | -------------------------------------------------------------------------------- /docs/mini_Bioshake-Varscan.html: -------------------------------------------------------------------------------- 1 | Bioshake.Varscan

Bioshake.Varscan

callSomatic

copyNumber

-------------------------------------------------------------------------------- /Bioshake/BWA.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleContexts #-} 2 | {-# LANGUAGE FlexibleInstances #-} 3 | {-# LANGUAGE MultiParamTypeClasses #-} 4 | {-# LANGUAGE TemplateHaskell #-} 5 | {-# LANGUAGE TypeOperators #-} 6 | module Bioshake.BWA(indexRules, align, alignWith, k, bw, d, r, y, c, dc, w, m, rg, softClip) where 7 | 8 | import Bioshake 9 | import Bioshake.Internal.BWA 10 | import Bioshake.TH 11 | import Development.Shake 12 | import Development.Shake.FilePath 13 | 14 | indexRules = 15 | ["//*" <.> ext | ext <- ["amb", "ann", "bwt", "pac", "sa"]] &%> \(o:_) -> do 16 | let i = dropExtension o 17 | need [i] 18 | cmd "bwa index" [i] 19 | 20 | alignWith :: Given Threads => [BWAOpts] -> Align Threads 21 | alignWith = Align given 22 | 23 | align :: Given Threads => Align Threads 24 | align = alignWith [] 25 | 26 | $(makeThreaded' ''Align [''Referenced, ''IsFastQ] 'buildBWA) 27 | {- $align Aligns fastq files against the reference using BWA-mem. -} 28 | -------------------------------------------------------------------------------- /Bioshake/Internal/Cutadapt.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleInstances #-} 2 | {-# LANGUAGE MultiParamTypeClasses #-} 3 | {-# LANGUAGE TemplateHaskell #-} 4 | {-# LANGUAGE TypeOperators #-} 5 | {-# LANGUAGE ViewPatterns #-} 6 | module Bioshake.Internal.Cutadapt where 7 | 8 | import Bioshake 9 | import Bioshake.TH 10 | import Development.Shake 11 | import Development.Shake.FilePath 12 | 13 | data Trim c = Trim c Seq deriving Show 14 | 15 | buildTrim (Trim _ three') (paths -> inputs) outs = 16 | case inputs of 17 | [input] -> 18 | let [out] = outs in 19 | run "cutadapt" 20 | ["-a", show three'] 21 | ["-o", out] 22 | [input] 23 | [_, _] -> 24 | let [o1, o2] = outs in 25 | run "cutadapt" 26 | ["-a", show three'] 27 | ["-o", o1] 28 | ["-p", o2] 29 | inputs 30 | _ -> error "cutadapt: expecting either single or paired read sets" 31 | 32 | $(makeMultiTypes ''Trim [''IsFastQ] []) 33 | -------------------------------------------------------------------------------- /docs/mini_Bioshake-Cluster-SnpEff.html: -------------------------------------------------------------------------------- 1 | Bioshake.Cluster.SnpEff

Bioshake.Cluster.SnpEff

annotate

dBNSFP

-------------------------------------------------------------------------------- /docs/mini_Bioshake-Cluster-Varscan.html: -------------------------------------------------------------------------------- 1 | Bioshake.Cluster.Varscan

Bioshake.Cluster.Varscan

callSomatic

copyNumber

-------------------------------------------------------------------------------- /Bioshake/Cluster/BWA.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleContexts #-} 2 | {-# LANGUAGE FlexibleInstances #-} 3 | {-# LANGUAGE MultiParamTypeClasses #-} 4 | {-# LANGUAGE TemplateHaskell #-} 5 | {-# LANGUAGE TypeOperators #-} 6 | module Bioshake.Cluster.BWA(indexRules, align, alignWith, k, bw, d, r, y, c, dc, w, m, rg, softClip) where 7 | 8 | import Bioshake 9 | import Bioshake.Cluster.Torque 10 | import Bioshake.Internal.BWA 11 | import Bioshake.TH 12 | import Development.Shake 13 | import Development.Shake.FilePath 14 | 15 | indexRules :: Given Config => Rules () 16 | indexRules = 17 | ["//*" <.> ext | ext <- ["amb", "ann", "bwt", "pac", "sa"]] &%> \(o:_) -> do 18 | let i = dropExtension o 19 | need [i] 20 | withSubmit (run "bwa index" [i]) [Left given] 21 | 22 | alignWith :: Given Config => [BWAOpts] -> Align Config 23 | alignWith = Align given 24 | 25 | align :: Given Config => Align Config 26 | align = alignWith [] 27 | 28 | $(makeCluster' ''Align [''Referenced, ''IsFastQ] 'buildBWA) 29 | -------------------------------------------------------------------------------- /shell.nix: -------------------------------------------------------------------------------- 1 | { nixpkgs ? import {}, compiler ? "default" }: 2 | 3 | let 4 | 5 | inherit (nixpkgs) pkgs; 6 | 7 | f = { mkDerivation, base, binary, bytestring, containers 8 | , cryptonite, directory, free, mtl, shake, split, stdenv 9 | , template-haskell, temporary, transformers, unix, reflection 10 | }: 11 | mkDerivation { 12 | pname = "bioshake"; 13 | version = "0.1.0.0"; 14 | src = ./.; 15 | libraryHaskellDepends = [ 16 | base binary bytestring containers cryptonite directory free mtl 17 | shake split template-haskell temporary transformers unix reflection 18 | ]; 19 | description = "Bioinformatics pipelines with shake"; 20 | license = stdenv.lib.licenses.isc; 21 | }; 22 | 23 | haskellPackages = if compiler == "default" 24 | then pkgs.haskellPackages 25 | else pkgs.haskell.packages.${compiler}; 26 | 27 | drv = haskellPackages.callPackage f {}; 28 | 29 | in 30 | 31 | if pkgs.lib.inNixShell then drv.env else drv 32 | -------------------------------------------------------------------------------- /docs/mini_Bioshake-Picard.html: -------------------------------------------------------------------------------- 1 | Bioshake.Picard

Bioshake.Picard

-------------------------------------------------------------------------------- /docs/mini_Bioshake-Sequenza.html: -------------------------------------------------------------------------------- 1 | Bioshake.Sequenza

Bioshake.Sequenza

class GC a

-------------------------------------------------------------------------------- /docs/mini_Bioshake-Cluster-Picard.html: -------------------------------------------------------------------------------- 1 | Bioshake.Cluster.Picard

Bioshake.Cluster.Picard

-------------------------------------------------------------------------------- /docs/mini_Bioshake-Cluster-Sequenza.html: -------------------------------------------------------------------------------- 1 | Bioshake.Cluster.Sequenza

Bioshake.Cluster.Sequenza

class GC a

-------------------------------------------------------------------------------- /Bioshake/Gridss.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleContexts #-} 2 | {-# LANGUAGE FlexibleInstances #-} 3 | {-# LANGUAGE MultiParamTypeClasses #-} 4 | {-# LANGUAGE TemplateHaskell #-} 5 | {-# LANGUAGE TypeOperators #-} 6 | module Bioshake.Gridss where 7 | 8 | import Bioshake 9 | import Bioshake.Internal.Gridss 10 | import Bioshake.TH 11 | import Development.Shake 12 | import System.Directory 13 | import System.IO.Temp 14 | 15 | $(makeSingleThread ''ComputeSamTags [''IsBam, ''Referenced, ''NameSorted] 'buildComputeSamTags) 16 | $(makeThreaded ''SoftClipsToSplitReads [''IsBam, ''Referenced] 'buildSoftClipsToSplitReads) 17 | $(makeSingleThread ''CollectMetrics [''IsBam, ''Referenced] 'buildCollectMetrics) 18 | $(makeThreaded ''AssembleBreakends [''GridssMetrics, ''Referenced, ''Sorted, ''DupsMarked] 'buildAssembleBreakends) 19 | $(makeThreaded ''IdentifyVariants [''GridssMetrics, ''Referenced, ''GridssAssembly] 'buildIdentifyVariants) 20 | $(makeThreaded ''AnnotateVariants [''IsVCF, ''Referenced, ''GridssAssembly] 'buildAnnotateVariants) 21 | $(makeThreaded ''Call [''IsBam, ''Sorted, ''Referenced] 'buildCall) 22 | 23 | variants = Variants 24 | assemblies = Assemblies 25 | -------------------------------------------------------------------------------- /Bioshake/Internal/Bedtools.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleInstances #-} 2 | {-# LANGUAGE TemplateHaskell #-} 3 | {-# LANGUAGE ViewPatterns #-} 4 | module Bioshake.Internal.Bedtools where 5 | 6 | import Bioshake 7 | import Bioshake.TH 8 | import Control.Monad 9 | import Control.Monad.Trans (lift) 10 | import Data.List 11 | import Development.Shake 12 | import Development.Shake.FilePath 13 | import System.Posix.Files (createLink, rename) 14 | 15 | data FilterCapture c = FilterCapture c deriving Show 16 | 17 | buildBedtoolsCapture _ a@(paths -> [input]) [out] = do 18 | let bed = getBED a 19 | lift $ need [bed] 20 | run "bedtools intersect" 21 | ["-a", input] 22 | ["-b", bed] 23 | "-header" 24 | [">", out] 25 | 26 | $(makeSingleTypes ''FilterCapture [''IsVCF, ''CaptureOnly] []) 27 | 28 | data FilterCaptureBam c = FilterCaptureBam c deriving Show 29 | 30 | buildBedtoolsCaptureBam _ a@(paths -> [input]) [out] = do 31 | let bed = getBED a 32 | lift $ need [bed] 33 | run "bedtools intersect" 34 | ["-a", input] 35 | ["-b", bed] 36 | [">", out] 37 | 38 | $(makeSingleTypes ''FilterCaptureBam [''IsBam, ''CaptureOnly] []) 39 | -------------------------------------------------------------------------------- /Bioshake/Internal/SnpEff.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleContexts #-} 2 | {-# LANGUAGE FlexibleInstances #-} 3 | {-# LANGUAGE TemplateHaskell #-} 4 | {-# LANGUAGE ViewPatterns #-} 5 | module Bioshake.Internal.SnpEff where 6 | 7 | import Bioshake 8 | import Bioshake.TH 9 | import Control.Monad 10 | import Control.Monad.Trans (lift) 11 | import Data.List 12 | import Development.Shake 13 | import Development.Shake.FilePath 14 | import System.Directory 15 | import System.Posix.Files (createLink, rename) 16 | 17 | data Annotate c = Annotate c deriving Show 18 | data DBNSFP c = DBNSFP c deriving Show 19 | 20 | class SnpEffAnnotated c 21 | 22 | buildAnnot _ a@(paths -> [input]) [out] = do 23 | pwd <- liftIO getCurrentDirectory 24 | run "snpeff" (name a) 25 | ["-dataDir", pwd "tmp"] 26 | input 27 | [">", out] 28 | 29 | buildDBNSFP _ a@(paths -> [input]) [out] = do 30 | let db = dbnsfp a 31 | lift $ need [db, db <.> "tbi"] 32 | pwd <- liftIO getCurrentDirectory 33 | run "snpsift dbnsfp" ["-db", db] [input] [">", out] 34 | 35 | $(makeSingleTypes ''Annotate [''IsVCF, ''SnpEffAnnotated] []) 36 | $(makeSingleTypes ''DBNSFP [''IsVCF] []) 37 | -------------------------------------------------------------------------------- /Bioshake/Cluster/GATK.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleContexts #-} 2 | {-# LANGUAGE FlexibleInstances #-} 3 | {-# LANGUAGE MultiParamTypeClasses #-} 4 | {-# LANGUAGE TypeOperators #-} 5 | {-# LANGUAGE ViewPatterns #-} 6 | module Bioshake.Cluster.GATK(reQual) where 7 | 8 | import Bioshake 9 | import Bioshake.Cluster.Torque 10 | import Bioshake.Internal.GATK 11 | import Data.Implicit 12 | import Development.Shake 13 | import Development.Shake.FilePath 14 | import System.IO.Temp 15 | 16 | instance (Implicit_ Config, Referenced a, Pathable a, IsBam a) => Buildable a ReQual where 17 | build (ReQual jar) a@(paths -> [input]) [out] = 18 | liftIO . withSystemTempDirectory "gatk" $ \tmpDir -> do 19 | let tmpFile = tmpDir "recal.grp" 20 | () <- submit "java" 21 | ["-jar", jar] 22 | ["-T", "BaseRecalibrator"] 23 | ["-R", getRef a] 24 | ["-I", input] 25 | ["-knownSites", "latest_dbsnp.vcf"] 26 | ["-o", tmpFile] 27 | (param_ :: Config) 28 | () <- submit "java" 29 | ["-jar", jar] 30 | ["-T", "PrintReads"] 31 | ["-R", getRef a] 32 | ["-I", input] 33 | ["-BQSR", tmpFile] 34 | ["-o", out] 35 | (param_ :: Config) 36 | return () 37 | -------------------------------------------------------------------------------- /Bioshake/Internal/ContextMap.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleContexts #-} 2 | {-# LANGUAGE FlexibleInstances #-} 3 | {-# LANGUAGE MultiParamTypeClasses #-} 4 | {-# LANGUAGE TemplateHaskell #-} 5 | {-# LANGUAGE TypeOperators #-} 6 | {-# LANGUAGE ViewPatterns #-} 7 | module Bioshake.Internal.ContextMap where 8 | 9 | import Bioshake 10 | import Bioshake.Implicit 11 | import Bioshake.TH 12 | import Control.Monad.Trans (lift) 13 | import Data.List 14 | import Data.Maybe 15 | import Development.Shake 16 | import Development.Shake.FilePath 17 | import System.Directory 18 | 19 | data Align c = Align c deriving Show 20 | 21 | buildContextMap t _ a@(paths -> inputs) [out] = do 22 | path <- liftIO getSearchPath 23 | bwaBin <- liftIO $ fromMaybe (error "Cannot find BWA in path") <$> findFile path "bwa" 24 | withTempDirectory' "tmp" "contextmap" $ \tmpDir -> do 25 | () <- run "contextmap" 26 | ["-t", show t] 27 | ["-genome", dropFileName $ getRef a] 28 | ["-indices", getRef a] 29 | ["-reads", intercalate "," inputs] 30 | ["-aligner_name", "bwa"] 31 | ["-aligner_bin", bwaBin] 32 | ["-o", tmpDir] 33 | lift $ copyFile' (tmpDir "mapping.sam") out 34 | 35 | $(makeSingleTypes ''Align [''IsSam] []) 36 | -------------------------------------------------------------------------------- /Bioshake/Internal/Picard.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleInstances #-} 2 | {-# LANGUAGE GADTs #-} 3 | {-# LANGUAGE MultiParamTypeClasses #-} 4 | {-# LANGUAGE ScopedTypeVariables #-} 5 | {-# LANGUAGE TemplateHaskell #-} 6 | {-# LANGUAGE TypeOperators #-} 7 | {-# LANGUAGE ViewPatterns #-} 8 | module Bioshake.Internal.Picard where 9 | 10 | import Bioshake 11 | import Bioshake.TH 12 | import Data.Maybe 13 | import Development.Shake 14 | import Development.Shake.FilePath 15 | import System.IO.Temp 16 | 17 | data MarkDups c = MarkDups c deriving Show 18 | data DeDup c = DeDup c deriving Show 19 | data FixMates c = FixMates c deriving Show 20 | 21 | buildMarkDups _ (paths -> [input]) [out] = 22 | run "picard MarkDuplicates" 23 | ["I=", input] 24 | ["O=", out] 25 | ["M=", out -<.> "txt"] 26 | 27 | buildDeDup _ (paths -> [input]) [out] = 28 | run "picard MarkDuplicates" 29 | ["I=", input] 30 | ["O=", out] 31 | ["M=", out -<.> "txt"] 32 | "REMOVE_DUPLICATES=true" 33 | 34 | buildFixMates _ (paths -> [input]) [out] = 35 | run "picard FixMateInformation" 36 | ["I=", input] 37 | ["O=", out] 38 | 39 | $(makeSingleTypes ''MarkDups [''IsBam, ''DupsMarked] [''Sorted]) 40 | $(makeSingleTypes ''DeDup [''IsBam, ''DeDuped] [''Sorted]) 41 | $(makeSingleTypes ''FixMates [''IsBam] [''Sorted]) 42 | -------------------------------------------------------------------------------- /docs/mini_Bioshake-Implicit.html: -------------------------------------------------------------------------------- 1 | Bioshake.Implicit

Bioshake.Implicit

class Default a

class Implicit a

data Param a b

-------------------------------------------------------------------------------- /docs/mini_Bioshake-Samtools.html: -------------------------------------------------------------------------------- 1 | Bioshake.Samtools

Bioshake.Samtools

-------------------------------------------------------------------------------- /Bioshake/CNVkit.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleContexts #-} 2 | {-# LANGUAGE FlexibleInstances #-} 3 | {-# LANGUAGE MultiParamTypeClasses #-} 4 | {-# LANGUAGE TemplateHaskell #-} 5 | {-# LANGUAGE TypeOperators #-} 6 | module Bioshake.CNVkit where 7 | 8 | import Bioshake 9 | import Bioshake.Internal.CNVkit 10 | import Bioshake.TH 11 | import Data.List 12 | import Development.Shake 13 | import Development.Shake.FilePath 14 | 15 | batchWGS :: (Given Threads, Show a, Pathable a) => [a] -> BatchWGS Threads 16 | batchWGS a = BatchWGS given a [] 17 | 18 | batchWGSWithOpts :: (Given Threads, Show a, Pathable a) => [a] -> [BatchOpts] -> BatchWGS Threads 19 | batchWGSWithOpts = BatchWGS given 20 | 21 | instance (Pathable a, Show a, Referenced a, IsBam a) => Buildable (a :-> BatchWGS Threads) where 22 | build p@(a :-> b@(BatchWGS (Threads t) _ _)) = 23 | let outs = paths p 24 | in withCmd t $ buildBatchWGS t b a outs 25 | 26 | batch :: (Given Threads, Show a, Pathable a) => [a] -> Batch Threads 27 | batch a = Batch given a [] 28 | 29 | batchWithOpts :: (Given Threads, Show a, Pathable a) => [a] -> [BatchOpts] -> Batch Threads 30 | batchWithOpts = Batch given 31 | 32 | instance (Pathable a, Show a, Referenced a, IsBam a, Capture a) => Buildable (a :-> Batch Threads) where 33 | build p@(a :-> b@(Batch (Threads t) _ _)) = 34 | let outs = paths p 35 | in withCmd t $ buildBatch t b a outs 36 | -------------------------------------------------------------------------------- /Bioshake/Internal/Varscan.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleInstances #-} 2 | {-# LANGUAGE TemplateHaskell #-} 3 | {-# LANGUAGE ViewPatterns #-} 4 | module Bioshake.Internal.Varscan where 5 | 6 | import Bioshake 7 | import Bioshake.TH 8 | import Control.Monad 9 | import Control.Monad.Trans (lift) 10 | import Data.List 11 | import Development.Shake 12 | import Development.Shake.FilePath 13 | import System.Directory (copyFile) 14 | import System.Posix.Files (createLink, rename) 15 | 16 | data CallSomatic c = CallSomatic c deriving Show 17 | data CopyNumber c = CopyNumber c deriving Show 18 | 19 | buildVarscan _ a@(paths -> [input]) [out] = do 20 | () <- run "varscan somatic" 21 | input 22 | out 23 | "--mpileup 1 --output-vcf 1" 24 | liftIO $ copyFile (out <.> "snp") out 25 | indels <- fmap (unlines . filter (\(c:_) -> c /= '#') . lines) . liftIO $ readFile (out <.> "indel") 26 | liftIO $ appendFile out indels 27 | 28 | $(makeSingleTypes ''CallSomatic [''IsVCF] [''Sorted]) 29 | 30 | buildCopyNumber _ a@(paths -> [input]) [out] = do 31 | () <- run "varscan copynumber" 32 | input 33 | out 34 | "--mpileup 1" 35 | liftIO $ copyFile (out <.> "snp") out 36 | indels <- fmap (unlines . filter (\(c:_) -> c /= '#') . lines) . liftIO $ readFile (out <.> "indel") 37 | liftIO $ appendFile out indels 38 | 39 | class IsCNV a 40 | 41 | $(makeSingleTypes ''CopyNumber [''IsCNV] [''Sorted]) 42 | -------------------------------------------------------------------------------- /Bioshake/Cluster/CNVkit.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleContexts #-} 2 | {-# LANGUAGE FlexibleInstances #-} 3 | {-# LANGUAGE MultiParamTypeClasses #-} 4 | {-# LANGUAGE TemplateHaskell #-} 5 | {-# LANGUAGE TypeOperators #-} 6 | module Bioshake.Cluster.CNVkit where 7 | 8 | import Bioshake 9 | import Bioshake.Cluster.Torque 10 | import Bioshake.Internal.CNVkit 11 | import Bioshake.TH 12 | import Data.List 13 | import Development.Shake 14 | import Development.Shake.FilePath 15 | 16 | batchWGS :: (Given Config, Show a, Pathable a) => [a] -> BatchWGS Config 17 | batchWGS a = BatchWGS given a [] 18 | 19 | batchWGSWithOpts :: (Given Config, Show a, Pathable a) => [a] -> [BatchOpts] -> BatchWGS Config 20 | batchWGSWithOpts = BatchWGS given 21 | 22 | instance (Pathable a, Show a, Referenced a, IsBam a) => Buildable (a :-> BatchWGS Config) where 23 | build p@(a :-> b@(BatchWGS c _ _)) = 24 | let outs = paths p 25 | in withSubmit (buildBatchWGS (getCPUs c) b a outs) [Left c] 26 | 27 | batch :: (Given Config, Show a, Pathable a) => [a] -> Batch Config 28 | batch a = Batch given a [] 29 | 30 | batchWithOpts :: (Given Config, Show a, Pathable a) => [a] -> [BatchOpts] -> Batch Config 31 | batchWithOpts = Batch given 32 | 33 | instance (Pathable a, Show a, Referenced a, IsBam a, Capture a) => Buildable (a :-> Batch Config) where 34 | build p@(a :-> b@(Batch c _ _)) = 35 | let outs = paths p 36 | in withSubmit (buildBatch (getCPUs c) b a outs) [Left c] 37 | -------------------------------------------------------------------------------- /Bioshake/Cluster/Samtools.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE DataKinds #-} 2 | {-# LANGUAGE FlexibleContexts #-} 3 | {-# LANGUAGE FlexibleInstances #-} 4 | {-# LANGUAGE GADTs #-} 5 | {-# LANGUAGE MultiParamTypeClasses #-} 6 | {-# LANGUAGE TemplateHaskell #-} 7 | {-# LANGUAGE TypeOperators #-} 8 | module Bioshake.Cluster.Samtools where 9 | 10 | import Bioshake 11 | import Bioshake.Cluster.Torque 12 | import Bioshake.Internal.Samtools 13 | import Bioshake.TH 14 | import Development.Shake 15 | import Development.Shake.FilePath 16 | 17 | indexRules :: Given Config => Rules () 18 | indexRules = do 19 | "//*.bai" %> \out -> do 20 | let input = dropExtension out 21 | need [input] 22 | withSubmit (run "samtools index" [input] [out]) [Left given] 23 | "//*.fai" %> \out -> do 24 | let input = dropExtension out 25 | need [input] 26 | withSubmit (run "samtools faidx" [input]) [Left given] 27 | 28 | 29 | $(makeSingleCluster ''AddRGLine [''IsBam] 'buildAddRGLine) 30 | $(makeCluster ''SortBam [''IsBam] 'buildSortBam) 31 | $(makeCluster ''NameSortBam [''IsBam] 'buildNameSortBam) 32 | $(makeCluster ''Sam2Bam [''IsSam] 'buildSam2Bam) 33 | $(makeCluster ''MappedOnly [''IsSam] 'buildMappedOnly) 34 | $(makeSingleCluster ''Pileup [''IsBam, ''Referenced, ''Sorted] 'buildPileup) 35 | $(makeSingleCluster ''FixMates [''IsBam, ''NameSorted] 'buildFixMates) 36 | $(makeSingleCluster ''MarkDups [''IsBam, ''Sorted, ''MS] 'buildMarkDups) 37 | $(makeSingleCluster ''BedCov [''IsBam, ''Capture] 'buildBedCov) 38 | -------------------------------------------------------------------------------- /docs/mini_Bioshake-Cluster-Samtools.html: -------------------------------------------------------------------------------- 1 | Bioshake.Cluster.Samtools

Bioshake.Cluster.Samtools

-------------------------------------------------------------------------------- /Bioshake/Samtools.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE DataKinds #-} 2 | {-# LANGUAGE FlexibleContexts #-} 3 | {-# LANGUAGE FlexibleInstances #-} 4 | {-# LANGUAGE GADTs #-} 5 | {-# LANGUAGE MultiParamTypeClasses #-} 6 | {-# LANGUAGE TemplateHaskell #-} 7 | {-# LANGUAGE TypeOperators #-} 8 | module Bioshake.Samtools where 9 | 10 | import Bioshake 11 | import Bioshake.Internal.Samtools 12 | import Bioshake.TH 13 | import Development.Shake 14 | import Development.Shake.FilePath 15 | 16 | -- | Provides shake rules to build indices for bam files. This is needed for some stages that deal with bam files and require an index. 17 | indexRules = do 18 | "//*.bai" %> \out -> do 19 | let input = dropExtension out 20 | need [input] 21 | cmd "samtools index" [input] [out] 22 | "//*.fai" %> \out -> do 23 | let input = dropExtension out 24 | need [input] 25 | cmd "samtools faidx" [input] 26 | 27 | $(makeSingleThread ''AddRGLine [''IsBam] 'buildAddRGLine) 28 | $(makeThreaded ''SortBam [''IsBam] 'buildSortBam) 29 | $(makeThreaded ''NameSortBam [''IsBam] 'buildNameSortBam) 30 | $(makeThreaded ''Sam2Bam [''IsSam] 'buildSam2Bam) 31 | $(makeThreaded ''MappedOnly [''IsSam] 'buildMappedOnly) 32 | $(makeSingleThread ''Pileup [''IsBam, ''Referenced, ''Sorted] 'buildPileup) 33 | $(makeSingleThread ''FixMates [''IsBam, ''NameSorted] 'buildFixMates) 34 | $(makeSingleThread ''MarkDups [''IsBam, ''Sorted, ''MS] 'buildMarkDups) 35 | $(makeSingleThread ''BedCov [''IsBam, ''Capture] 'buildBedCov) 36 | {- $bedCov Computes coverage for each capture region -} 37 | -------------------------------------------------------------------------------- /Bioshake/Internal/Strelka.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleContexts #-} 2 | {-# LANGUAGE FlexibleInstances #-} 3 | {-# LANGUAGE TypeOperators #-} 4 | {-# LANGUAGE TemplateHaskell #-} 5 | {-# LANGUAGE ViewPatterns #-} 6 | module Bioshake.Internal.Strelka where 7 | 8 | import Bioshake 9 | import Bioshake.TH 10 | import Control.Monad 11 | import Control.Monad.Trans (lift) 12 | import Data.List 13 | import Development.Shake 14 | import Development.Shake.FilePath 15 | import System.Directory (copyFile) 16 | import System.Posix.Files (createLink, rename) 17 | 18 | data CallSomatic c = CallSomatic c deriving Show 19 | 20 | buildStrelkaSomatic t _ a@(paths -> [normal, tumour]) [snvs, indels] = do 21 | withTempDirectory' "tmp" "strelka" $ \tmpDir -> do 22 | () <- run "configureStrelkaSomaticWorkflow.py" 23 | ["--normalBam", normal] 24 | ["--tumourBam", tumour] 25 | ["--ref", getRef a] 26 | ["--runDir", tmpDir "strelka"] 27 | () <- run [tmpDir "strelka" "runWorkflow.py"] 28 | "-m local" 29 | ["-j", show t] 30 | () <- run "gunzip" 31 | ["<", tmpDir "strelka/results/variants/somatic.snvs.vcf.gz"] 32 | [">", snvs] 33 | run "gunzip" 34 | ["<", tmpDir "strelka/results/variants/somatic.indels.vcf.gz"] 35 | [">", indels] 36 | 37 | instance (Show a, Show c, Pathable a) => Pathable (a :-> CallSomatic c) where 38 | paths (a :-> b) = [hashPath (paths a, show a, show b) <.> s <.> "Strelka" <.> "CallSomatic" <.> "vcf" | s <- ["snvs", "indels"]] 39 | instance IsVCF (a :-> CallSomatic c) 40 | -------------------------------------------------------------------------------- /Bioshake/Internal/Octopus.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleContexts #-} 2 | {-# LANGUAGE FlexibleInstances #-} 3 | {-# LANGUAGE GADTs #-} 4 | {-# LANGUAGE TemplateHaskell #-} 5 | {-# LANGUAGE ViewPatterns #-} 6 | module Bioshake.Internal.Octopus where 7 | 8 | import Bioshake 9 | import Bioshake.TH 10 | import Control.Monad 11 | import Control.Monad.Trans (lift) 12 | import Data.List 13 | import Development.Shake 14 | import Development.Shake.FilePath 15 | import System.Posix.Files (createLink, rename) 16 | 17 | data OctopusOpts where 18 | NormalSample :: String -> OctopusOpts 19 | Fast :: OctopusOpts 20 | VeryFast :: OctopusOpts 21 | Debug :: OctopusOpts 22 | NoFilter :: OctopusOpts 23 | 24 | instance Show OctopusOpts where 25 | show (NormalSample x) = "--normal-sample " ++x 26 | show Fast = "--fast" 27 | show VeryFast = "--very-fast" 28 | show Debug = "--debug" 29 | show NoFilter = "-f off" 30 | 31 | normalSample x = if length x == 0 then error "Octopus: need non-empty name for normal sample" else NormalSample x 32 | fast = Fast 33 | veryFast = VeryFast 34 | debug = Debug 35 | noFilter = NoFilter 36 | 37 | data Call c = Call c [OctopusOpts] deriving Show 38 | 39 | buildOctopus t (Call _ opts) a@(paths -> inputs) [out] = do 40 | let bais = map ( <.> "bai" ) inputs 41 | fai = getRef a <.> "fai" 42 | lift . need $ fai:bais 43 | run "octopus" 44 | ["--reads", unwords inputs] 45 | ["--reference", getRef a] 46 | ["--output", out] 47 | ["--threads", show t] 48 | (map show opts) 49 | 50 | $(makeSingleTypes ''Call [''IsVCF] []) 51 | -------------------------------------------------------------------------------- /examples/README: -------------------------------------------------------------------------------- 1 | # simple.lhs 2 | 3 | simple.lhs presents an example workflow using BioShake to align and call 4 | variants. The fastq files are simulated from the reference with some synthetic 5 | variants and included in this directory. 6 | 7 | Git-lfs is required to fetch the sequences from the repository (other 8 | tools are also required to run, see [requirements](#requirements)). 9 | After git-lfs is installed, the sequences can be fetched with 10 | 11 | git lfs fetch 12 | 13 | The sample pipeline can then be run by: 14 | 15 | runhaskell simple.lhs *.fq 16 | 17 | or by compiling then executing the resulting binary on the fastq files. If you 18 | are using stack you can: 19 | 20 | stack setup 21 | stack build 22 | stack runhaskell simple.lhs *.fq 23 | 24 | There are 3 variants that should be called at positions 14881 25 | (sample2), 29881 (sample1 and sample2) and 44881 (sample 1). 26 | 27 | ## Requirements 28 | 29 | - [git-lfs](https://git-lfs.github.com/) 30 | - [BWA](https://bio-bwa.sourceforge.net/) 31 | - [Samtools](https://github.com/samtools/samtools) 32 | - [platypus](https://github.com/andyrimmer/Platypus) 33 | 34 | # nextflow-blast.lhs 35 | 36 | This workflow translates a [nextflow 37 | example](https://github.com/nextflow-io/blast-example) to BioShake. The example 38 | shards a FastA file into a number of chunks which are aligned against a 39 | reference database using Blast. The top results are then collected into a final 40 | file. This workflow is an example of a scatter–gather type of workflow. Data is 41 | not provided in this repository. 42 | 43 | ## Requirements 44 | 45 | - [blast](https://blast.ncbi.nlm.nih.gov/Blast.cgi?CMD=Web&PAGE_TYPE=BlastDocs&DOC_TYPE=Download) -------------------------------------------------------------------------------- /docs/Bioshake-Cluster-BWA.html: -------------------------------------------------------------------------------- 1 | Bioshake.Cluster.BWA

bioshake-0.1.0.0: Bioinformatics pipelines with shake

Safe HaskellNone
LanguageHaskell2010

Bioshake.Cluster.BWA

Documentation

-------------------------------------------------------------------------------- /docs/Bioshake-Cluster-ADTEx.html: -------------------------------------------------------------------------------- 1 | Bioshake.Cluster.ADTEx

bioshake-0.1.0.0: Bioinformatics pipelines with shake

Safe HaskellNone
LanguageHaskell2010

Bioshake.Cluster.ADTEx

Documentation

-------------------------------------------------------------------------------- /edam-to-map.awk: -------------------------------------------------------------------------------- 1 | BEGIN{ 2 | FPAT="([^,]*)|(\"[^\"]*\")" 3 | } 4 | 5 | 6 | function camelcase(str, i, n, name) 7 | { 8 | n = split(str, words, /[^a-zA-Z0-9]/) 9 | name = "" 10 | for(i = 1; i <= n; i++){ 11 | name = name toupper(substr(words[i],1,1)) tolower(substr(words[i],2)) 12 | } 13 | return name 14 | } 15 | 16 | $5 == "FALSE"{ 17 | name = camelcase($2) 18 | if(substr(name,1,1) + 0 != 0) 19 | next 20 | if(name == "") 21 | next 22 | if(!printed[name]){ 23 | print "class " name " x" 24 | printed[name]++ 25 | } 26 | id[$1] = name 27 | if($15 != "") 28 | ext[$1] = $15 29 | 30 | n = split($8, words, /\|/) 31 | for(i = 1; i <= n; i++){ 32 | parents[name][++cnt[name]] = words[i] 33 | } 34 | } 35 | 36 | END{ 37 | print "" 38 | print "edam :: M.Map T.Name EDAMNode" 39 | printf("edam = M.fromList [") 40 | for(i in id) { 41 | n = id[i] 42 | if(done[n]) 43 | continue 44 | done[n]++ 45 | 46 | 47 | printf("%s(''%s, EDAMNode \"%s\"", comma?" ,":"", n, i) 48 | comma++ 49 | if(ext[i]){ 50 | m = split(ext[i], exts, /\|/) 51 | printf(" (Just [\"%s\"", exts[1]) 52 | for(j = 2; j <= m; j++) 53 | printf(",\"%s\"", exts[j]) 54 | printf("])") 55 | } else 56 | printf(" Nothing") 57 | 58 | printf(" [") 59 | k = 0; 60 | for(j = 1; j <= cnt[n]; j++) 61 | if(id[parents[n][j]] != ""){ 62 | printf("%s''%s", k?", ":"", id[parents[n][j]]) 63 | k++ 64 | } 65 | printf("])\n") 66 | } 67 | printf(" ]") 68 | } 69 | -------------------------------------------------------------------------------- /Bioshake/Internal/Sequenza.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleContexts #-} 2 | {-# LANGUAGE FlexibleInstances #-} 3 | {-# LANGUAGE TemplateHaskell #-} 4 | {-# LANGUAGE TypeOperators #-} 5 | {-# LANGUAGE ViewPatterns #-} 6 | module Bioshake.Internal.Sequenza where 7 | 8 | import Bioshake 9 | import Bioshake.TH 10 | import Control.Monad 11 | import Control.Monad.Trans (lift) 12 | import Data.List 13 | import Development.Shake 14 | import Development.Shake.FilePath 15 | 16 | data Pileup2Seqz c = Pileup2Seqz c deriving Show 17 | 18 | -- | Tags a type with GC content; this is not part of 'Bioshake.Referenced' as it is a sequenza specific format. 19 | class GC a where 20 | getGC :: a -> FilePath 21 | 22 | instance GC a => GC (a :-> b) where 23 | getGC (a :-> _) = getGC a 24 | 25 | instance GC a => GC (All a) where 26 | getGC (All as) = foldl1 (\l r -> if l == r then l else error "cannot combine mixed reference gc files") $ fmap getGC as 27 | 28 | buildPileup2Seqz _ a@(paths -> [normal, tumour]) [out] = do 29 | let gc = getGC a 30 | lift $ need [gc] 31 | run "sequenza-utils bam2seqz -p" 32 | ["-n", normal] 33 | ["-t", tumour] 34 | ["-gc", gc] 35 | ["-o", out] 36 | 37 | instance Pathable a => Pathable (a :-> Pileup2Seqz c) where 38 | paths (a :-> _) = [hashPath (paths a) <.> "Sequenza" <.> "Pileup2Seqz" <.> "seqz" <.> "gz"] 39 | instance IsSeqzGZ (a :-> Pileup2Seqz c) 40 | 41 | data Bin c = Bin c Int 42 | deriving Show 43 | 44 | buildBin (Bin _ bs) (paths -> [input]) [out] = 45 | run "sequenza-utils seqz_binning" 46 | ["-w", show bs] 47 | ["-s", input] 48 | "|gzip > " 49 | [out] 50 | 51 | $(makeSingleTypes ''Bin [''IsSeqzGZ] []) 52 | -------------------------------------------------------------------------------- /docs/Bioshake-Cluster-FREEC.html: -------------------------------------------------------------------------------- 1 | Bioshake.Cluster.FREEC

bioshake-0.1.0.0: Bioinformatics pipelines with shake

Safe HaskellNone
LanguageHaskell2010

Bioshake.Cluster.FREEC

Documentation

-------------------------------------------------------------------------------- /docs/Bioshake-Cluster-Platypus.html: -------------------------------------------------------------------------------- 1 | Bioshake.Cluster.Platypus

bioshake-0.1.0.0: Bioinformatics pipelines with shake

Safe HaskellNone
LanguageHaskell2010

Bioshake.Cluster.Platypus

Documentation

-------------------------------------------------------------------------------- /docs/mini_Bioshake.html: -------------------------------------------------------------------------------- 1 | Bioshake

Bioshake

data All a

class Referenced a

class Capture a

-------------------------------------------------------------------------------- /docs/Bioshake-Varscan.html: -------------------------------------------------------------------------------- 1 | Bioshake.Varscan

bioshake-0.1.0.0: Bioinformatics pipelines with shake

Safe HaskellNone
LanguageHaskell2010

Bioshake.Varscan

Documentation

callSomatic :: CallSomatic () Source #

copyNumber :: CopyNumber () Source #

-------------------------------------------------------------------------------- /docs/Bioshake-Cluster-Bedtools.html: -------------------------------------------------------------------------------- 1 | Bioshake.Cluster.Bedtools

bioshake-0.1.0.0: Bioinformatics pipelines with shake

Safe HaskellNone
LanguageHaskell2010

Bioshake.Cluster.Bedtools

Documentation

-------------------------------------------------------------------------------- /docs/Bioshake-Cluster-Cutadapt.html: -------------------------------------------------------------------------------- 1 | Bioshake.Cluster.Cutadapt

bioshake-0.1.0.0: Bioinformatics pipelines with shake

Safe HaskellNone
LanguageHaskell2010

Bioshake.Cluster.Cutadapt

Documentation

-------------------------------------------------------------------------------- /docs/Bioshake-ADTEx.html: -------------------------------------------------------------------------------- 1 | Bioshake.ADTEx

bioshake-0.1.0.0: Bioinformatics pipelines with shake

Safe HaskellNone
LanguageHaskell2010

Bioshake.ADTEx

Synopsis

Documentation

call :: Call () Source #

Call CNVs for whole exomes using ADTEx. Expects deduplicated BAM files as input, and a capture region.

-------------------------------------------------------------------------------- /docs/Bioshake-Bedtools.html: -------------------------------------------------------------------------------- 1 | Bioshake.Bedtools

bioshake-0.1.0.0: Bioinformatics pipelines with shake

Safe HaskellNone
LanguageHaskell2010

Bioshake.Bedtools

Synopsis

Documentation

captureOnly :: CaptureOnly () Source #

Reduces VCF files to the capture region only using bedtools.

-------------------------------------------------------------------------------- /docs/mini_Bioshake-Types.html: -------------------------------------------------------------------------------- 1 | Bioshake.Types

Bioshake.Types

data a :-> b

class Buildable a

class Compilable a

class Pathable a

data Nuc

data Seq

data Threads

-------------------------------------------------------------------------------- /docs/Bioshake-Cutadapt.html: -------------------------------------------------------------------------------- 1 | Bioshake.Cutadapt

bioshake-0.1.0.0: Bioinformatics pipelines with shake

Safe HaskellNone
LanguageHaskell2010

Bioshake.Cutadapt

Synopsis

Documentation

trim :: Seq -> Trim () Source #

Removes the given adaptor Seq from fastq files using cutadapt.

-------------------------------------------------------------------------------- /Bioshake/Kallisto.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE DataKinds #-} 2 | {-# LANGUAGE FlexibleContexts #-} 3 | {-# LANGUAGE FlexibleInstances #-} 4 | {-# LANGUAGE KindSignatures #-} 5 | {-# LANGUAGE MultiParamTypeClasses #-} 6 | {-# LANGUAGE TemplateHaskell #-} 7 | module Bioshake.Kallisto(quant 8 | ,quantWith 9 | ,quantSingle 10 | ,quantSingleWith 11 | ,abundance 12 | ,bootstrap 13 | ,seed 14 | ,fusion 15 | ,fusions 16 | ,fragmentLength 17 | ,fragmentSD 18 | ,indexRules) where 19 | 20 | import Bioshake 21 | import Bioshake.Internal.Kallisto 22 | import Bioshake.TH 23 | import Data.List 24 | import Development.Shake 25 | import Development.Shake.FilePath 26 | 27 | $(makeThreaded' ''Quant [''Referenced, ''IsFastQ, ''PairedEnd] 'buildKallisto) 28 | $(makeThreaded' ''QuantSingle [''Referenced, ''IsFastQ] 'buildKallistoSingle) 29 | $(makeSingleThread ''Abundance [''IsKal] 'buildAbundance) 30 | $(makeSingleThread ''Fusions [''IsKal] 'buildFusions) 31 | 32 | quant :: Given Threads => Quant Threads 33 | quant = Quant given [] 34 | 35 | quantWith :: Given Threads => [QuantOpts] -> Quant Threads 36 | quantWith = Quant given 37 | 38 | quantSingle :: Given Threads => QuantSingle Threads 39 | quantSingle = quantSingleWith [] 40 | 41 | quantSingleWith :: Given Threads => [QuantOpts] -> QuantSingle Threads 42 | quantSingleWith cfg = check $ QuantSingle given cfg 43 | where 44 | check a@(QuantSingle _ opts) = 45 | if hasFragmentLength opts && hasFragmentSD opts then 46 | a 47 | else 48 | error "Kallisto: single end reads require fragment length and standard deviation" 49 | 50 | indexRules = 51 | "//*.idx" %> \out -> do 52 | let input = dropExtension out 53 | need [input] 54 | cmd "kallisto index" 55 | ["-i", out] 56 | input 57 | -------------------------------------------------------------------------------- /Bioshake/Cluster/Kallisto.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE DataKinds #-} 2 | {-# LANGUAGE FlexibleContexts #-} 3 | {-# LANGUAGE FlexibleInstances #-} 4 | {-# LANGUAGE KindSignatures #-} 5 | {-# LANGUAGE MultiParamTypeClasses #-} 6 | {-# LANGUAGE TemplateHaskell #-} 7 | module Bioshake.Cluster.Kallisto(quant 8 | ,quantWith 9 | ,quantSingle 10 | ,quantSingleWith 11 | ,bootstrap 12 | ,seed 13 | ,fusion 14 | ,fragmentLength 15 | ,fragmentSD 16 | ,indexRules) where 17 | 18 | import Bioshake 19 | import Bioshake.Cluster.Torque 20 | import Bioshake.Internal.Kallisto 21 | import Bioshake.TH 22 | import Data.List 23 | import Development.Shake 24 | import Development.Shake.FilePath 25 | 26 | $(makeCluster' ''Quant [''Referenced, ''IsFastQ, ''PairedEnd] 'buildKallisto) 27 | $(makeCluster' ''QuantSingle [''Referenced, ''IsFastQ] 'buildKallistoSingle) 28 | 29 | quant :: Given Config => Quant Config 30 | quant = Quant given [] 31 | 32 | quantWith :: Given Config => [QuantOpts] -> Quant Config 33 | quantWith = Quant given 34 | 35 | quantSingle :: Given Config => QuantSingle Config 36 | quantSingle = quantSingleWith [] 37 | 38 | quantSingleWith :: Given Config => [QuantOpts] -> QuantSingle Config 39 | quantSingleWith cfg = check $ QuantSingle given cfg 40 | where 41 | check a@(QuantSingle _ opts) = 42 | if hasFragmentLength opts && hasFragmentSD opts then 43 | a 44 | else 45 | error "Kallisto: single end reads require fragment length and standard deviation" 46 | 47 | indexRules :: Given Config => Rules () 48 | indexRules = 49 | "//*.idx" %> \out -> do 50 | let input = dropExtension out 51 | need [input] 52 | withSubmit 53 | (run "kallisto index" 54 | ["-i", out] 55 | input) 56 | [Left given] 57 | -------------------------------------------------------------------------------- /docs/Bioshake-Cluster-SnpEff.html: -------------------------------------------------------------------------------- 1 | Bioshake.Cluster.SnpEff

bioshake-0.1.0.0: Bioinformatics pipelines with shake

Safe HaskellNone
LanguageHaskell2010

Bioshake.Cluster.SnpEff

Documentation

-------------------------------------------------------------------------------- /docs/mini_Bioshake-Cluster-Torque.html: -------------------------------------------------------------------------------- 1 | Bioshake.Cluster.Torque

Bioshake.Cluster.Torque

type Queue

data TOption

data Config

class TArgs a

class Args a

type a |-> b

-------------------------------------------------------------------------------- /docs/Bioshake-BWA.html: -------------------------------------------------------------------------------- 1 | Bioshake.BWA

bioshake-0.1.0.0: Bioinformatics pipelines with shake

Safe HaskellNone
LanguageHaskell2010

Bioshake.BWA

Synopsis

Documentation

Aligns fastq files against the reference using BWA-mem.

-------------------------------------------------------------------------------- /docs/Bioshake-FREEC.html: -------------------------------------------------------------------------------- 1 | Bioshake.FREEC

bioshake-0.1.0.0: Bioinformatics pipelines with shake

Safe HaskellNone
LanguageHaskell2010

Bioshake.FREEC

Synopsis

Documentation

CNV calling on exomes using FREEC

-------------------------------------------------------------------------------- /docs/Bioshake-SnpEff.html: -------------------------------------------------------------------------------- 1 | Bioshake.SnpEff

bioshake-0.1.0.0: Bioinformatics pipelines with shake

Safe HaskellNone
LanguageHaskell2010

Bioshake.SnpEff

Synopsis

Documentation

annotate :: Annotate () Source #

Annotate using snpEFF

dBNSFP :: DBNSFP () Source #

Annotate with DBNSFP using snpEFF.

-------------------------------------------------------------------------------- /docs/Bioshake-Platypus.html: -------------------------------------------------------------------------------- 1 | Bioshake.Platypus

bioshake-0.1.0.0: Bioinformatics pipelines with shake

Safe HaskellNone
LanguageHaskell2010

Bioshake.Platypus

Synopsis

Documentation

Call variants using Platypus. Can call multiple samples.

-------------------------------------------------------------------------------- /docs/Bioshake-Cluster-Varscan.html: -------------------------------------------------------------------------------- 1 | Bioshake.Cluster.Varscan

bioshake-0.1.0.0: Bioinformatics pipelines with shake

Safe HaskellNone
LanguageHaskell2010

Bioshake.Cluster.Varscan

Documentation

-------------------------------------------------------------------------------- /Bioshake/Internal/FREEC.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleContexts #-} 2 | {-# LANGUAGE FlexibleInstances #-} 3 | {-# LANGUAGE TemplateHaskell #-} 4 | {-# LANGUAGE ViewPatterns #-} 5 | module Bioshake.Internal.FREEC where 6 | 7 | import Bioshake 8 | import Bioshake.TH 9 | import Control.Monad 10 | import Control.Monad.Trans (lift) 11 | import Data.List 12 | import Development.Shake 13 | import Development.Shake.FilePath 14 | import System.Posix.Files (createLink, rename) 15 | 16 | data CNVExome c = CNVExome c deriving Show 17 | 18 | buildFREECExome t _ a@(paths -> [normal, tumour]) [out] = 19 | withTempDirectory' "tmp/" "FREEC" $ \tmp -> do 20 | let conf = tmp "config.cfg" 21 | confContents = unlines ["[general]" 22 | ,"window = 0" 23 | ,unwords ["outputDIR =", tmp] 24 | ,"contaminationAdjustment = TRUE" 25 | ,"ploidy=2,3,4" 26 | ,"readCountThreshold = 50" 27 | ,unwords ["chrLenFile =", lenFile] 28 | ,unwords ["chrFiles =", dropFileName lenFile] 29 | 30 | ,"[sample]" 31 | ,unwords ["mateFile =", tumour] 32 | ,"inputFormat = pileup" 33 | ,"mateOrientation = FR" 34 | 35 | ,"[control]" 36 | ,unwords ["mateFile =", normal] 37 | ,"inputFormat = pileup" 38 | ,"mateOrientation = FR" 39 | 40 | ,"[target]" 41 | ,unwords ["captureRegions =", capture] 42 | ] 43 | lenFile = getRef a <.> ".fai" 44 | capture = getBED a 45 | lift $ need [lenFile, capture] 46 | liftIO $ writeFile conf confContents 47 | () <- run "freec" 48 | ["-conf", conf] 49 | run "tar -zcvf" [out] ["-C", tmp] "." 50 | 51 | $(makeSingleTypes ''CNVExome [''IsTGZ] []) 52 | -------------------------------------------------------------------------------- /Bioshake/Internal/Facets.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleContexts #-} 2 | {-# LANGUAGE FlexibleInstances #-} 3 | {-# LANGUAGE FunctionalDependencies #-} 4 | {-# LANGUAGE GADTs #-} 5 | {-# LANGUAGE MultiParamTypeClasses #-} 6 | {-# LANGUAGE StandaloneDeriving #-} 7 | {-# LANGUAGE TemplateHaskell #-} 8 | {-# LANGUAGE TypeOperators #-} 9 | {-# LANGUAGE UndecidableInstances #-} 10 | {-# LANGUAGE ViewPatterns #-} 11 | module Bioshake.Internal.Facets where 12 | 13 | import Bioshake 14 | import Bioshake.TH 15 | import Control.Monad 16 | import Control.Monad.Trans (lift) 17 | import Control.Monad.Trans.Free 18 | import Data.List 19 | import Development.Shake 20 | import Development.Shake.FilePath 21 | import System.Posix.Files (createLink, rename) 22 | 23 | class HasBams a where 24 | bams :: a -> [FilePath] 25 | 26 | instance {-# OVERLAPPABLE #-} (IsBam a, Pathable a) => HasBams a where 27 | bams = paths 28 | 29 | instance {-# OVERLAPPING #-} HasBams a => HasBams (a :-> b) where 30 | bams (a :-> _) = bams a 31 | 32 | class NoContigs a 33 | 34 | data Pileup c = Pileup c deriving Show 35 | 36 | buildFacets :: (Pathable a, HasBams a) => Pileup c -> a -> [FilePath] -> Cmd () 37 | buildFacets _ a@(paths -> [vcf]) [out] = do 38 | let inputs = bams a 39 | lift $ need inputs 40 | run "snp-pileup" 41 | vcf 42 | [out] 43 | inputs 44 | 45 | class IsFacets a 46 | 47 | $(makeSingleTypes ''Pileup [''IsFacets] []) 48 | 49 | 50 | -- Sort VCF file output into lex order 51 | data Sort c = Sort c deriving Show 52 | 53 | buildSort :: Pathable a => t -> a -> [FilePath] -> FreeT CmdF Action () 54 | buildSort _ a@(paths -> [input]) [out] = do 55 | () <- run "grep '^#'" [input] ">" [out] 56 | run "grep -v '^#'" [input] "| LC_ALL=C sort -t $'\\t' -k1,1 -k2,2n >>" [out] 57 | 58 | $(makeSingleTypes ''Sort [''IsVCF, ''Sorted] [''NoContigs]) 59 | 60 | -- Filters out contigs 61 | data FilterContigs c = FilterContigs c deriving Show 62 | 63 | buildNoContigs :: Pathable a => t -> a -> [FilePath] -> FreeT CmdF Action () 64 | buildNoContigs _ a@(paths -> [input]) [out] = do 65 | () <- run "grep '^#'" [input] ">" [out] 66 | run "grep -v '^#'" [input] "| grep '^[^_]*\\t' >>" [out] 67 | 68 | $(makeSingleTypes ''FilterContigs [''IsVCF, ''NoContigs] [''Sorted]) 69 | -------------------------------------------------------------------------------- /docs/src/Bioshake-Cutadapt.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Bioshake/Cutadapt.hs 7 | 8 | 9 | 10 |
{-# LANGUAGE FlexibleInstances     #-}
11 | {-# LANGUAGE MultiParamTypeClasses #-}
12 | {-# LANGUAGE TemplateHaskell       #-}
13 | {-# LANGUAGE TypeOperators         #-}
14 | module Bioshake.Cutadapt where
15 | 
16 | import           Bioshake
17 | import           Bioshake.Internal.Cutadapt
18 | import           Bioshake.TH
19 | import           Development.Shake
20 | 
21 | $(makeSingleThread ''Trim [''IsFastQ] 'buildTrim)
22 | {- $trim Removes the given adaptor 'Seq' from fastq files using cutadapt. -}
23 | 
24 | 25 | -------------------------------------------------------------------------------- /Bioshake/Internal/CNVkit.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleContexts #-} 2 | {-# LANGUAGE FlexibleInstances #-} 3 | {-# LANGUAGE GADTs #-} 4 | {-# LANGUAGE StandaloneDeriving #-} 5 | {-# LANGUAGE TemplateHaskell #-} 6 | module Bioshake.Internal.CNVkit where 7 | 8 | import Bioshake 9 | import Bioshake.TH 10 | import Control.Monad 11 | import Control.Monad.Trans (lift) 12 | import Data.List 13 | import Development.Shake 14 | import Development.Shake.FilePath 15 | import System.Posix.Files (createLink, rename) 16 | 17 | data BatchOpts where 18 | DropLowCoverage :: BatchOpts 19 | 20 | instance Show BatchOpts where 21 | show DropLowCoverage = "--drop-low-coverage" 22 | 23 | data BatchWGS c where 24 | BatchWGS :: (Show a, Pathable a) => c -> [a] -> [BatchOpts] -> BatchWGS c 25 | deriving instance Show c => Show (BatchWGS c) 26 | 27 | data Batch c where 28 | Batch :: (Show a, Pathable a) => c -> [a] -> [BatchOpts] -> Batch c 29 | deriving instance Show c => Show (Batch c) 30 | 31 | class IsCNVkit c 32 | 33 | buildBatchWGS t (BatchWGS _ norms opts) a [out] = do 34 | let inputs = paths a 35 | normPaths = concatMap paths norms 36 | lift $ need normPaths 37 | withTempDirectory' "tmp" "cnvkit" $ \tmpDir -> do 38 | () <- run "cnvkit.py batch" 39 | inputs 40 | (if length normPaths > 0 then "-n" : normPaths else []) 41 | "-m wgs" 42 | ["-f", getRef a] 43 | ["--annotate", annotations a] 44 | ["-p", show t] 45 | ["-d", tmpDir] 46 | (map show opts) 47 | () <- run "sleep 5" 48 | run "tar" 49 | ["-C", tmpDir] 50 | ["-cf", out] 51 | "." 52 | 53 | $(makeSingleTypes ''BatchWGS [''IsCNVkit] []) 54 | 55 | buildBatch t (Batch _ norms opts) a [out] = do 56 | let inputs = paths a 57 | normPaths = concatMap paths norms 58 | lift $ need normPaths 59 | withTempDirectory' "tmp" "cnvkit" $ \tmpDir -> do 60 | () <- run "cnvkit.py batch" 61 | inputs 62 | (if length normPaths > 0 then "-n" : normPaths else []) 63 | ["--targets", getBED a] 64 | ["-f", getRef a] 65 | ["--annotate", annotations a] 66 | ["-p", show t] 67 | ["-d", tmpDir] 68 | (map show opts) 69 | () <- run "sleep 5" 70 | run "tar" 71 | ["-C", tmpDir] 72 | ["-cf", out] 73 | "." 74 | 75 | $(makeSingleTypes ''Batch [''IsCNVkit] []) 76 | -------------------------------------------------------------------------------- /docs/Bioshake-Picard.html: -------------------------------------------------------------------------------- 1 | Bioshake.Picard

bioshake-0.1.0.0: Bioinformatics pipelines with shake

Safe HaskellNone
LanguageHaskell2010

Bioshake.Picard

Synopsis

Documentation

markDups :: MarkDups () Source #

Mark duplicates using picard tools

deDup :: DeDup () Source #

De-duplicate using picard tools

fixMates :: FixMates () Source #

-------------------------------------------------------------------------------- /docs/Bioshake-Cluster-Picard.html: -------------------------------------------------------------------------------- 1 | Bioshake.Cluster.Picard

bioshake-0.1.0.0: Bioinformatics pipelines with shake

Safe HaskellNone
LanguageHaskell2010

Bioshake.Cluster.Picard

Documentation

-------------------------------------------------------------------------------- /Bioshake/Tags.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleContexts #-} 2 | {-# LANGUAGE TemplateHaskell #-} 3 | {-# LANGUAGE TypeOperators #-} 4 | {-# LANGUAGE UndecidableInstances #-} 5 | 6 | -- | This module introduces a set of common tags that are frequently used when 7 | -- defining stages. 8 | module Bioshake.Tags where 9 | 10 | import Bioshake.Types 11 | import Control.Monad 12 | import Language.Haskell.TH 13 | 14 | -- Filetypes 15 | 16 | -- | Duplicated reads have been removed 17 | class DeDuped a 18 | instance DeDuped a => DeDuped (a :-> b) 19 | 20 | -- | Duplicated reads have been marked 21 | class DupsMarked a 22 | 23 | -- | Contains an RG line 24 | class HasRG a 25 | instance (HasRG a, IsBam (a :-> b)) => HasRG (a :-> b) 26 | 27 | -- | Results from a paired end sequencing processed 28 | class PairedEnd a 29 | instance PairedEnd a => PairedEnd (a :-> b) 30 | 31 | -- | Sorted (e.g., sorted sam/bam, or bed) 32 | class Sorted a 33 | 34 | -- | Name sorted 35 | class NameSorted a 36 | 37 | -- | Filted to a capture region 38 | class CaptureOnly a 39 | 40 | class IsBam a 41 | class IsBcf a 42 | class IsBed a 43 | class IsCSV a 44 | class IsFastA a 45 | class IsFastQ a 46 | class IsGff a 47 | class IsMPileup a 48 | class IsSam a 49 | class IsSeqzGZ a 50 | class IsTSV a 51 | class IsVCF a 52 | class IsTGZ a 53 | class IsCov a 54 | 55 | 56 | allTags = [''IsFastA 57 | ,''IsFastQ 58 | ,''DeDuped 59 | ,''DupsMarked 60 | ,''HasRG 61 | ,''IsBam 62 | ,''IsBcf 63 | ,''IsBed 64 | ,''IsCSV 65 | ,''IsGff 66 | ,''IsMPileup 67 | ,''IsSam 68 | ,''IsSeqzGZ 69 | ,''IsTSV 70 | ,''IsVCF 71 | ,''IsTGZ 72 | ,''IsCov 73 | ,''PairedEnd 74 | ,''Sorted 75 | ,''NameSorted] 76 | 77 | -- Tagging TH 78 | 79 | -- | Template haskell to declare transitivity for all tags through a pipe ending 80 | -- in a type. Examples include 'Bioshake.Out'. 81 | allTransTagsPipe ty = 82 | forM allTags $ \tag -> do 83 | a <- newName "a" 84 | return $ InstanceD Nothing [AppT (ConT tag) (VarT a)] (AppT (ConT tag) (AppT (AppT (ConT ''(:->)) (VarT a)) (ConT ty) )) [] 85 | 86 | -- | Same as 'allTransTagsPipe' but for transitivity through a constructor. 87 | -- Examples include 'Bioshake.All'. 88 | allTransTags ty = 89 | forM allTags $ \tag -> do 90 | a <- newName "a" 91 | return $ InstanceD Nothing [AppT (ConT tag) (VarT a)] (AppT (ConT tag) (AppT (ConT ty) (VarT a))) [] 92 | -------------------------------------------------------------------------------- /docs/src/Bioshake-Cluster-Cutadapt.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Bioshake/Cluster/Cutadapt.hs 7 | 8 | 9 | 10 |
{-# LANGUAGE FlexibleContexts      #-}
11 | {-# LANGUAGE FlexibleInstances     #-}
12 | {-# LANGUAGE MultiParamTypeClasses #-}
13 | {-# LANGUAGE TemplateHaskell       #-}
14 | {-# LANGUAGE TypeOperators         #-}
15 | module Bioshake.Cluster.Cutadapt where
16 | 
17 | import           Bioshake
18 | import           Bioshake.Cluster.Torque
19 | import           Bioshake.Internal.Cutadapt
20 | import           Bioshake.TH
21 | import           Development.Shake
22 | 
23 | $(makeSingleCluster ''Trim [''IsFastQ] 'buildTrim)
24 | 
25 | 26 | -------------------------------------------------------------------------------- /docs/src/Bioshake-BWA.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Bioshake/BWA.hs 7 | 8 | 9 | 10 |
{-# LANGUAGE FlexibleContexts      #-}
11 | {-# LANGUAGE FlexibleInstances     #-}
12 | {-# LANGUAGE MultiParamTypeClasses #-}
13 | {-# LANGUAGE TemplateHaskell       #-}
14 | {-# LANGUAGE TypeOperators         #-}
15 | module Bioshake.BWA where
16 | 
17 | import           Bioshake
18 | import           Bioshake.Implicit
19 | import           Bioshake.Internal.BWA
20 | import           Bioshake.TH
21 | import           Development.Shake
22 | 
23 | $(makeThreaded ''Align [''Referenced, ''IsFastQ] 'buildBWA)
24 | {- $align Aligns fastq files against the reference using BWA-mem. -}
25 | 
26 | 27 | -------------------------------------------------------------------------------- /docs/src/Bioshake-Bedtools.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Bioshake/Bedtools.hs 7 | 8 | 9 | 10 |
{-# LANGUAGE FlexibleContexts      #-}
11 | {-# LANGUAGE FlexibleInstances     #-}
12 | {-# LANGUAGE MultiParamTypeClasses #-}
13 | {-# LANGUAGE TemplateHaskell       #-}
14 | module Bioshake.Bedtools where
15 | 
16 | import           Bioshake
17 | import           Bioshake.Internal.Bedtools
18 | import           Bioshake.TH
19 | import           Development.Shake
20 | import           Development.Shake.FilePath
21 | 
22 | $(makeSingleThread ''CaptureOnly [''Capture, ''IsVCF] 'buildBedtoolsCaptureOnly)
23 | {- $captureOnly Reduces VCF files to the capture region only using bedtools. -}
24 | 
25 | 26 | -------------------------------------------------------------------------------- /Bioshake/Internal/BWA.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE DataKinds #-} 2 | {-# LANGUAGE FlexibleContexts #-} 3 | {-# LANGUAGE FlexibleInstances #-} 4 | {-# LANGUAGE GADTs #-} 5 | {-# LANGUAGE MultiParamTypeClasses #-} 6 | {-# LANGUAGE ScopedTypeVariables #-} 7 | {-# LANGUAGE TemplateHaskell #-} 8 | {-# LANGUAGE TypeOperators #-} 9 | {-# LANGUAGE ViewPatterns #-} 10 | module Bioshake.Internal.BWA where 11 | 12 | import Bioshake hiding (C) 13 | import Bioshake.TH 14 | import Control.Monad.Trans (lift) 15 | import Data.List 16 | import Development.Shake 17 | import Development.Shake.FilePath 18 | import GHC.TypeLits 19 | 20 | data BWAOpts where 21 | K :: Int -> BWAOpts 22 | BW :: Int -> BWAOpts 23 | D :: Int -> BWAOpts 24 | R :: Double -> BWAOpts 25 | Y :: Int -> BWAOpts 26 | C :: Int -> BWAOpts 27 | DC :: Double -> BWAOpts 28 | W :: Int -> BWAOpts 29 | M :: Int -> BWAOpts 30 | RG :: String -> BWAOpts 31 | SoftClip :: BWAOpts 32 | 33 | instance Show BWAOpts where 34 | show (K p) = "-k" ++ show p 35 | show (BW p) = "-w" ++ show p 36 | show (D p) = "-d" ++ show p 37 | show (R p) = "-r" ++ show p 38 | show (Y p) = "-y" ++ show p 39 | show (C p) = "-c" ++ show p 40 | show (DC p) = "-D" ++ show p 41 | show (W p) = "-W" ++ show p 42 | show (M p) = "-m" ++ show p 43 | show (RG r) = concat ["-R", "'@RG\\tID:", r, "\\tSM:", r, "'"] 44 | show SoftClip = "-Y" 45 | 46 | k x = if x > 0 then K x else error "BWA: failed k > 0" 47 | bw x = if x > 0 then BW x else error "BWA: failed bw > 0" 48 | d x = if x > 0 then D x else error "BWA: failed d > 0" 49 | r x = if x > 0 then R x else error "BWA: failed r > 0" 50 | y x = if x > 0 then Y x else error "BWA: failed y > 0" 51 | c x = if x > 0 then C x else error "BWA: failed c > 0" 52 | dc x = if x > 0 then DC x else error "BWA: failed dc > 0" 53 | w x = if x > 0 then W x else error "BWA: failed w > 0" 54 | m x = if x > 0 then M x else error "BWA: failed m > 0" 55 | rg r = if r /= "" then RG r else error "BWA: require non-empty rg string" 56 | softClip = SoftClip 57 | 58 | data Align c = Align c [BWAOpts] deriving Show 59 | 60 | buildBWA t (Align _ opts) a@(paths -> inputs) [out] = 61 | if (length inputs > 2 || length inputs == 0) 62 | then error "BWA: need 1 single-end read set or 2 paired-end read sets" 63 | else do 64 | lift $ need [getRef a <.> ext | ext <- ["amb", "ann", "bwt", "pac", "sa"]] 65 | run "bwa mem" 66 | ["-t", show t] 67 | [getRef a] 68 | inputs 69 | (map show opts) 70 | "| samtools view -b" 71 | ">" out 72 | 73 | $(makeSingleTypes ''Align [''IsBam, ''NameSorted] []) 74 | -------------------------------------------------------------------------------- /docs/src/Bioshake-Cluster-Platypus.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Bioshake/Cluster/Platypus.hs 7 | 8 | 9 | 10 |
{-# LANGUAGE FlexibleContexts      #-}
11 | {-# LANGUAGE FlexibleInstances     #-}
12 | {-# LANGUAGE MultiParamTypeClasses #-}
13 | {-# LANGUAGE TemplateHaskell       #-}
14 | module Bioshake.Cluster.Platypus where
15 | 
16 | import           Bioshake
17 | import           Bioshake.Internal.Platypus
18 | import           Bioshake.TH
19 | import           Data.List
20 | import           Development.Shake
21 | import           Development.Shake.FilePath
22 | 
23 | $(makeCluster ''Call [''Referenced, ''IsBam] 'buildPlatypus)
24 | 
25 | 26 | -------------------------------------------------------------------------------- /docs/src/Bioshake-Platypus.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Bioshake/Platypus.hs 7 | 8 | 9 | 10 |
{-# LANGUAGE FlexibleContexts      #-}
11 | {-# LANGUAGE FlexibleInstances     #-}
12 | {-# LANGUAGE MultiParamTypeClasses #-}
13 | {-# LANGUAGE TemplateHaskell       #-}
14 | module Bioshake.Platypus where
15 | 
16 | import           Bioshake
17 | import           Bioshake.Internal.Platypus
18 | import           Bioshake.TH
19 | import           Data.List
20 | import           Development.Shake
21 | import           Development.Shake.FilePath
22 | 
23 | $(makeThreaded ''Call [''Referenced, ''IsBam] 'buildPlatypus)
24 | {- $call Call variants using Platypus. Can call multiple samples. -}
25 | 
26 | 27 | -------------------------------------------------------------------------------- /docs/mini_Bioshake-TH.html: -------------------------------------------------------------------------------- 1 | Bioshake.TH

Bioshake.TH

class Args a

class CArgs a

type a |-> b

data CmdF a

type Cmd

-------------------------------------------------------------------------------- /docs/src/Bioshake-Cluster-BWA.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Bioshake/Cluster/BWA.hs 7 | 8 | 9 | 10 |
{-# LANGUAGE FlexibleContexts      #-}
11 | {-# LANGUAGE FlexibleInstances     #-}
12 | {-# LANGUAGE MultiParamTypeClasses #-}
13 | {-# LANGUAGE TemplateHaskell       #-}
14 | {-# LANGUAGE TypeOperators         #-}
15 | module Bioshake.Cluster.BWA where
16 | 
17 | import           Bioshake
18 | import           Bioshake.Cluster.Torque
19 | import           Bioshake.Implicit
20 | import           Bioshake.Internal.BWA
21 | import           Bioshake.TH
22 | import           Development.Shake
23 | 
24 | $(makeCluster ''Align [''Referenced, ''IsFastQ] 'buildBWA)
25 | 
26 | 27 | -------------------------------------------------------------------------------- /docs/src/Bioshake-Cluster-Bedtools.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Bioshake/Cluster/Bedtools.hs 7 | 8 | 9 | 10 |
{-# LANGUAGE FlexibleContexts      #-}
11 | {-# LANGUAGE FlexibleInstances     #-}
12 | {-# LANGUAGE MultiParamTypeClasses #-}
13 | {-# LANGUAGE TemplateHaskell       #-}
14 | module Bioshake.Cluster.Bedtools where
15 | 
16 | import           Bioshake
17 | import           Bioshake.Cluster.Torque
18 | import           Bioshake.Internal.Bedtools
19 | import           Bioshake.TH
20 | import           Development.Shake
21 | import           Development.Shake.FilePath
22 | 
23 | $(makeSingleCluster ''CaptureOnly [''Capture, ''IsVCF] 'buildBedtoolsCaptureOnly)
24 | 
25 | 26 | -------------------------------------------------------------------------------- /docs/src/Bioshake-ADTEx.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Bioshake/ADTEx.hs 7 | 8 | 9 | 10 |
{-# LANGUAGE FlexibleInstances     #-}
11 | {-# LANGUAGE MultiParamTypeClasses #-}
12 | {-# LANGUAGE TemplateHaskell       #-}
13 | module Bioshake.ADTEx where
14 | 
15 | import           Bioshake
16 | import           Bioshake.Internal.ADTEx
17 | import           Bioshake.TH
18 | import           Data.List
19 | import           Development.Shake
20 | import           Development.Shake.FilePath
21 | 
22 | $(makeSingleThread ''Call [''Capture, ''IsBam, ''DeDuped] 'buildADTEx)
23 | {- $call Call CNVs for whole exomes using ADTEx. Expects deduplicated BAM files as input, and a capture region. -}
24 | 
25 | 26 | -------------------------------------------------------------------------------- /docs/src/Bioshake-FREEC.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Bioshake/FREEC.hs 7 | 8 | 9 | 10 |
{-# LANGUAGE FlexibleContexts      #-}
11 | {-# LANGUAGE FlexibleInstances     #-}
12 | {-# LANGUAGE MultiParamTypeClasses #-}
13 | {-# LANGUAGE TemplateHaskell       #-}
14 | module Bioshake.FREEC where
15 | 
16 | import           Bioshake
17 | import           Bioshake.Internal.FREEC
18 | import           Bioshake.TH
19 | import           Data.List
20 | import           Development.Shake
21 | import           Development.Shake.FilePath
22 | 
23 | $(makeThreaded ''CNVExome [''Referenced, ''Capture, ''IsMPileup] 'buildFREECExome)
24 | {- $CNVExome CNV calling on exomes using FREEC -}
25 | 
26 | 27 | -------------------------------------------------------------------------------- /Bioshake/Internal/Samtools.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE DataKinds #-} 2 | {-# LANGUAGE FlexibleContexts #-} 3 | {-# LANGUAGE FlexibleInstances #-} 4 | {-# LANGUAGE GADTs #-} 5 | {-# LANGUAGE KindSignatures #-} 6 | {-# LANGUAGE MultiParamTypeClasses #-} 7 | {-# LANGUAGE ScopedTypeVariables #-} 8 | {-# LANGUAGE TemplateHaskell #-} 9 | {-# LANGUAGE TypeOperators #-} 10 | {-# LANGUAGE ViewPatterns #-} 11 | module Bioshake.Internal.Samtools where 12 | 13 | import Bioshake 14 | import Bioshake.TH 15 | import Control.Monad.Trans (lift) 16 | import Data.Proxy 17 | import Development.Shake 18 | import Development.Shake.FilePath 19 | import GHC.TypeLits 20 | 21 | class MS c 22 | 23 | data Sam2Bam c = Sam2Bam c deriving Show 24 | data SortBam c = SortBam c deriving Show 25 | data NameSortBam c = NameSortBam c deriving Show 26 | data FixMates c = FixMates c deriving Show 27 | data MarkDups c = MarkDups c deriving Show 28 | data MappedOnly c = MappedOnly c deriving Show 29 | data Pileup c = Pileup c deriving Show 30 | data AddRGLine c = AddRGLine c String deriving Show 31 | data BedCov c = BedCov c deriving Show 32 | 33 | buildAddRGLine (AddRGLine _ name) (paths -> [input]) [out] = 34 | run "samtools addreplacerg" 35 | ["-r", concat ["'ID:", name, "\tSM:", name, "'"]] 36 | input 37 | ["-o", out] 38 | "-O bam" 39 | 40 | $(makeSingleTypes ''AddRGLine [''IsBam, ''HasRG] [''NameSorted, ''Sorted, ''MS]) 41 | 42 | buildSortBam t _ (paths -> [input]) [out] = 43 | run "samtools sort" [input] ["-@", show t] ["-o", out] 44 | 45 | $(makeSingleTypes ''SortBam [''IsBam, ''Sorted] [''MS]) 46 | 47 | buildNameSortBam t _ (paths -> [input]) [out] = 48 | run "samtools sort -n" [input] ["-@", show t] ["-o", out] 49 | 50 | $(makeSingleTypes ''NameSortBam [''IsBam, ''NameSorted] [''MS]) 51 | 52 | buildSam2Bam t _ (paths -> [input]) [out] = 53 | run "samtools view -b" [input] ["-@", show t] ["-o", out] 54 | 55 | $(makeSingleTypes ''Sam2Bam [''IsBam] [''MS, ''Sorted, ''NameSorted]) 56 | 57 | buildMappedOnly t _ (paths -> [input]) [out] = 58 | run "samtools view -F 4 -b" [input] ["-@", show t] ["-o", out] 59 | 60 | $(makeSingleTypes ''MappedOnly [''IsBam] [''MS, ''Sorted, ''NameSorted]) 61 | 62 | buildPileup _ a@(paths -> inputs) [out] = 63 | run "samtools mpileup -q1 -B" ["-f", getRef a] inputs ["-o", out] 64 | 65 | $(makeSingleTypes ''Pileup [''IsMPileup] []) 66 | 67 | buildFixMates _ (paths -> [input]) [out] = 68 | run "samtools fixmate -m" [input] [out] 69 | 70 | $(makeSingleTypes ''FixMates [''IsBam, ''MS] [''NameSorted]) 71 | 72 | buildMarkDups _ (paths -> [input]) [out] = 73 | run "samtools markdup" [input] [out] 74 | 75 | $(makeSingleTypes ''MarkDups [''IsBam, ''DupsMarked] [''Sorted, ''MS]) 76 | 77 | buildBedCov _ a@(paths -> inputs) [out] = do 78 | let bed = getBED a 79 | bais = map ( <.> "bai" ) inputs 80 | lift . need $ bed : bais 81 | run "samtools bedcov" [bed] inputs ">" [out] 82 | 83 | $(makeSingleTypes ''BedCov [''IsCov] []) 84 | -------------------------------------------------------------------------------- /docs/src/Bioshake-Cluster-ADTEx.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Bioshake/Cluster/ADTEx.hs 7 | 8 | 9 | 10 |
{-# LANGUAGE FlexibleContexts      #-}
11 | {-# LANGUAGE FlexibleInstances     #-}
12 | {-# LANGUAGE MultiParamTypeClasses #-}
13 | {-# LANGUAGE TemplateHaskell       #-}
14 | module Bioshake.Cluster.ADTEx where
15 | 
16 | import           Bioshake
17 | import           Bioshake.Cluster.Torque
18 | import           Bioshake.Internal.ADTEx
19 | import           Bioshake.TH
20 | import           Data.List
21 | import           Development.Shake
22 | import           Development.Shake.FilePath
23 | 
24 | $(makeSingleCluster ''Call [''Capture, ''IsBam, ''DeDuped] 'buildADTEx)
25 | 
26 | 27 | -------------------------------------------------------------------------------- /docs/src/Bioshake-Cluster-FREEC.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Bioshake/Cluster/FREEC.hs 7 | 8 | 9 | 10 |
{-# LANGUAGE FlexibleContexts      #-}
11 | {-# LANGUAGE FlexibleInstances     #-}
12 | {-# LANGUAGE MultiParamTypeClasses #-}
13 | {-# LANGUAGE TemplateHaskell       #-}
14 | module Bioshake.Cluster.FREEC where
15 | 
16 | import           Bioshake
17 | import           Bioshake.Cluster.Torque
18 | import           Bioshake.Internal.FREEC
19 | import           Bioshake.TH
20 | import           Data.List
21 | import           Development.Shake
22 | import           Development.Shake.FilePath
23 | 
24 | $(makeCluster ''CNVExome [''Referenced, ''Capture, ''IsMPileup] 'buildFREECExome)
25 | 
26 | 27 | -------------------------------------------------------------------------------- /Bioshake/Types.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleContexts #-} 2 | {-# LANGUAGE GADTs #-} 3 | {-# LANGUAGE TypeOperators #-} 4 | {-# LANGUAGE UndecidableInstances #-} 5 | 6 | -- | Core data types the pipeline abstraction. 7 | module Bioshake.Types where 8 | 9 | import Control.Monad 10 | import Control.Monad.Trans 11 | import Control.Monad.Trans.State.Strict 12 | import Data.Reflection 13 | import qualified Data.Set as S 14 | import Data.String 15 | import Development.Shake 16 | 17 | -- | Pipes output of stage a into stage b, i.e., forms a pipeline. 18 | data a :-> b where (:->) :: a -> b -> a :-> b 19 | infixl 1 :-> 20 | 21 | -- | Buildable abstracts things that can be turned into shake 'Action's. 22 | class Buildable a where 23 | build :: Given Resource => a -> Action () 24 | 25 | -- | The compiler tracks the set of output files to ensure duplicate 'Rules' are 26 | -- not generated. This allows multiple potentially overlapping pipelines to be 27 | -- compiled down to a set of unique 'Rules'. 28 | type Compiler = StateT (S.Set [FilePath]) Rules 29 | 30 | -- | Compile pipelines to 'Rules'. 31 | compileRules :: Compiler () -> Rules () 32 | compileRules p = evalStateT p mempty 33 | 34 | -- | Pipelines are 'Compilable' when they can be compiled down to a set of 35 | -- 'Rules' that build a list of output paths. 36 | class Compilable a where 37 | compile :: Given Resource => a -> Compiler () 38 | compile = return $ return mempty 39 | 40 | compileAndWant :: (Pathable a, Compilable a, Given Resource) => a -> Compiler () 41 | compileAndWant a = do 42 | compile a 43 | lift $ want (paths a) 44 | 45 | -- | A pipeline @a :-> b@ is 'Compilable' to 'Rules' if @a@ is 'Compilable' and 46 | -- we can generate an 'Action' to build @a:->b@ (i.e., @a:->b@ is 'Buildable'). 47 | -- This generates a 'Rules' which builds the 'paths' of @a:->b@ and 'need's the 48 | -- 'paths' of @a@. 49 | instance (Pathable a, Pathable (a :-> b), Compilable a, Buildable (a :-> b)) => Compilable (a :-> b) where 50 | compile pipe@(a :-> b) = do 51 | let outs = paths pipe 52 | set <- get 53 | when (outs `S.notMember` set) $ do 54 | lift $ outs &%> \_ -> do 55 | need (paths a) 56 | build pipe 57 | put (outs `S.insert` set) 58 | compile a 59 | 60 | -- | Things are pathable if they can be mapped to a list of file paths. This is 61 | -- used to make the files for a stage concrete in the build system. 62 | class Pathable a where 63 | paths :: a -> [FilePath] 64 | 65 | instance (Show a, Show b) => Show (a :-> b) where show (a :-> b) = show a ++ " :-> " ++ show b 66 | 67 | -- Nucleotides 68 | data Nuc = A | C | G | T 69 | deriving (Eq, Show) 70 | newtype Seq = Seq [Nuc] 71 | deriving Eq 72 | 73 | instance Show Seq where 74 | show (Seq s) = concatMap show s 75 | 76 | instance IsString Seq where 77 | fromString str = Seq $ map parse str 78 | where 79 | parse 'A' = A 80 | parse 'C' = C 81 | parse 'G' = G 82 | parse 'T' = T 83 | parse 'a' = A 84 | parse 'c' = C 85 | parse 'g' = G 86 | parse 't' = T 87 | parse _ = error "cannot parse nucleotide" 88 | 89 | -- For threaded config 90 | data Threads = Threads Int deriving Show 91 | -------------------------------------------------------------------------------- /docs/mini_Bioshake-Tags.html: -------------------------------------------------------------------------------- 1 | Bioshake.Tags

Bioshake.Tags

class DeDuped a

class HasRG a

class PairedEnd a

class Sorted a

class IsBam a

class IsBcf a

class IsBed a

class IsCSV a

class IsFastQ a

class IsGff a

class IsMPileup a

class IsSam a

class IsSeqzGZ a

class IsTSV a

class IsVCF a

class IsTGZ a

class IsCov a

-------------------------------------------------------------------------------- /docs/src/Bioshake-Sequenza.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Bioshake/Sequenza.hs 7 | 8 | 9 | 10 |
{-# LANGUAGE FlexibleInstances     #-}
11 | {-# LANGUAGE MultiParamTypeClasses #-}
12 | {-# LANGUAGE TemplateHaskell       #-}
13 | module Bioshake.Sequenza (pileup2Seqz, bin, GC(..)) where
14 | 
15 | import           Bioshake
16 | import           Bioshake.Internal.Sequenza
17 | import           Bioshake.TH
18 | import           Data.List
19 | import           Development.Shake
20 | import           Development.Shake.FilePath
21 | 
22 | $(makeSingleThread ''Pileup2Seqz [''IsMPileup, ''GC] 'buildPileup2Seqz)
23 | $(makeSingleThread ''Bin [''IsSeqzGZ] 'buildBin)
24 | 
25 | 26 | -------------------------------------------------------------------------------- /docs/src/Bioshake-Cluster-Varscan.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Bioshake/Cluster/Varscan.hs 7 | 8 | 9 | 10 |
{-# LANGUAGE FlexibleContexts      #-}
11 | {-# LANGUAGE FlexibleInstances     #-}
12 | {-# LANGUAGE MultiParamTypeClasses #-}
13 | {-# LANGUAGE TemplateHaskell       #-}
14 | {-# LANGUAGE TypeOperators         #-}
15 | module Bioshake.Cluster.Varscan where
16 | 
17 | import           Bioshake
18 | import           Bioshake.Cluster.Torque
19 | import           Bioshake.Internal.Varscan
20 | import           Bioshake.TH
21 | import           Data.List
22 | import           Development.Shake
23 | import           Development.Shake.FilePath
24 | 
25 | $(makeSingleCluster ''CallSomatic [''IsMPileup] 'buildVarscan)
26 | $(makeSingleCluster ''CopyNumber [''IsMPileup] 'buildCopyNumber)
27 | 
28 | 29 | -------------------------------------------------------------------------------- /docs/src/Bioshake-SnpEff.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Bioshake/SnpEff.hs 7 | 8 | 9 | 10 |
{-# LANGUAGE FlexibleInstances     #-}
11 | {-# LANGUAGE FlexibleContexts     #-}
12 | {-# LANGUAGE MultiParamTypeClasses #-}
13 | {-# LANGUAGE TemplateHaskell       #-}
14 | module Bioshake.SnpEff where
15 | 
16 | import           Bioshake
17 | import           Bioshake.Internal.SnpEff
18 | import           Bioshake.TH
19 | import           Data.List
20 | import           Development.Shake
21 | import           Development.Shake.FilePath
22 | 
23 | $(makeSingleThread ''Annotate [''Referenced, ''IsVCF] 'buildAnnot)
24 | {- $Annotate Annotate using snpEFF -}
25 | $(makeSingleThread ''DBNSFP [''Referenced, ''IsVCF, ''SnpEffAnnotated] 'buildDBNSFP)
26 | {- $Annotate Annotate with DBNSFP using snpEFF. -}
27 | 
28 | 29 | -------------------------------------------------------------------------------- /docs/src/Bioshake-Varscan.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Bioshake/Varscan.hs 7 | 8 | 9 | 10 |
{-# LANGUAGE TypeOperators #-}
11 | {-# LANGUAGE FlexibleInstances     #-}
12 | {-# LANGUAGE MultiParamTypeClasses #-}
13 | {-# LANGUAGE TemplateHaskell       #-}
14 | module Bioshake.Varscan where
15 | 
16 | import           Bioshake
17 | import           Bioshake.Internal.Varscan
18 | import           Bioshake.TH
19 | import           Data.List
20 | import           Development.Shake
21 | import           Development.Shake.FilePath
22 | 
23 | $(makeSingleThread ''CallSomatic [''IsMPileup] 'buildVarscan)
24 | $(makeSingleThread ''CopyNumber [''IsMPileup] 'buildCopyNumber)
25 | 
26 | --callSomatic :: CallSomatic ()
27 | --callSomatic = CallSomatic ()
28 | --
29 | --instance IsMPileup a => Buildable (a :-> CallSomatic ()) where
30 | --  build pipe@(a :-> b) =
31 | --    let outs = paths pipe in
32 | --      withCmd 1 $ buildVarscan b a outs
33 | 
34 | 35 | -------------------------------------------------------------------------------- /docs/src/Bioshake-Cluster-SnpEff.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Bioshake/Cluster/SnpEff.hs 7 | 8 | 9 | 10 |
{-# LANGUAGE FlexibleInstances     #-}
11 | {-# LANGUAGE FlexibleContexts     #-}
12 | {-# LANGUAGE MultiParamTypeClasses #-}
13 | {-# LANGUAGE TemplateHaskell       #-}
14 | module Bioshake.Cluster.SnpEff where
15 | 
16 | import           Bioshake
17 | import           Bioshake.Cluster.Torque
18 | import           Bioshake.Internal.SnpEff
19 | import           Bioshake.TH
20 | import           Data.List
21 | import           Development.Shake
22 | import           Development.Shake.FilePath
23 | 
24 | $(makeSingleCluster ''Annotate [''Referenced, ''IsVCF] 'buildAnnot)
25 | $(makeSingleCluster ''DBNSFP [''Referenced, ''IsVCF, ''SnpEffAnnotated] 'buildDBNSFP)
26 | 
27 | 28 | -------------------------------------------------------------------------------- /Bioshake/Internal/Kallisto.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleContexts #-} 2 | {-# LANGUAGE FlexibleInstances #-} 3 | {-# LANGUAGE GADTs #-} 4 | {-# LANGUAGE StandaloneDeriving #-} 5 | {-# LANGUAGE TemplateHaskell #-} 6 | {-# LANGUAGE TypeOperators #-} 7 | {-# LANGUAGE ViewPatterns #-} 8 | module Bioshake.Internal.Kallisto where 9 | 10 | import Bioshake 11 | import Bioshake.TH 12 | import Control.Monad 13 | import Control.Monad.Trans (lift) 14 | import Data.List 15 | import Development.Shake 16 | import Development.Shake.FilePath 17 | import System.Posix.Files (createLink, rename) 18 | 19 | class IsKal c 20 | instance IsKal c => IsKal (c :-> Out) 21 | 22 | data Quant c = Quant c [QuantOpts] deriving Show 23 | data QuantSingle c = QuantSingle c [QuantOpts] deriving Show 24 | 25 | data QuantOpts where 26 | Bootstrap :: Int -> QuantOpts 27 | Seed :: Int -> QuantOpts 28 | FragmentLength :: Double -> QuantOpts 29 | FragmentSD :: Double -> QuantOpts 30 | Single :: QuantOpts 31 | Fusion :: QuantOpts 32 | 33 | deriving instance Eq QuantOpts 34 | 35 | instance Show QuantOpts where 36 | show (Bootstrap n) = "--bootstrap-samples=" ++ show n 37 | show (Seed s) = "--seed=" ++ show s 38 | show (FragmentLength d) = "--fragment-length=" ++ show d 39 | show (FragmentSD d) = "--sd=" ++ show d 40 | show Single = "--single" 41 | show Fusion = "--fusion" 42 | 43 | bootstrap x = if x > 1 then Bootstrap x else error "Kallisto: need positive number of bootstrap samples" 44 | fragmentLength x = if x > 0 then FragmentLength x else error "Kallisto: fragment length must be positive" 45 | fragmentSD x = if x > 0 then FragmentSD x else error "Kallisto: fragment SD must be positive" 46 | seed = Seed 47 | fusion = Fusion 48 | 49 | hasFragmentSD [] = False 50 | hasFragmentSD (FragmentSD _ : _) = True 51 | hasFragmentSD (_:xs) = hasFragmentSD xs 52 | 53 | hasFragmentLength [] = False 54 | hasFragmentLength (FragmentLength _ : _) = True 55 | hasFragmentLength (_:xs) = hasFragmentLength xs 56 | 57 | hasFusion xs = Fusion `elem` xs 58 | 59 | buildKallisto t (Quant _ opts) a@(paths -> inputs@[_,_]) [out] = 60 | let idx = getRef a <.> "idx" in 61 | buildKallisto' t opts idx inputs out 62 | 63 | buildKallistoSingle t (QuantSingle _ opts) a@(paths -> [input]) [out] = 64 | let idx = getRef a <.> "idx" in 65 | buildKallisto' t (Single : opts) idx [input] out 66 | 67 | buildKallisto' t opts idx inputs out = do 68 | lift $ need [idx] 69 | withTempDirectory' "tmp" "kallisto" $ \tmpDir -> do 70 | () <- run "kallisto quant" 71 | ["-i", idx] 72 | ["-o", tmpDir] 73 | ["-t", show t] 74 | (map show opts) 75 | inputs 76 | run "tar" 77 | ["-C", tmpDir] 78 | ["-cf", out] 79 | "." 80 | 81 | $(makeSingleTypes ''Quant [''IsKal] []) 82 | $(makeSingleTypes ''QuantSingle [''IsKal] []) 83 | 84 | data Abundance c = Abundance c deriving Show 85 | 86 | buildAbundance _ (paths -> [input]) [out] = do 87 | withTempDirectory' "tmp" "kallisto" $ \tmpDir -> do 88 | () <- run "tar" 89 | ["-C", tmpDir] 90 | ["-xf", input] 91 | lift $ copyFile' (tmpDir "abundance.tsv") out 92 | 93 | $(makeSingleTypes ''Abundance [''IsTSV] []) 94 | 95 | class IsFusion c 96 | instance IsFusion c => IsFusion (c :-> Out) 97 | data Fusions c = Fusions c deriving Show 98 | 99 | buildFusions _ (paths -> [input]) [out] = do 100 | withTempDirectory' "tmp" "kallisto" $ \tmpDir -> do 101 | () <- run "tar" 102 | ["-C", tmpDir] 103 | ["-xf", input] 104 | lift $ copyFile' (tmpDir "fusion.txt") out 105 | 106 | $(makeSingleTypes ''Fusions [''IsFusion] []) 107 | -------------------------------------------------------------------------------- /docs/src/Bioshake-Cluster-Sequenza.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Bioshake/Cluster/Sequenza.hs 7 | 8 | 9 | 10 |
{-# LANGUAGE FlexibleContexts      #-}
11 | {-# LANGUAGE FlexibleInstances     #-}
12 | {-# LANGUAGE MultiParamTypeClasses #-}
13 | {-# LANGUAGE TemplateHaskell       #-}
14 | module Bioshake.Cluster.Sequenza (pileup2Seqz, bin, GC(..)) where
15 | 
16 | import           Bioshake
17 | import           Bioshake.Cluster.Torque
18 | import           Bioshake.Internal.Sequenza
19 | import           Bioshake.TH
20 | import           Data.List
21 | import           Development.Shake
22 | import           Development.Shake.FilePath
23 | 
24 | $(makeSingleCluster ''Pileup2Seqz [''IsMPileup, ''GC] 'buildPileup2Seqz)
25 | $(makeSingleCluster ''Bin [''IsSeqzGZ] 'buildBin)
26 | 
27 | 28 | -------------------------------------------------------------------------------- /Bioshake/Cluster/Torque.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleContexts #-} 2 | {-# LANGUAGE FlexibleInstances #-} 3 | {-# LANGUAGE GADTs #-} 4 | {-# LANGUAGE TypeOperators #-} 5 | {-# LANGUAGE TypeSynonymInstances #-} 6 | module Bioshake.Cluster.Torque where 7 | 8 | import Control.Monad 9 | import Data.Either 10 | import Data.List 11 | import qualified Data.Map as M 12 | import Data.Maybe 13 | import Development.Shake hiding (doesFileExist) 14 | import Development.Shake.FilePath 15 | import System.Directory (copyFile, doesFileExist, 16 | getCurrentDirectory) 17 | import System.IO.Temp 18 | import System.Posix.Files 19 | 20 | type ModuleName = String 21 | type Queue = String 22 | 23 | data TOption = Mem Int 24 | | CPUs Int 25 | | Walltime Int 26 | | Queue String 27 | | Module ModuleName 28 | | TStdout FilePath 29 | deriving (Eq, Show) 30 | 31 | newtype Config = Config [TOption] 32 | deriving Show 33 | --instance Default Config where def = Config [Queue "large", Mem (gb 10), CPUs 1] 34 | 35 | getCPUs :: Config -> Int 36 | getCPUs (Config ts) = foldl getCPUs' 1 ts 37 | where 38 | getCPUs' _ (CPUs n) = n 39 | getCPUs' n _ = n 40 | 41 | class TArgs a where cmdArgs :: [Either TOption String] -> a 42 | instance (Args a, TArgs r) => TArgs (a -> r) where cmdArgs a r = cmdArgs $ a ++ args r 43 | 44 | instance TArgs (Action ()) where cmdArgs = liftIO . cmdArgs 45 | instance TArgs (IO ()) where 46 | cmdArgs args = withTempDirectory "." "qsub" $ \tmpDir -> do 47 | let scriptfile = tmpDir "run.sh" 48 | okfile = tmpDir "run.sh.ok" 49 | writeFile scriptfile $ script okfile 50 | setFileMode scriptfile 0o755 51 | cwd <- getCurrentDirectory 52 | unit $ cmd Shell "qsub -I -d" [cwd] stdout resflags "-x" [scriptfile] 53 | ok <- doesFileExist okfile 54 | unless ok . error $ "job failed: " ++ exec 55 | return () 56 | where 57 | script ok = unlines $ ["#!/bin/sh", "set -e"] 58 | ++ map ("module add "++) modules 59 | ++ [unwords [exec, "&& touch ", ok]] 60 | 61 | modules = map unModule $ filter isModule options 62 | options = lefts args 63 | isModule (Module _) = True 64 | isModule _ = False 65 | unModule (Module a) = a 66 | 67 | isStdout (TStdout _) = True 68 | isStdout _ = False 69 | unStdout (TStdout path) = FileStdout path 70 | stdout = unStdout <$> find isStdout options 71 | 72 | exec = unwords $ rights args 73 | dedupOpts = M.elems . M.fromList $ mapMaybe key options 74 | where 75 | key a@(Mem _) = Just ("mem", a) 76 | key a@(CPUs _) = Just ("cpus", a) 77 | key a@(Queue _) = Just ("queue", a) 78 | key _ = Nothing 79 | resflags = unwords $ map toFlag dedupOpts 80 | where 81 | toFlag (Mem n) = "-l mem=" ++ show n 82 | toFlag (CPUs n) = "-l nodes=1:ppn=" ++ show n 83 | toFlag (Queue name) = "-q " ++ name 84 | toFlag _ = [] 85 | 86 | class Args a where args :: a -> [Either TOption String] 87 | instance Args String where args = map Right . words 88 | instance Args [String] where args = map Right 89 | instance Args TOption where args = return . Left 90 | instance Args Config where args (Config ls) = map Left ls 91 | instance (Args a, Args b) => Args (Either a b) where args = either args args 92 | instance (Args a, Args b) => Args [Either a b] where args = concatMap args 93 | 94 | type a |-> b = a 95 | 96 | submit :: TArgs a => a |-> Action () 97 | submit = cmdArgs [] 98 | 99 | gb :: Num a => a -> a 100 | gb = (*1024) 101 | 102 | --------------------------------------------------------------------------------