Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
olgabot opened this issue Feb 25, 2019 · 1 comment
Closed

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

olgabot opened this issue Feb 25, 2019 · 1 comment

Comments

@olgabot
Copy link
Contributor

olgabot commented Feb 25, 2019

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
Copy link
Collaborator

prasadgopal commented Feb 25, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants