| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Bioshake.Cluster.BWA
├── 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.ADTEx
Bioshake.FREEC
Bioshake.Cutadapt
Bioshake.Platypus
Bioshake.Bedtools
Bioshake.Cluster.BWA
Bioshake.Cluster.ADTEx
Bioshake.Cluster.FREEC
Bioshake.Cluster.Cutadapt
Bioshake.Cluster.Platypus
Bioshake.Cluster.Bedtools
Bioshake.SnpEff
Bioshake.Varscan
Bioshake.Cluster.SnpEff
Bioshake.Cluster.Varscan
Bioshake.Picard
Bioshake.Sequenza
Bioshake.Cluster.Picard
Bioshake.Cluster.Sequenza
Bioshake.Implicit
Bioshake.Samtools
Bioshake.Cluster.Samtools
bioshake-0.1.0.0: Bioinformatics pipelines with shake
| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Bioshake.Cluster.BWA
bioshake-0.1.0.0: Bioinformatics pipelines with shake
| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Bioshake.Cluster.ADTEx
bioshake-0.1.0.0: Bioinformatics pipelines with shake
| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Bioshake.Cluster.FREEC
bioshake-0.1.0.0: Bioinformatics pipelines with shake
| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Bioshake.Cluster.Platypus
Bioshake
bioshake-0.1.0.0: Bioinformatics pipelines with shake
| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Bioshake.Varscan
bioshake-0.1.0.0: Bioinformatics pipelines with shake
| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Bioshake.Cluster.Bedtools
bioshake-0.1.0.0: Bioinformatics pipelines with shake
| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Bioshake.Cluster.Cutadapt
bioshake-0.1.0.0: Bioinformatics pipelines with shake
| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Bioshake.ADTEx
bioshake-0.1.0.0: Bioinformatics pipelines with shake
| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Bioshake.Bedtools
captureOnly :: CaptureOnly () Source #
Reduces VCF files to the capture region only using bedtools.
Bioshake.Types
data a :-> b
class Buildable a
type Compiler
class Compilable a
class Pathable a
data Nuc
data Seq
data Threads
bioshake-0.1.0.0: Bioinformatics pipelines with shake
| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Bioshake.Cutadapt
bioshake-0.1.0.0: Bioinformatics pipelines with shake
| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Bioshake.Cluster.SnpEff
Bioshake.Cluster.Torque
bioshake-0.1.0.0: Bioinformatics pipelines with shake
| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Bioshake.BWA
bioshake-0.1.0.0: Bioinformatics pipelines with shake
| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Bioshake.FREEC
bioshake-0.1.0.0: Bioinformatics pipelines with shake
| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Bioshake.SnpEff
bioshake-0.1.0.0: Bioinformatics pipelines with shake
| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Bioshake.Platypus
bioshake-0.1.0.0: Bioinformatics pipelines with shake
| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Bioshake.Cluster.Varscan
{-# 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-0.1.0.0: Bioinformatics pipelines with shake
| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Bioshake.Picard
bioshake-0.1.0.0: Bioinformatics pipelines with shake
| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Bioshake.Cluster.Picard
{-# 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 |
{-# 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 |
{-# 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 |
{-# 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 |
{-# 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
{-# 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 |
{-# 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 |
{-# 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 |
{-# 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 |
{-# 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 |
{-# 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
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
{-# 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 |
{-# 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 |
{-# 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 |
{-# 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 |
{-# 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 |
{-# 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 | --------------------------------------------------------------------------------