These are chat archives for nextflow-io/nextflow

5th
Jan 2018
Paolo Di Tommaso
@pditommaso
Jan 05 2018 14:43
I've created a basic nextflow syntax highlighter for Atom starting from the groovy package
any contribution is welcomed
Evan Floden
@evanfloden
Jan 05 2018 14:46
Looks like a good excuse to try Atom then :+1:
Paolo Di Tommaso
@pditommaso
Jan 05 2018 14:46
one of the best out there
Alexander Peltzer
@apeltzer
Jan 05 2018 15:04

Hi everyone! Anbody an idea how I could do this more nicely?

def avail_mem = task.memory == null ? '' : "-m ${Math.floor(task.memory.toBytes() / task.cpus)}"

I want to define in samtools sort the parameter -m <X> for memory per thread. thats why I take the task.memory, transform to bytes and divide by CPUs. I got that specific error:

samtools sort \
      CMT_Project04172015_20150063001_S_6_bwa.sam \
      -@ 10 -m 4.29496729E8 \
      -o CMT_Project04172015_20150063001_S_6_bwa.sam.sorted.bam

Command exit status:
  1

Command output:
  (empty)

Command error:
  [bam_sort] -m setting (4 bytes) is less than the minimum required (1M).
Thought that Math.floor(double d) does the job to transform this to an integer (because I had something like 424322000.6 bytes or similar at some point, which was weird...)
Paolo Di Tommaso
@pditommaso
Jan 05 2018 15:08
try
avail_mem = task.memory ? "-m ${task.memory.toBytes().intdiv(task.cpus)}" : ''
Alexander Peltzer
@apeltzer
Jan 05 2018 15:34
I will try :-)
Edgar
@edgano
Jan 05 2018 15:39
@pditommaso :+1: