seq-lang / seq

A high-performance, Pythonic language for bioinformatics

Home Page:https://seq-lang.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Length of Kmer type from argument?

ekimb opened this issue · comments

Hey guys,

I want to take in an argument for k-mer length of the Kmer type:

len = argv[1]
type K = Kmer[len]

Is this type of syntax not supported in Seq? Didn't find any info about this in the cookbook or the examples (seems like the length is usually manually typed in?)

Hey,

In the next major release (which will be coming soon!) we'll have a lot more support for flexible Kmers. You'll be able to pass static parameters on the command line; e.g. something like --param:kmer_len=12, with Kmer[kmer_len] in the code. In the current version though they do have to be static, so I would suggest placing Kmer typedefs in a config file that can be imported.

This is a result of how Seq compiles Kmers -- they actually get compiled to the smallest integer type that can store the necessary bases (e.g. int8 for Kmer[4], int64 for Kmer[32] and so on... LLVM actually support arbitrarily wide integers).

I'll keep you posted as we prepare the next version!

Awesome, thanks!

@arshajii Any examples how it can be used with the new type system?