> Why not just writing [zip]?

Because in Python we need only this: 
    
    
    RCMAP = dict(zip("ACGTacgtNn-","TGCAtgcaNn-"))
    

So now I have a sequence of tuples of char. I can construct a table via the 
"pairs" constructor. And I can view it. 
    
    
    proc charSeq(s: string): seq[char] =
      result = newSeq[char](s.len)
      for i in 0 .. s.high:
        result[i] = s[i]
    const
      dna_norm = "ACGTacgtNn-"
      dna_comp = "TGCAtgcaNn-"
      rclist = sequtils.zip(charSeq(dna_norm), charSeq(dna_comp))
    var
      rcmap = tables.newTable(rclist) # cannot be const
    #echo(rclist)
    echo(rcmap)
    
    
    
        {A: T, a: t, C: G, c: g, G: C, g: c, -: -, N: N, n: n, T: A, t: a}
    

But how can I serialize it to JSON? The `%*` macro is not working. 
    
    
    import json
    ...
    var j = %* rcmap[]
    
    
    
    
        graph_to_utgs.nim(20, 9) template/generic instantiation from here
        lib/pure/json.nim(729, 42) Error: undeclared field: 'data'
    

Any ideas?

Reply via email to