seq-lang / seq

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

Is it possible calling seq from python module? #252

Closed xinrcornelia closed 2 years ago

xinrcornelia commented 2 years ago

hi, I want to call Seq's FMIndex.find() from an existing Python module (the python module is hard to translate to Seq Style). Is it possible to implement it ?

the code would be like:

@Seq
def find(s,indexPath):
    import FMIndex
    fmi = index_load(indexPath)
    a = str
    return fmi.find(a.__from_py__(s))

@python
def create_dict(FMIndexPath, freqs_table):
    #freqs_table: python dictionary
    x = 'ACGT'

    if  x not in freqs_table:
        '''
        call the function in Seq module
        '''
        freqs_table[x] = find(x)