running klustakwik separately and converting clu to kwik files

203 views
Skip to first unread message

Ovidiu Jurjut

unread,
Mar 3, 2015, 7:14:38 AM3/3/15
to klusta...@googlegroups.com
Hello Klusta Team,


I'm trying to set up KlustaSuite in our lab and would be interested to know how can I split the pipeline into steps. 

More precisely, I would like to:
1) run the spike-detection part on our lab computer (with the --detect-only parameter), then
2) copy the contents of the _klustakwik folder onto a computing cluster and run klustakwik there (like I've been doing so far), and finally
3) convert the results of klustakwik to KWIK and KWX files and perform manual sorting in KlustaViewa back on our lab computer.

As far as I understand, all these steps are executed by the 'klusta' command right now. I can run step 1 and 2 separately, but don't know how to run step 3, namely the conversion of clu to kwik files. Is there some command to do that? or how would you recommend to do this step?


Best regards,
Ovidiu
Centre for Integrative Neuroscience
University of Tübingen


PS: the reason for splitting the automated spike-sorting into steps has to do with my limited permission of installing stuff on the computing cluster. If I run everything on my lab computer it works, but I have limited RAM.
 

Max Hunter

unread,
Mar 3, 2015, 7:53:38 AM3/3/15
to Ovidiu Jurjut, klusta...@googlegroups.com
Hi,

This a reasonably standard pipeline.

Running klusta --cluster-only on the computing cluster, with the .kwik and .kwx files, is probably the easiest way at the moment - this takes care of step 3 for you.

If, for whatever reason, you can't run the lightweight Python wrapper on the computing cluster (if so - we'd like to hear why!), then it's a reasonably simple few lines of Python using our kwiklib API to add the .clu back into the .kwik; something like this:

from kwiklib import Experiment, read_clusters, add_clustering

def add_clu_to_kwik(filename, shank=1, dir=None):
    """Reads a .clu file and adds it to the .kwik file, overwriting any existing clusterings. The .clu file must have the same number of spikes as the .kwik."""

    # Read the clusters.
    clu = read_clusters(dir+filename + '.clu.' + str(shank))

    with Experiment(filename, dir=dir, mode='a') as exp:
    # Put the clusters in the kwik file.
        add_clustering(exp._files, channel_group_id=str(shank), name='original', spike_clusters=clu, overwrite=True)
        add_clustering(exp._files, channel_group_id=str(shank), name='main', spike_clusters=clu, overwrite=True)

filebase = 'my_experiment'  # .clu, .kwik, .kwx should be in same directory
directory = '' # leave blank for current directory
shank = 1

add_clu_to_kwik(filebase, shank, dir = directory)


Reply all
Reply to author
Forward
0 new messages