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

Basic pipeline script #345

Open dlevenstein opened 4 years ago

dlevenstein commented 4 years ago

Should go from after recording to basic set of buzcode files

dlevenstein commented 4 years ago

add ipshita as well

brendonw1 commented 4 years ago

Do we already have something like this? I have my own for example. Problem is everyone will want different things. I suggest the following: create a script that pretty much offers all currently - available functions and then people can make their own copy and comment out certain functions. But If we do it my way it can serve as an almost advertisement or communication about the current buzcode capaxities... which often people don’t know (I didn’t knew there was a bz_getwaveform). I can submit my version if people like this idea and then others can modify

AntonioFR8 commented 4 years ago

Yes, this is a good idea. Manu is working in a script like that but it will be good to compare it with yours. The idea we discussed was to have a general script that launch all the basic analysis from the raw data and that can be customize for each person.

On Oct 29, 2019, at 6:56 AM, Brendon Watson notifications@github.com wrote:

Do we already have something like this? I have my own for example. Problem is everyone will want different things. I suggest the following: create a script that pretty much offers all currently - available functions and then people can make their own copy and comment out certain functions. But If we do it my way it can serve as an almost advertisement or communication about the current buzcode capaxities... which often people don’t know (I didn’t knew there was a bz_getwaveform). I can submit my version if people like this idea and then others can modify

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/buzsakilab/buzcode/issues/345?email_source=notifications&email_token=ADHSQQ4LA7KSJRZ75PJTPGTQRAJFVA5CNFSM4JF4WYTKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECQCBSA#issuecomment-547365064, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADHSQQ3JHOE6YTRS426QUMLQRAJFVANCNFSM4JF4WYTA.

brendonw1 commented 4 years ago

We could do this different ways, but I'll just start by pasting mine in... or we can do this via google doc?

function BWPreprocessing(basepath,noPrompts) % Inputs optional %

warning off

if ~exist('basepath','var') basepath = cd; elseif isempty(basepath) basepath = cd; 1; end basename = bz_BasenameFromBasepath(basepath);

if ~exist('noPrompts','var') noPrompts = (1); end noPrompts = logical(noPrompts);

%% copying xml if needed % !How to set htis up for now? % !copy from above or amplifier.xml? txmlname = fullfile(basepath,[basename '.xml']); d = dir(txmlname); if isempty(d)%if no basename.xml already in this folder [uifile,uipath] = uigetfile('.xml','Select Xml to copy into this folder for this recording'); copyfile (fullfile(uipath,uifile),txmlname) end

sessionInfo = bz_getSessionInfo(basepath,'editGUI',true);

%% Handling dat disp('Concatenating .dat files') deleteoriginaldatsboolean = 0; bz_ConcatenateDats(basepath,deleteoriginaldatsboolean);

%% Handling some dat metadata bz_DatFileMetadata(basepath); try TimeFromLightCycleStart(basepath);% Zeitgeber times of recording files RecordingSecondsToTimeSeconds(basepath,basename) catch e disp(['Received error: "' e.message '" during timestamping. SKIPPING STEP and Continuing on']) end

%% Make LFP file if ~exist(fullfile(basepath,[basename '.lfp']),'file') disp('Converting .dat to .lfp') bz_LFPfromDat(basepath) else disp('Not converting .lfp file, since it already exists') end

%% Sleep Scoring disp('Starting Sleep Scoring') SleepScoreMaster(basepath,'noPrompts',noPrompts);

%% Spike sorting try %figure out if gpu is present gpuArray(1); goodGPU = 1; catch goodGPU = 0; end

if goodGPU try disp('Starting KiloSort') KiloSortWrapper('basepath',basepath);

    % To Klusters
    % Kilosort2Neurosuite(rez);
    % Save original clus if clu's prsent
    t = dir (fullfile(basepath,'*.clu.*'));
    if ~isempty(t)
        mkdir(fullfile(basepath,'OriginalClus'));
        for idx = 1:length(t)
            copyfile(fullfile(basepath,t(idx).name),fullfile(basepath,'OriginalClus'));
        end
    end
catch(e)
    rethrow(e)
end

else disp('No GPU, not running kilosort') end

dlevenstein commented 4 years ago

You could also work on the a script on a separate branch that everyone can contribute to, and then pull it into dev when it's ready.

brendonw1 commented 4 years ago

I think it might be much faster to do it this way initially before putting in buzcode after initial agreement about elements:

Feel free to edit this: https://docs.google.com/document/d/1oHySkezYWg9-6pq2KFLW7yrE0ARkIZOW1fKMDV5Up6k/edit?usp=sharing