vladscript / FinderSpiker

Signal Processing Toolbox for Calcium Imaging Data
https://vladscript.github.io/FinderSpiker/
MIT License
7 stars 0 forks source link

ROI and condition issue #3

Open aubrey1124 opened 4 months ago

aubrey1124 commented 4 months ago

the gui first give the picture to choose impatch or csv, after choose the impatch,the giving window ask the number of condition and condition names and the number of videos for each condition ,then the gui ask me to provide the ROI csv,but only one csv file can be uploaded. i have more than one conditions and more than one videos ,but they should be the same ROI? how is that possible? and i dont understand the condition means? the disease condition?as the paper, 截屏2024-05-16 11 14 21 another question is the raster and network and so on ,are they rely on the first calcium spiker? or they could load the result files after each condition go through the first calcium spiker and analyze the files?

vladscript commented 4 months ago

Hi, I'll try to answer your questions by describing the way I obtained the data.

So, for each slice (one experiment), we recorded two conditions: L-DOPA and L-DOPA+DRUG. Each condition could contain more than one video (because of the way the acquisition software works) But, the whole experiment (one slice) only needed a list of coordinates of ROIs of accumulated coordinates observed during the experiment.

By condition, I meant a state of the slice, it could be spontaneous activity during control or disease, or treated (after drug administration, or after being stimulated (electrical or light), or other state. So these scripts are meant to be used for an experiment at the time that could contain N conditions.

An I hope I understand your last question. Each stage of the analysis is saved on a .mat file and every result is saved (after overwrite in the mat file when is required). Except for the network part, I exported CSV files to Gephi. So, to export data or results, the .mat file needs to be loaded to MATLAB's workspace.

I hope this helps, otherwise let me know.

aubrey1124 commented 4 months ago

Thanks for your reply!! AND Sorry for the late reply, I have been tying to resolve the issue driven by the ROI.

I comprehend the meaning of the condition now. Our experiments aim to discern the difference between the WT and AD and AD + DRUGs. But our experiment use groups with different mices.For example, the WT group are 1,2,3.The AD group are 4,5,6. The AD + DRUG group are 7,8,9.

So, under this circumstance, I shall only put one condition to the calcium spiker,due to the fact that each group uses different mices,and their ROI also differ.(The GUI can only accept one ROI file. Your experiment uses the same mice before and after ,so they have the same ROI,and could put different condition to the GUI).

I tried to add a loop to read the ROI of each video segment in the read coordination code, but subsequent processes like FluorescenceSignals encountered errors.

If I don't add the loop and only input one condition for individual analysis, the subsequent N-EXPERIMENTS ANALYSIS will encounter errors because the NC in my workspace is only 1.

It seems there are only two options at the moment: either solve the loop reading to match different conditions with different ROIs, or merge the MAT files obtained by inputting only one condition to address issues like NC being greater than 1, thus enabling subsequent N-EXPERIMENTS ANALYSIS.

Because currently, even within the same condition, the mice are different, which means not only merging different conditions but also potentially merging data from the same condition, considering the different ROIs for different mice.

Perhaps you could help me solve this problem or offer other suggestions? I would greatly appreciate it!! 截屏2024-05-28 17 09 46

Another question is, in your single analysis, is the fluorescence signal input the raw signal or DFF, or something else?

vladscript commented 4 months ago

OK, I noticed the lack of documentation of my code, but I hope this helps, because there are several issues:

So, you're right, you would get 9 different MAT files divided in three groups, you need to run in each one this function: Select_Rasters to select the length (if you set 0 and a longer limit it gets the whole recording)

Then in the section DATASETS MAKER the scripts require to define the number of conditions (where NC=>1) and it extracts features of each MAT file and save them in CSV files. Try the function Raster_Features_Display . So it does not merge files but accumulate features in tables. You need to run once the function to get the whole table of features

In a similar way, the section of N-EXPERIMENTS ANALYSIS read MAT files one by one and accumulates some specific features of all cells. These scripts run once per condition, so you would need to run it 3 times and accumulate the features of three mice (MAT files) in each one. The statistics and comparisons among conditions would require additional code.

Those scripts run with a clear Workspace, so you don't need to upload anything to it.

Yes it reads the raw fluorescence as grayscale average in the ROI and then it is detrended by means of smooth filtering.

aubrey1124 commented 3 months ago

Sorry to bother again,I am really confused and cant work it out. I really tried.....

Currently, based on your previous reply, for our experimental setup, I have obtained a MAT file for each mouse under each condition (after running up to the third step, CLUSTERING NEURONAL ENSEMBLES, and skipping steps four and five since there are no coactivations and no need to RETRIEVE ORIGINAL SIGNALS from RASTER SELECTION).
截屏2024-06-25 20 23 51

However,I am uncertain about how to proceed with Gephi operations and the sequence of steps starting from step six in our experimental setup(in case you forgotten,Our experiments aim to discern the difference between the WT and AD and AD + DRUGs. But our experiment use groups with different mices.For example, the WT group are 1,2,3.The AD group are 4,5,6. The AD + DRUG group are 7,8,9.).

I’m unsure about how to merge data—should it be merged according to different conditions? In the N-experiment analysis, when it says “ACCUMULATE FEATURES FROM SEVERAL EXPERIMENTS,” does this refer to accumulating features from different mice under the same condition? In step seven, DATASETS MAKER, it is stated to “Make Tables for SINGLE EXPERIMENTS.” Does “single experiment” imply different conditions for the same mouse?
截屏2024-06-25 20 24 46 截屏2024-06-25 20 25 06

In details, after running the Get_Total_Network,In my experimental setup, each mouse under each condition outputs a separate CSV file for network analysis. Does your experimental configuration generate a single CSV file for different conditions under the same mouse? 截屏2024-06-25 20 25 50
The section 3.1 1.1 mentions “For each condition Create a Space Work,” does this imply importing node and edge data from different mice under the same condition? For instance, if there are four mice under the condition “disease plus Drug A,” are the data from all these four mice imported into the same workspace?
截屏2024-06-25 20 28 33

When running Accumulate_Raster_Distances, I load a MAT file of one mouse under one condition(there can only upload one file) will encounter the error. 截屏2024-06-25 19 30 58

截屏2024-06-25 20 50 45 I don't know the differeces between the above two csv files. When running Ensembles_Features_Detailed_Display, but the outcome will encounter the error during running the Merge_Feature_Datasets.

截屏2024-06-25 20 53 24

PS: In step five, RETRIEVE ORIGINAL SIGNALS from RASTER SELECTION, why is there a need to retrieve original signals when the first step, SIGNAL PROCESSING: Detect Calcium Transients Events, already procures the ORIGINAL SIGNALS?

Hope for your help!!!