Comparaison des versions

Légende

  • Ces lignes ont été ajoutées. Ce mot a été ajouté.
  • Ces lignes ont été supprimées. Ce mot a été supprimé.
  • La mise en forme a été modifiée.

...

So now you should have a list of files (images, ROIs, and CSV files). We will focus on the CSV files has they contain the number of cells we are looking for and a lot more information we can also use.

We will reuse the previous R script but will add a little part to merge all the CSV files from the input folder.


Bloc de code
languageruby
titleScript R Merge CSV files and plot all data
collapsetrue

#Select the Input and the Output folder
Input <- "/Users/nicolas/Desktop/Input_Results-1/"
Output<-"/Users/nicolas/Desktop/Output/"
require("ggpubr")
#Get the list of CSV files
FileList<-list.files(path=Input, full.names=TRUE, pattern=".*csv")

#Merge the file into one big data
for (FileI in 1:length(FileList)){
  data<-read.csv(FileList[FileI])
  if (FileI==1){
    BigData<-data
  }else{
    BigData<-rbind(BigData,data)
  }
  
}
# then the rest is the same than the previous script
data<-BigData

List<-strsplit(as.character(data$Label), ':')

#Add Filename and Group to the data
data$Filename<-as.factor(sapply(List, "[[", 1))
Group<-strsplit(as.character(data$Filename), '_')
data$Group<-as.factor(sapply(Group, "[[", 1))
# Make Ch as a factor
data$Ch<-as.factor(data$Ch)

write.csv(data, paste0(Output,"Particules_All Measurements.csv"), row.names = FALSE)

#Create a list of plots
ListofPlots<-list()
i=1;

for(ColI in 3:(ncol(data)-2)){
  if(!is.factor(data[[ColI]])){
    for (ChI in 1:nlevels(data$Ch)){
   Graph<-   ggboxplot(
        data[data$Ch==ChI,], x = "Group", y = colnames(data[ColI]),
        color = "Group", palette = c("#4194fa", "#db51d4"),
        add = "jitter", title=paste0(colnames(data[ColI])," of Channel ", ChI)
      )+stat_compare_means(method = "t.test")
   ListofPlots[[i]]<-Graph
i=i+1
  }
  }
}

#Export the graphs
ggexport(
  plotlist = ListofPlots, filename = paste0(Output,"Graphs_individual.pdf"), 
  verbose=TRUE
)


This script will save the merged data in a single csv file. Usign your favourite spreadsheet manager you will be able to create a table and summarize the data with a pivot table to get the number of cells per group.


ControlTest
12251360

There are slighly more cells in the test than in the control. If we look at the number of detected cells per image we can confirm that there are more cells in the test conditions than in the control conditions. There are two images that have less celss than others in the control. We can go back to the detection to check those.

Image Added


Looking at the detection images we can confirm that the two images from the control have less cells, so it is not a detection issue.

Image AddedImage AddedImage Added


Together these results show that there is no more cells in one condition than the other.

On avera between 60 and 65 cells are detected by image with a total of 1200 cells per condition detected.


Then we can look at the graphs and look for what is statistically different, here is the short list

  • Area Test>Control
  • Mean Ch2 Test>Control
  • Min Ch2 Test>Control
  • Max Ch1 Control>Test
  • Max Ch2 Test>Control
  • Perimeter Test>Control
  • Width and Height Test>Control
  • Major and Minor Axis Test>Control
  • Feret Test>Control
  • Integrated Density Ch1 et Ch2 Test>Control
  • Skew et Kurt Ch1 Control>Test
  • Raw Integrated density of Ch2 Test>Control
  • Roundness Control>Test


Looking at p-values (statistical significiance) only it is not enough. One should also look at the biological sgnificiance of the numbers.

For example the roundess is statiscially different between the control and test but this difference is really small. What does it mean biologically that the test cells are a tiny bit less circular. In this specific case : nothing much. So we can safely forget about it to focus on more important issue.