question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Small floats render in exponential notation

See original GitHub issue

I have a WDL with command block samtools view -s ${frac} -b ${bampath} -o ${outname}.bam, where frac is a Float type.

I’m running in FireCloud. Downstream, in the PAPI script, this had turned into samtools view -s 5.0E-5 -b ...<etc>, which rather confused samtools.

Someone somewhere decided to render 0.00005 as 5.0E-5, and it wasn’t me. Can you help?

(Adam N said to reference WDL draft-2, so I am hereby doing that.)

WDL follows:

task downsample {
    File bampath
    File baipath
    File refpath
    File refipath
    Float frac
    String outname
    
    Int disk_size = ceil((size(bampath, "GB") + size(refpath, "GB") + size(refipath, "GB")) * 3)

    command {
        samtools view -s ${frac} -b ${bampath} -o ${outname}.bam
    }
    
    output {
    	File outcram = "${outname}.bam"
    }

    runtime {
        docker : "mshand/genomesinthecloud:samtools.1.8"
        disks: "local-disk ${disk_size} HDD"
        memory: "4GB"
    }
}

workflow dswf {
    call downsample
}

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
pshapiro4broadcommented, Aug 29, 2018

FWIW this should workaround the issue until it’s addressed

    command {
        samtools view -s $(printf "%f" ${frac}) -b ${bampath} -o ${outname}.bam
    }
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to suppress scientific notation when printing float values?
Is there any way to suppress scientific notation and make it display as 0.00001 ? I'm going to use the result as a...
Read more >
FloatPrecision - R7RS-small
These are written by replacing the e of exponential notation with an s, f, d, ... short-floats cannot have more precision than long-floats,...
Read more >
Floating-point arithmetic - Wikipedia
In computing, floating-point arithmetic (FP) is arithmetic that represents real numbers approximately, using an integer with a fixed precision, ...
Read more >
Floating-Point Number - an overview | ScienceDirect Topics
Like scientific notation, floating-point numbers have a sign, mantissa (M), base (B), and exponent (E), as shown in Figure 5.27. For example, the...
Read more >
Simple String Representation of Java Decimal Numbers ...
While float and double had their smallest and largest numbers expressed in scientific notation, BigDecimal only does this by default for smaller ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found