function info = basic_info(data,interval,showplot) %********* JUDE MITCHELL (jude@salk.edu): 5/20/2008 %******** function info = basic_info(data,interval,showplot) %********** % one example: % info = basic_info('mnar4_u2',[],1); %uses default % % interval % % load 'msiv3_u8'; % info = basic_info(data,data.sustained,1) % %***** general: computes some very basic information about each unit %***** including reading out spike waveform, and stores that %***** information in smaller format that the full data struct %***** so it can be accessed for later analysis quickly %** inputs: %********** data - all relevent data fields for a neuron %****** %****** data.label(nChannels) = {'SU1' ; 'MU1'; 'LFP1'; 'EYE1'}; %****** data.trials{ntrials} = [[Su1 data 1:T];[Mu1 data from 1:T];...]; %****** data.spontaneous{ntrials} = [Su1 data 1:250ms]; %spike data only, %****** % data from interval when fixation first occurs %****** % and before the stimuli first onset %****** data.time{ntrials} = [1:T] %****** data.attend(ntrials) = 1 if attended in RF, 2 is 2 of 4 unatt, 3 is %****** for the 1 of 4 unattended case %****** data.exactspikes{ntrials} = exact single unit spike times per %****** per trial to 0.025 ms precision %****** data.fsample = 1000; %****** data.sustained = XA:XB % to mark the 800 ms sustained period %****** data.morepause = -250 to +250 after 1000ms pause, 1500 ms %****** data.pause = exact period of 1000ms pause %****** data.surround = -950 to -450 ms before pause, stimuli are outside %****** the RF (period of non-visual response?) %****** data.waveform = [1:32]; %****** data.isolation = 1 - well isolated single unit, %****** 2 - clear cluster but some overlap %****** 3 - multi-unit, large overlap %****** 4 - well isolated, but lost midway in session %****** %********** interval - interval of specific analysis, 1xN array of timepoints %********** - use data from this interval to evaluate %********** significant differences in rate and in Fano %********** showplot - to plot out results % %****** output: %****** info.name = name of single unit in database %****** info.monkey = id of monkey recorded from ... %****** info.isolation = isolation quality (1 best, 2 clear cluster) %****** info.waveform = 32 bin waveform %****** info.iwaveform = waveform interpolated by spline %****** up to 2.5ms precision %****** info.twaveform = time axis of iwaveform %****** info.wduration = duration of interpolated waveform %****** info.spontrate = spontaneous rate averaged over all conds %****** info.visrate = average visually evoked rate (over all conds) %****** info.pvis = probability visrate stat sig over spontaneous %****** %****** recap: %******** %******** function info = basic_info(data,interval,showplot) %********** % one example: % info = basic_info('mnar4_u2',[],1); %uses default % % interval % % load 'msiv3_u8'; % info = basic_info(data,data.sustained,1) info = []; %******* if data is just a name, load that file, else it is structure if (isfield(data,'label') == 0) disp(sprintf('Trying to load data file %s',data)); load(sprintf('exportdata\\%s',data)); disp(sprintf('Using default sustained interval for analysis')); interval = data.sustained; %must use default interval then end %*********** locate su1 it_su = -1; for zz = 1:size(data.label,2) if (strcmp(data.label{zz},'SU1')) it_su = zz; end end if (it_su == -1) disp(sprintf('Unable to identify SU1')); info = []; return; end %********* get the single unit spikes for attended and unattended trials CNUM = max(data.attend); % 2 or 3 conditions, or more? % condition 1 is attended in RF during 2 of 4 track % condition 2 is unattended in RF during 2 of 4 % condition 3 is unattended in RF during 1 of 4 spikes = cell(1,CNUM); % single unit attended spikes (in sustatined period sponts = cell(1,CNUM); % single unit spontaneous before trial for trial = 1:size(data.trials,2) cubo = data.attend(trial); spikes{cubo} = [spikes{cubo} ; data.trials{trial}(it_su,:)]; sponts{cubo} = [sponts{cubo} ; data.spontaneous{trial}(1,:)]; end %***************************************************************** spiker = spikes; sponter = sponts; %********************* collect basic info on cell **************** %****** info.name = name of single unit in database %****** info.monkey = id of monkey recorded from ... %****** info.waveform = 32 bin waveform %****** info.iwaveform = waveform interpolated by spline %****** up to 5ms precision %****** info.spontrate = spontaneous rate averaged over all conds %****** info.visrate = average visually evoked rate (over all conds) %****** info.pvis = probability visrate stat sig over spontaneous info.name = data.name; info.monkey = data.monkey_id; info.isolation = data.isolation; info.waveform = data.waveform; mino = min(info.waveform); maxo = max(info.waveform); %********* normalize the amplitude **** info.waveform = info.waveform / (maxo-mino); %******** interpolate waveform here and get duration ******** dTT = 25; % original resolution is 25 micro-secs dT = 2.5; % discretize to 5 micro-secs info.iwaveform = spline(1:32,info.waveform,[1:(dT/dTT):32]); info.twaveform = ( dT * (1:size(info.iwaveform,2)) ); %********* minima of waveform between 200-400 ms? y = find( info.iwaveform == min(info.iwaveform) ); mintime = y(1)*dT; %********* maxima of waveform greater than 300 ms? y = find( info.iwaveform == max(info.iwaveform) ); maxtime = y(1)*dT; if ( ((mintime>200)&(mintime<400)&(maxtime>300)) ) if (maxtime > mintime) info.wduration = (maxtime-mintime); else info.wduration = NaN; % peak must follow trough to define end else info.wduration = NaN; % not well defined peak followed by trough end %*********** spontaneous mean rates per trial spontos = []; for ii = 1:size(data.spontaneous,2) spontos = [spontos (1000*mean(data.spontaneous{ii}))]; end %*********** visually evoked rates per trial visos = []; for kk = 1:CNUM for ii = 1:size(spikes{kk},1) visos = [visos (1000*mean( spikes{kk}(ii,interval )))]; end end %************ info.spontrate = mean(spontos); info.visrate = mean(visos); if (info.spontrate < info.visrate) info.pvis = ranksum(spontos,visos); else info.pvis = -ranksum(spontos,visos); % let the sign indicate direction end %****************************************************************** disp(sprintf('%s dur(%5.1f) sp_vis(%5.1f,%5.1f)(p=%6.4f)',... info.name,info.wduration,info.spontrate,... info.visrate,info.pvis)); %************ plot the spike rasters and mean firing rates, and fano if (showplot == 1) figure; subplot(2,2,1); plot((25*(0:(size(info.waveform,2)-1))),info.waveform,'k.'); hold on; plot((2.5*(0:size(info.iwaveform,2)-1)),info.iwaveform,'b-'); xlabel('Time (us)'); ylabel('Waveform Amp'); title(sprintf('WaveDuration %4.1f',info.wduration)); mino = min(spontos); maxo = max(visos); vx = mino:((maxo-mino)/20):maxo; yhist = hist(spontos,vx); yhist2 = hist(visos,vx); subplot(2,2,2); bar(vx,yhist); xlabel('Firing Rate'); ylabel('Counts'); title(sprintf('Mean Spont = %5.3f',info.spontrate)); V = axis; axis([-2 maxo 0 V(4)]); subplot(2,2,4); bar(vx,yhist2); xlabel('Firing Rate'); ylabel('Counts'); title(sprintf('Mean Vis = %5.3f (p=%6.4f)',info.visrate,info.pvis)); axis([-2 maxo 0 V(4)]); end return;