seq-lang / seq

A high-performance, Pythonic language for bioinformatics
https://seq-lang.org
Apache License 2.0
697 stars 50 forks source link

Example not working #244

Closed chklopp closed 2 years ago

chklopp commented 2 years ago

I have the same issue as #218 and the correction generates another error :

dna = s'ACGTACGTACGT'  # sequence literal

# (a) split into subsequences of length 3
#     with a stride of 2
dna |> split(..., 3, 2) |> echo

# (b) split into 5-mers with stride 1
def f(kmer):
    print kmer
    print ~kmer

dna |> kmers[Kmer[5]](1) |> f

produces :

kmer2.py:5:8: error: identifier 'split' not found

If i add

from bio import *

at the top, I get :

kmer2.py:13:8: error: cannot find 'getitem' in std.bio.builtin.kmers[seq,int,k]

markhend commented 2 years ago

Hi @chklopp - Thanks for reaching out. With version v0.11.0 we updated the syntax for calling some built-in functions, including kmers, to be more pythonic. You can check your version with seqc --version. The last line would now be: dna |> kmers(k=5, step=1) |> f

We've updated the docs as well: https://docs.seq-lang.org/tutorial/tutorial.html#pipelines

chklopp commented 2 years ago

Works! Thank you.