Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic pipeline script #345

Open
dlevenstein opened this issue Oct 28, 2019 · 6 comments
Open

Basic pipeline script #345

dlevenstein opened this issue Oct 28, 2019 · 6 comments
Assignees

Comments

@dlevenstein
Copy link
Collaborator

Should go from after recording to basic set of buzcode files

@dlevenstein
Copy link
Collaborator Author

add ipshita as well

@brendonw1
Copy link
Collaborator

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
Copy link
Collaborator

AntonioFR8 commented Oct 29, 2019 via email

@brendonw1
Copy link
Collaborator

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
Copy link
Collaborator Author

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
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants