buzsakilab / buzcode

Code for internal lab sharing - polishing has started but is by no means complete
http://www.buzsakilab.com/
GNU General Public License v3.0
119 stars 128 forks source link

Sleep Detection and Theta/Delta Ratio #227

Closed gmbcrazy closed 5 years ago

gmbcrazy commented 6 years ago

Hi,

I tried to use the SleepScoreMaster.m code to detect Slow wave sleep(NREM), REM as well as awake theta states. But I noticed that it calculated the theta(5-10 Hz)/all (2-20 Hz) ratio, which is different from those in traditional literatures , where theta(4-12)/delta(1-4) is calculated.

I wonder if I miss something?

Thanks a lot Best, LU

brendonw1 commented 6 years ago

The idea was to compensate for recordings outside the hippocampus where theta isn’t so strong. So the idea is to look for times where there is isolated elevation in theta power (ie rather than theta simply being high because everything below 25hz is elevated. We tested these numbers and they worked well for us. You can modify the code to change that or to make it an input.

By the way was there a specific problem I can help with - if so let me know. On Tue, Jul 31, 2018 at 2:46 PM David Tingley notifications@github.com wrote:

Assigned #227 https://github.com/buzsakilab/buzcode/issues/227 to @brendonw1 https://github.com/brendonw1.

— You are receiving this because you were assigned.

Reply to this email directly, view it on GitHub https://github.com/buzsakilab/buzcode/issues/227#event-1763486251, or mute the thread https://github.com/notifications/unsubscribe-auth/ADXrTWy1713CWR44wVGpzC1vqcH90d91ks5uMKYKgaJpZM4Vos1f .

gmbcrazy commented 6 years ago

@brendonw1 , it looks good. But I wonder if this parameter, theta(5-10 Hz)/all (2-25 Hz) ratio, ever been used in any literatures published from Buzsaki lab? I'm processing hc11 (behavior states is given) and hc3 data (behavior states is not given). Meantime, I want apply comparable method with those literatures using those data sets.

Thanks a again.

dlevenstein commented 6 years ago

We used it in this paper: https://www.cell.com/neuron/pdf/S0896-6273(16)30056-3.pdf And found that especially in the recordings in which we had no hippocampal probe, it did a much better job than the "traditional" theta/delta (though note, gervasoni et al 2004 used a different/inclusive ratio as well... and I suspect that a broad review of the literature will find a range of criteria used by different labs/papers)

To my knowledge, hc11 was scored manually? This is Andres' dataset, right? Note also that no matter which method you use, it's best to manually check the scoring quality using TheStateEditor as there will inevitably be a few recordings/time points that need some manual curation.

gmbcrazy commented 6 years ago

@dlevenstein , thanks a lot. That's really helpful.

For hc11, the "sessInfo" variable is included in a existing .mat in each rat folder. "Buddy, Achilles, Cicero, Gatesby". Epoch states includes: Wake, Drowsy, NREM, Intermediate and REM. I assume it's based on automatic detection based on something like SleepScoreMaster.m

Are Andres still in the lab? @dlevenstein

dlevenstein commented 6 years ago

Nope, to my knowledge that dataset was scored by hand. Andres left the lab a few years ago and is now in the Losonczy lab at Columbia.

gmbcrazy commented 6 years ago

Andres confirmed that, hc-11 was hand-scored based on theta/delta ratio, EMG and others.

Just one more question, The SleepScoreMaster could be applied on hc-3 directly, whose EMG could be extracted from LFPs. Is there any issue if I use such protocol on hc-11, where EMG is already recorded? I might modify the code a little bit to make input EMG signals is the data recorded.

brendonw1 commented 6 years ago

I can’t say for sure what will happen but it should be fine actually. As long as it’s basically bimodal in terms of amplitude in 1 second bins.

I’m trying to think about how to best advise you to alter the code. One lazy way is take the rectified amplitude of the real emg and put that into something with the same name and format as the emgfromlfp.lfp.mat.

Then again if you wanna actually alter the code in a useful way then that’s awesome. On Thu, Aug 2, 2018 at 9:38 AM Lu Zhang notifications@github.com wrote:

Andres confirmed that, hc-11 was hand-scored based on theta/delta ratio, EMG and others.

Just one more question, The SleepScoreMaster could be applied on hc-3 directly, whose EMG could be extracted from LFPs. Is there any issue if I use such protocol on hc-11, where EMG is already recorded? I might modify the code a little bit to make input EMG signals is the data recorded.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/buzsakilab/buzcode/issues/227#issuecomment-409929275, or mute the thread https://github.com/notifications/unsubscribe-auth/ADXrTWT2ltOi9wJqSRljdmcBHkWuodnoks5uMwDpgaJpZM4Vos1f .

gmbcrazy commented 6 years ago

@brendonw1 , Thanks a lot for your suggestion.

I'm processing hc11 now, with EMG re-calculated from LFPs, like those in hc3. I'll compare the results with Andres's hand sore. I believe his hand score result should be quite accurate, though "subjective".

It's then a cross-validation of SleepScoreMaster protocol too. I'll let you guys know the results here.

brendonw1 commented 6 years ago

I can’t remember whether you might want to zscore jt first.

I’ll be curious to hear the results. The emg corr has been validated against emg (Schomburg citation in my paper) but haven’t sleep scored based on the two metrics in the same dataset. On Thu, Aug 2, 2018 at 12:56 PM Lu Zhang notifications@github.com wrote:

@brendonw1 https://github.com/brendonw1 , Thanks a lot for your suggestion.

I'm processing hc11 now, with EMG re-calculated from LFPs, like those in hc3. I'll compare the results with Andres's hand sore. I believe his hand score result should be quite accurate, though "subjective".

It's then a cross-validation of SleepScoreMaster protocol too. I'll let you guys know the results here.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/buzsakilab/buzcode/issues/227#issuecomment-409995955, or mute the thread https://github.com/notifications/unsubscribe-auth/ADXrTZzRKC-m25tPHp8FIRi38d4lazBYks5uMy9CgaJpZM4Vos1f .

dlevenstein commented 6 years ago

Sounds good - SSM was never really tested for hippocampal-only data, so this will be a good benchmark.

I started a pretty significant update to the algorithm before I left for a course at woods hole... including a bug fix in how it uses non-standard weights and the ability to use power spectrum slope for the slow wave signal (which seems to be more robust to noise and non-frontal-cortex data for detecting NREM...). Unfortunately I didn't finish and won't be back to my lab desktop until the end of August. Keep us posted and we can compare the old and new methods when I get back as well.

gmbcrazy commented 6 years ago

buddy This is example of what I got. SleepScoreMaster is applied with all CA1 channels as theta and SW channels (below) without any manual modifications. Noted that here "EMG" is calculated based on those CA1 LFPs.

Above is Andres's behaviors based on theta/delta ratio and real EMG.

For me, it looks quite matched.

brendonw1 commented 6 years ago

That’s of course generally quite nice to see! Dan did a very similar analysis on our data and the correlation was above 90%.

On Thu, Aug 2, 2018 at 3:03 PM Lu Zhang notifications@github.com wrote:

[image: buddy] https://user-images.githubusercontent.com/32208252/43604926-f627bd12-9664-11e8-844c-8ce4a049eb8a.jpg This is example of what I got. SleepScoreMaster is applied with all CA1 channels as theta and SW channels (below) without any manual modifications. Above is Andres's behaviors. For me, it looks quite matched.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/buzsakilab/buzcode/issues/227#issuecomment-410034191, or mute the thread https://github.com/notifications/unsubscribe-auth/ADXrTYWs_v7o4b_TDFvmZR4y9wmlgg5yks5uM00HgaJpZM4Vos1f .

dlevenstein commented 6 years ago

I'd like to leave this open until we try out the power spectrum slope and directly compare the two. My sense is that it will actually improve some of that flickering in/out of NREM.

dlevenstein commented 5 years ago

Flickering is dramatically reduced with sticky trigger #284 and PSS slope #262. Am re-autoscoring (followed by manual check) all of Andres' data in the Datasets folder on NYU share. closing this issue.