grailbio / reflow

A language and runtime for distributed, incremental data processing in the cloud
Apache License 2.0
965 stars 52 forks source link

What is wrong with this "else if" statement? #108

Closed olgabot closed 5 years ago

olgabot commented 5 years ago

Hello, I'm trying to write a workflow that executes the following logic:

  1. If method == "minhash", run sourmash.CompareFastqs
  2. Else If molecule == "protein" --> fail because only sourmash supports "protein"
  3. Else If method == "hyperloglog", run dashing.CompareFastqs with distance := "dist"
  4. Else If method == "truejaccard", run dashing.CompareFastqs with distance := "truejaccard"
  5. Fail because the method and molecule are not supported.

Constructing this conditional has been tricky so far. Here's the relevant code snippet:

val matrix = if method == "minhash" {
  sourmash.CompareFastqs(reads, names, molecule, log2_sketch_size, ksize, threads)
  } else if molecule == "protein" {
      panic("Molecule 'protein' is currently only supported by 'minhash' "+
        "method, not 'hyperloglog' or 'truejaccard'")
  } else if method == "hyperloglog" {
    distance := "dist"
    dashing.CompareFastqs(reads, names, log2_sketch_size, ksize, threads, distance)
  } else if method == "truejaccard" {
    distance := "setdist"
    dashing.CompareFastqs(reads, names, log2_sketch_size, ksize, threads, distance)
  } else {
    panic("Method '" + method + "' is not currenly supported. Please "+ 
      "use either 'minhash', 'hyperloglog', or 'truejaccard'")
  }

And here's the error:

(base)
 ✘  Mon 25 Feb - 12:05  ~/code/kmer-hashing/reflow   origin ☊ olgabot/dashing ↑2 15☀ 1● 
  reflow doc compare_fastqs.rf
compare_fastqs.rf:60:12: syntax error: unexpected tokIf, expecting '{'

(this is the } else if molecule == "protein" { line)

screen shot 2019-02-25 at 12 10 40 pm

Can you spot the error? It seems like it should be really simple but my eyes just don't catch it.

Warmest, Olga

prasadgopal commented 5 years ago

We did not make a new github release after adding else if. reflow0.6.8 was made in August. Let me get that going.

On Mon, Feb 25, 2019 at 12:11 PM Olga Botvinnik notifications@github.com wrote:

Hello, I'm trying to write a workflow that executes the following logic:

  1. If method == "minhash", run sourmash.CompareFastqs
  2. Else If molecule == "protein" --> fail because only sourmash supports "protein"
  3. Else If method == "hyperloglog", run dashing.CompareFastqs with distance := "dist"
  4. Else If method == "truejaccard", run dashing.CompareFastqs with distance := "truejaccard"
  5. Fail because the method and molecule are not supported.

Constructing this conditional has been tricky so far. Here's the relevant code snippet:

val matrix = if method == "minhash" {

sourmash.CompareFastqs(reads, names, molecule, log2_sketch_size, ksize, threads)

} else if molecule == "protein" {

  panic("Molecule 'protein' is currently only supported by 'minhash' "+

    "method, not 'hyperloglog' or 'truejaccard'")

} else if method == "hyperloglog" {

distance := "dist"

dashing.CompareFastqs(reads, names, log2_sketch_size, ksize, threads, distance)

} else if method == "truejaccard" {

distance := "setdist"

dashing.CompareFastqs(reads, names, log2_sketch_size, ksize, threads, distance)

} else {

panic("Method '" + method + "' is not currenly supported. Please "+

  "use either 'minhash', 'hyperloglog', or 'truejaccard'")

}

And here's the error:

(base)

✘  Mon 25 Feb - 12:05  ~/code/kmer-hashing/reflow   origin ☊ olgabot/dashing ↑2 15☀ 1● 

 reflow doc compare_fastqs.rf

compare_fastqs.rf:60:12: syntax error: unexpected tokIf, expecting '{'

(this is the } else if molecule == "protein" { line)

[image: screen shot 2019-02-25 at 12 10 40 pm] https://user-images.githubusercontent.com/806256/53365562-6b9be580-38f6-11e9-8c40-6f26b66830c5.png

Can you spot the error? It seems like it should be really simple but my eyes just don't catch it.

Warmest, Olga

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/grailbio/reflow/issues/108, or mute the thread https://github.com/notifications/unsubscribe-auth/AfC0Q0XBbma_Ouim32yii-sA8zENBsGlks5vREN1gaJpZM4bQsE9 .

--

This email message, including attachments, may contain private, proprietary, or privileged information and is the confidential information and/or property of GRAIL, Inc., and is for the sole use of the intended recipient(s). Any unauthorized review, use, disclosure or distribution is strictly prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.