Skip to content

Commit

Permalink
bioinfo: added module Star
Browse files Browse the repository at this point in the history
  • Loading branch information
pveber committed Jul 19, 2019
1 parent 0f51f4b commit 6c9397e
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 0 deletions.
56 changes: 56 additions & 0 deletions lib/bioinfo/bistro_bioinfo.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2821,3 +2821,59 @@ module Idr = struct
let items x = Workflow.select x [ "items.tsv" ]
let figure x = Workflow.select x [ "items.tsv.png" ]
end

module Star = struct
let img = [ docker_image ~account:"flemoine" ~name:"star" () ]

let mem_in_bytes = seq ~sep:" " [string "$((" ; mem ; string " * 1024 * 1024))$"]

let genomeGenerate fa =
Workflow.shell ~descr:"star.index" ~np:8 ~mem:(Workflow.int (30 * 1024)) [
mkdir_p dest ;
cmd "STAR" ~img [
opt "--runThreadN" Fn.id np ;
opt "--runMode" string "genomeGenerate" ;
opt "--genomeDir" Fn.id dest ;
opt "--genomeFastaFiles" dep fa ;
opt "--limitGenomeGenerateRAM" Fn.id mem_in_bytes ;
]
]

let fq_args = function
| `paired_end (fq1, fq2) ->
[dep fq1 ; dep fq2]
| `single_end fq -> [ dep fq ]

let samStrandField = function
| `None -> string "None"
| `intronMotif -> string "intronMotif"


let sorted_mapped_reads x = Workflow.select x ["sorted.bam"]

let alignReads ?(max_mem = `GB 8)
?outFilterMismatchNmax
?outFilterMultimapNmax
?outSAMstrandField
?alignIntronMax
idx fqs =
let `GB max_mem = max_mem in
Workflow.shell ~descr:"star.map" ~np:8 ~mem:(Workflow.int (max_mem * 1024)) [
mkdir_p dest ;
cmd "STAR" ~stdout:(dest // "sorted.bam") ~img [
opt "--outFileNamePrefix" Fn.id (dest // "star") ;
opt "--runThreadN" Fn.id np ;
option (opt "--outSAMstrandField" samStrandField) outSAMstrandField ;
option (opt "--outFilterMismatchNmax" int) outFilterMismatchNmax ;
option (opt "--outFilterMultimapNmax" int) outFilterMultimapNmax ;
opt "--genomeDir" dep idx ;
opt "--readFilesIn" Fn.id (seq ~sep:" " (fq_args fqs)) ;
opt "--outSAMunmapped" string "None" ;
opt "--outStd" string "SAM" ;
opt "--genomeLoad" string "NoSharedMemory" ;
option (opt "--alignIntronMax" int) alignIntronMax ;
(* opt "--limitBAMsortRAM" Fn.id mem_in_bytes ; *)
]
]
|> sorted_mapped_reads
end
15 changes: 15 additions & 0 deletions lib/bioinfo/bistro_bioinfo.mli
Original file line number Diff line number Diff line change
Expand Up @@ -916,6 +916,21 @@ module Hisat2 : sig
sam pworkflow
end

module Star : sig
val genomeGenerate : fasta pworkflow -> [`star_index] dworkflow

val alignReads :
?max_mem:[`GB of int] ->
?outFilterMismatchNmax:int ->
?outFilterMultimapNmax:int ->
?outSAMstrandField:[`None | `intronMotif] ->
?alignIntronMax:int ->
[`star_index] dworkflow ->
[ `single_end of sanger_fastq pworkflow
| `paired_end of sanger_fastq pworkflow * sanger_fastq pworkflow ] ->
bam pworkflow
end

module Kallisto : sig
class type index = object
inherit binary_file
Expand Down

0 comments on commit 6c9397e

Please sign in to comment.