MountainSort 5 脊波排序算法
项目描述
MountainSort 5
这是MountainSort脊波排序算法的最新版本。该算法的先前版本实现可在此处找到:此处。
- 使用Isosplit聚类
- 运行速度比先前版本更快,特别是对于大量通道计数
- 更好地处理时间重叠事件和漂移波形
- 在CPU上运行速度快
- 使用SpikeInterface进行I/O和预处理
- 支持多种排序方案,每种方案适用于不同的实验设置
安装
pip install --upgrade mountainsort5
依赖关系:
Python, SpikeInterface, scikit-learn, isosplit6
使用方法
MountainSort5利用SpikeInterface记录和排序对象。请参阅SpikeInterface文档了解如何加载和预处理您的电生理数据。
一旦加载了SpikeInterface记录对象,您可以使用以下代码运行MountainSort5:
from tempfile import TemporaryDirectory
import numpy as np
import spikeinterface as si
import spikeinterface.preprocessing as spre
import mountainsort5 as ms5
from mountainsort5.util import create_cached_recording
recording = ... # load your recording using SpikeInterface
# Make sure the recording is preprocessed appropriately
# Note that if the recording traces are of float type, you may need to scale
# it to a reasonable voltage range in order for whitening to work properly
# recording = spre.scale(recording, gain=...)
# lazy preprocessing
recording_filtered = spre.bandpass_filter(recording, freq_min=300, freq_max=6000, dtype=np.float32)
recording_preprocessed: si.BaseRecording = spre.whiten(recording_filtered)
with TemporaryDirectory(dir='/tmp') as tmpdir:
# cache the recording to a temporary directory for efficient reading
recording_cached = create_cached_recording(recording_preprocessed, folder=tmpdir)
# use scheme 1
sorting = ms5.sorting_scheme1(
recording=recording_cached,
sorting_parameters=ms5.Scheme1SortingParameters(...)
)
# or use scheme 2
sorting = ms5.sorting_scheme2(
recording=recording_cached,
sorting_parameters=ms5.Scheme2SortingParameters(...)
)
# or use scheme 3
sorting = ms5.sorting_scheme3(
recording=recording_cached,
sorting_parameters=ms5.Scheme3SortingParameters(...)
)
# Now you have a sorting object that you can save to disk or use for further analysis
要使用模拟数据尝试,请在examples目录中运行以下脚本:
方案1: examples/scheme1/toy_example.py
方案2: examples/scheme2/toy_example.py
方案3: examples/scheme3/toy_example.py
要使用使用Neuropixels和SpikeGLX收集的数据尝试,请修改以下快速入门脚本:
Neuropixel (SpikeGLX) 快速入门: examples/neuropixel_quickstart/spikeglx.py
预处理
MountainSort5设计用于操作预处理数据。您应按照示例中的说明进行带通滤波和白化记录。SpikeInterface提供各种懒预处理工具,以便不需要将中间文件存储到磁盘。
排序方案
MountainSort5组织为三个排序方案。不同的方案适用于不同的实验设置。
排序方案1
这是最简单的排序方案,适用于快速测试。整个记录加载到内存中,并在单次遍历中执行聚类。通常,方案1仅适用于测试和调试,因为方案2在处理时间重叠的事件方面表现更好,且在有限内存系统中处理大型数据集。方案1是方案2的第一遍,因此了解方案1的参数将有助于您更好地理解其他方案。
排序方案2
第二个排序方案通常比方案1更受欢迎,因为它可以处理无法完全加载到内存中的大型数据集,并且在准确检测和标记尖峰方面也有其他优势。
在第一阶段,使用第一个方案作为训练步骤,在数据集的子集上执行无监督聚类。然后在第二阶段,根据训练步骤的标签训练一组分类器。然后使用这些分类器来标记整个记录中的尖峰。
排序方案3
排序方案3旨在处理可能涉及波形漂移的长时间记录。记录被分成块,每个块都使用方案2进行尖峰排序。然后使用块的片段分类器来关联块之间的匹配单元。
引用MountainSort
目前,请引用与先前版本相对应的原始MountainSort论文
@article{chung2017fully,
title={A fully automated approach to spike sorting},
author={Chung, Jason E and Magland, Jeremy F and Barnett, Alex H and Tolosa, Vanessa M and Tooker, Angela C and Lee, Kye Y and Shah, Kedar G and Felix, Sarah H and Frank, Loren M and Greengard, Leslie F},
journal={Neuron},
volume={95},
number={6},
pages={1381--1394},
year={2017},
publisher={Elsevier}
}
此外,如果您使用SpikeInterface框架,请引用以下论文
@article{buccino2020spikeinterface,
title={SpikeInterface, a unified framework for spike sorting},
author={Buccino, Alessio Paolo and Hurwitz, Cole Lincoln and Garcia, Samuel and Magland, Jeremy and Siegle, Joshua H and Hurwitz, Roger and Hennig, Matthias H},
journal={Elife},
volume={9},
pages={e61834},
year={2020},
publisher={eLife Sciences Publications Limited}
}
贡献
如果您有任何问题或建议,请随时打开问题或拉取请求。
如果您觉得这个仓库有用,请给它点个赞!
作者
Jeremy Magland,计算数学中心,Flatiron研究所
致谢
感谢Loren Frank及其实验室在项目开发的所有阶段对该项目的支持。
感谢Alex Barnett,Leslie Greengard和Jason Chung在原始Isosplit和MountainSort算法上的工作。
感谢SpikeInterface团队,特别是Alessio Buccino和Samuel Garcia,他们在SpikeInterface框架上的工作,该框架支持预处理和后处理,并使使用MountainSort5与各种文件格式变得容易。
感谢Jeff Soules对sortingview和相关可视化工具的工作,这些工具使得检查MountainSort5和其他算法的结果成为可能。
感谢Joshua Melander提供的关于如何使用Neuropixels和SpikeGLX入门的指南。
最后,感谢所有先前版本MountainSort的用户,他们提供了反馈和建议。
许可证
Apache-2.0
项目详情
下载文件
下载适用于您的平台的文件。如果您不确定选择哪个,请了解更多关于安装软件包的信息。
源分布
构建版本
mountainsort5-0.5.6.tar.gz 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 6b1011a389db19932cd204b85ee3c33f2358f8b28e27764ba822df04f1f1dd4d |
|
MD5 | a9286a2449f0c7345a8878367a7a3e1e |
|
BLAKE2b-256 | c721a7192d5f8183b597abf5cf006ebdee6a584137d2de9c16413858bfd09846 |
mountainsort5-0.5.6-py3-none-any.whl 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | fe7e7949642efa7daedf1a35254eac6425a3941be6fe53d2559168d02ae05360 |
|
MD5 | ad31a3c3cd93b7aa8ec9ba6a59c011e4 |
|
BLAKE2b-256 | 5c8fb5215c2ea802af2605fccd5343bbda65b18ca3a0ea5f9000d64a93bf5f2c |