test
This commit is contained in:
джерело
c95e3dcb8e
коміт
ea41cd999e
3 змінених файлів з 211 додано та 34 видалено
17
Projet.Rmd
17
Projet.Rmd
|
@ -7,7 +7,7 @@ date: "2024-12-04"
|
|||
---
|
||||
|
||||
```{r setup, include=FALSE}
|
||||
knitr::opts_chunk$set(echo = TRUE)
|
||||
knitr::opts_chunk$set(echo = FALSE)
|
||||
library(ggplot2)
|
||||
library(gridExtra)
|
||||
library(grid)
|
||||
|
@ -103,7 +103,7 @@ T1 quant à lui se démarque grandement par une large majorité (Un peu plus de
|
|||
### Expression relative des gênes mesurées à intervalle régulier
|
||||
|
||||
#### Traitement T1
|
||||
```{r, fig.height=10}
|
||||
```{r, fig.height=5}
|
||||
#apply(T[-c(37:39)],2,function(col){
|
||||
# which(T == col)
|
||||
#hist(col, main = paste("Histogram of", colnames(T)[which(T == col)[2]]),
|
||||
|
@ -116,7 +116,7 @@ ggplot(T_long, aes(x = value)) +
|
|||
labs(title = "Histogrammes de l'expression relative des gènes aux différents relevés lors du traitement T1", x = "Valeurs", y = "Effectifs")
|
||||
```
|
||||
### Traitement T2
|
||||
```{r, fig.height=10}
|
||||
```{r, fig.height=5}
|
||||
T_long = melt(T[c(7,8,9,10,11,12,25,26,27,28,29,30)])
|
||||
ggplot(T_long, aes(x = value)) +
|
||||
geom_histogram(binwidth = 1, fill = "blue", color = "black", alpha = 0.7) +
|
||||
|
@ -220,7 +220,7 @@ En revanche, il est très clair que T2 et T3 ciblent les mêmes genes, toutes le
|
|||
|
||||
### matrice de covariance des variables quantitatives
|
||||
|
||||
```{r, fig.height = 18}
|
||||
```{r}
|
||||
cr = cor(T[-c(37:39)])
|
||||
corrplot(cr,method="ellipse", type="lower", bg = "lightgrey",title ="Visualisation de la matrice de covariance des variables quantitatives" )
|
||||
```
|
||||
|
@ -364,8 +364,7 @@ ggplot(df,aes(x=K,y=Iintra))+
|
|||
xlab("Nombre de classes")+
|
||||
ylab("Inertie intraclasse")
|
||||
```
|
||||
|
||||
On voit un coude à 4 clusters ?
|
||||
nn pense dénoter un coude dans la courbe d'inertie intraclasse aux alentours de 4 clusters
|
||||
|
||||
|
||||
```{r}
|
||||
|
@ -417,7 +416,7 @@ fviz_cluster(res_kmeans,data=donnees_transposees,
|
|||
# theme(legend.position = "none")
|
||||
#chordDiagram(table(clust,donnees_transposees[,2]))
|
||||
```
|
||||
On remaque bien 4 clusters
|
||||
On remaque bien 3 clusters
|
||||
|
||||
### PAM
|
||||
|
||||
|
@ -431,13 +430,13 @@ fviz_cluster(res,data=donnees_transposees,
|
|||
|
||||
|
||||
### clustering CAH
|
||||
```{r, fig.width=10}
|
||||
```{r, fig.width=9}
|
||||
|
||||
dx<-dist(donnees_transposees,method="euclidian")
|
||||
hward<-hclust(dx,method = "ward.D2")
|
||||
|
||||
|
||||
fviz_dend(hward,k=3,
|
||||
fviz_dend(hward,k=4,
|
||||
show_labels = TRUE,
|
||||
rect=TRUE,
|
||||
rect_fill = TRUE,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
This is pdfTeX, Version 3.141592653-2.6-1.40.25 (TeX Live 2023/Debian) (preloaded format=pdflatex 2024.12.28) 28 DEC 2024 12:03
|
||||
This is pdfTeX, Version 3.141592653-2.6-1.40.25 (TeX Live 2023/Debian) (preloaded format=pdflatex 2024.12.28) 1 JAN 2025 15:56
|
||||
entering extended mode
|
||||
restricted \write18 enabled.
|
||||
%&-line parsing enabled.
|
||||
|
|
226
Projet.tex
226
Projet.tex
|
@ -118,6 +118,7 @@
|
|||
\NormalTok{T}\SpecialCharTok{$}\NormalTok{ExpT1 }\OtherTok{=} \FunctionTok{as.factor}\NormalTok{(T}\SpecialCharTok{$}\NormalTok{ExpT1)}
|
||||
\NormalTok{T}\SpecialCharTok{$}\NormalTok{ExpT2 }\OtherTok{=} \FunctionTok{as.factor}\NormalTok{(T}\SpecialCharTok{$}\NormalTok{ExpT2)}
|
||||
\NormalTok{T}\SpecialCharTok{$}\NormalTok{ExpT3 }\OtherTok{=} \FunctionTok{as.factor}\NormalTok{(T}\SpecialCharTok{$}\NormalTok{ExpT3)}
|
||||
\CommentTok{\#centrer T}
|
||||
\FunctionTok{head}\NormalTok{(T)}
|
||||
\end{Highlighting}
|
||||
\end{Shaded}
|
||||
|
@ -345,7 +346,7 @@ T1}\label{expression-des-guxeanes-lors-du-traitement-t1}
|
|||
\FunctionTok{geom\_bar}\NormalTok{(}\AttributeTok{width =} \DecValTok{1}\NormalTok{, }\AttributeTok{stat =} \StringTok{"identity"}\NormalTok{)}\SpecialCharTok{+}
|
||||
\FunctionTok{coord\_polar}\NormalTok{(}\StringTok{"y"}\NormalTok{, }\AttributeTok{start=}\DecValTok{0}\NormalTok{)}\SpecialCharTok{+}
|
||||
\FunctionTok{theme}\NormalTok{(}\AttributeTok{legend.position=}\StringTok{"bottom"}\NormalTok{)}
|
||||
\FunctionTok{grid.arrange}\NormalTok{(g3,g1,g2,}\AttributeTok{ncol=}\DecValTok{3}\NormalTok{)}
|
||||
\FunctionTok{grid.arrange}\NormalTok{(g3,g1,g2,}\AttributeTok{ncol=}\DecValTok{3}\NormalTok{,}\AttributeTok{top=}\FunctionTok{textGrob}\NormalTok{(}\StringTok{"Visualualisation des expressions relative des gènes lors du traitement T1"}\NormalTok{))}
|
||||
\end{Highlighting}
|
||||
\end{Shaded}
|
||||
|
||||
|
@ -386,7 +387,7 @@ T2}\label{expression-des-guxeanes-lors-du-traitement-t2}
|
|||
\FunctionTok{geom\_bar}\NormalTok{(}\AttributeTok{width =} \DecValTok{1}\NormalTok{, }\AttributeTok{stat =} \StringTok{"identity"}\NormalTok{)}\SpecialCharTok{+}
|
||||
\FunctionTok{coord\_polar}\NormalTok{(}\StringTok{"y"}\NormalTok{, }\AttributeTok{start=}\DecValTok{0}\NormalTok{)}\SpecialCharTok{+}
|
||||
\FunctionTok{theme}\NormalTok{(}\AttributeTok{legend.position=}\StringTok{"bottom"}\NormalTok{)}
|
||||
\FunctionTok{grid.arrange}\NormalTok{(g3,g1,g2,}\AttributeTok{ncol=}\DecValTok{3}\NormalTok{)}
|
||||
\FunctionTok{grid.arrange}\NormalTok{(g3,g1,g2,}\AttributeTok{ncol=}\DecValTok{3}\NormalTok{,}\AttributeTok{top=}\FunctionTok{textGrob}\NormalTok{(}\StringTok{"Visualualisation des expressions relative des gènes lors du traitement T2"}\NormalTok{))}
|
||||
\end{Highlighting}
|
||||
\end{Shaded}
|
||||
|
||||
|
@ -416,7 +417,7 @@ T3}\label{expression-des-guxeanes-lors-du-traitement-t3}
|
|||
\FunctionTok{geom\_bar}\NormalTok{(}\AttributeTok{width =} \DecValTok{1}\NormalTok{, }\AttributeTok{stat =} \StringTok{"identity"}\NormalTok{)}\SpecialCharTok{+}
|
||||
\FunctionTok{coord\_polar}\NormalTok{(}\StringTok{"y"}\NormalTok{, }\AttributeTok{start=}\DecValTok{0}\NormalTok{)}\SpecialCharTok{+}
|
||||
\FunctionTok{theme}\NormalTok{(}\AttributeTok{legend.position=}\StringTok{"bottom"}\NormalTok{)}
|
||||
\FunctionTok{grid.arrange}\NormalTok{(g3,g1,g2,}\AttributeTok{ncol=}\DecValTok{3}\NormalTok{)}
|
||||
\FunctionTok{grid.arrange}\NormalTok{(g3,g1,g2,}\AttributeTok{ncol=}\DecValTok{3}\NormalTok{,}\AttributeTok{top=}\FunctionTok{textGrob}\NormalTok{(}\StringTok{"Visualualisation des expressions relative des gènes lors du traitement T3"}\NormalTok{))}
|
||||
\end{Highlighting}
|
||||
\end{Shaded}
|
||||
|
||||
|
@ -469,7 +470,7 @@ régulier}\label{expression-relative-des-guxeanes-mesuruxe9es-uxe0-intervalle-ru
|
|||
\FunctionTok{ggplot}\NormalTok{(T\_long, }\FunctionTok{aes}\NormalTok{(}\AttributeTok{x =}\NormalTok{ value)) }\SpecialCharTok{+}
|
||||
\FunctionTok{geom\_histogram}\NormalTok{(}\AttributeTok{binwidth =} \DecValTok{1}\NormalTok{, }\AttributeTok{fill =} \StringTok{"blue"}\NormalTok{, }\AttributeTok{color =} \StringTok{"black"}\NormalTok{, }\AttributeTok{alpha =} \FloatTok{0.7}\NormalTok{) }\SpecialCharTok{+}
|
||||
\FunctionTok{facet\_wrap}\NormalTok{(}\SpecialCharTok{\textasciitilde{}}\NormalTok{variable,}\AttributeTok{scales =} \StringTok{"free"}\NormalTok{,}\AttributeTok{ncol=}\DecValTok{6}\NormalTok{) }\SpecialCharTok{+}
|
||||
\FunctionTok{labs}\NormalTok{(}\AttributeTok{title =} \StringTok{"Histograms for Each Column"}\NormalTok{, }\AttributeTok{x =} \StringTok{"Values"}\NormalTok{, }\AttributeTok{y =} \StringTok{"Frequency"}\NormalTok{)}
|
||||
\FunctionTok{labs}\NormalTok{(}\AttributeTok{title =} \StringTok{"Histogrammes de l\textquotesingle{}expression relative des gènes aux différents relevés lors du traitement T1"}\NormalTok{, }\AttributeTok{x =} \StringTok{"Valeurs"}\NormalTok{, }\AttributeTok{y =} \StringTok{"Effectifs"}\NormalTok{)}
|
||||
\end{Highlighting}
|
||||
\end{Shaded}
|
||||
|
||||
|
@ -491,7 +492,7 @@ Traitement T2
|
|||
\FunctionTok{ggplot}\NormalTok{(T\_long, }\FunctionTok{aes}\NormalTok{(}\AttributeTok{x =}\NormalTok{ value)) }\SpecialCharTok{+}
|
||||
\FunctionTok{geom\_histogram}\NormalTok{(}\AttributeTok{binwidth =} \DecValTok{1}\NormalTok{, }\AttributeTok{fill =} \StringTok{"blue"}\NormalTok{, }\AttributeTok{color =} \StringTok{"black"}\NormalTok{, }\AttributeTok{alpha =} \FloatTok{0.7}\NormalTok{) }\SpecialCharTok{+}
|
||||
\FunctionTok{facet\_wrap}\NormalTok{(}\SpecialCharTok{\textasciitilde{}}\NormalTok{variable,}\AttributeTok{scales =} \StringTok{"free"}\NormalTok{,}\AttributeTok{ncol=}\DecValTok{6}\NormalTok{) }\SpecialCharTok{+}
|
||||
\FunctionTok{labs}\NormalTok{(}\AttributeTok{title =} \StringTok{"Histograms for Each Column"}\NormalTok{, }\AttributeTok{x =} \StringTok{"Values"}\NormalTok{, }\AttributeTok{y =} \StringTok{"Frequency"}\NormalTok{)}
|
||||
\FunctionTok{labs}\NormalTok{(}\AttributeTok{title =} \StringTok{"Histogrammes de l\textquotesingle{}expression relative des gènes aux différents relevés lors du traitement T3"}\NormalTok{, }\AttributeTok{x =} \StringTok{"Valeurs"}\NormalTok{, }\AttributeTok{y =} \StringTok{"Effectifs"}\NormalTok{)}
|
||||
\end{Highlighting}
|
||||
\end{Shaded}
|
||||
|
||||
|
@ -513,7 +514,7 @@ Traitement T3
|
|||
\FunctionTok{ggplot}\NormalTok{(T\_long, }\FunctionTok{aes}\NormalTok{(}\AttributeTok{x =}\NormalTok{ value)) }\SpecialCharTok{+}
|
||||
\FunctionTok{geom\_histogram}\NormalTok{(}\AttributeTok{binwidth =} \DecValTok{1}\NormalTok{, }\AttributeTok{fill =} \StringTok{"blue"}\NormalTok{, }\AttributeTok{color =} \StringTok{"black"}\NormalTok{, }\AttributeTok{alpha =} \FloatTok{0.7}\NormalTok{) }\SpecialCharTok{+}
|
||||
\FunctionTok{facet\_wrap}\NormalTok{(}\SpecialCharTok{\textasciitilde{}}\NormalTok{variable,}\AttributeTok{scales =} \StringTok{"free"}\NormalTok{,}\AttributeTok{ncol=}\DecValTok{6}\NormalTok{) }\SpecialCharTok{+}
|
||||
\FunctionTok{labs}\NormalTok{(}\AttributeTok{title =} \StringTok{"Histograms for Each Column"}\NormalTok{, }\AttributeTok{x =} \StringTok{"Values"}\NormalTok{, }\AttributeTok{y =} \StringTok{"Frequency"}\NormalTok{)}
|
||||
\FunctionTok{labs}\NormalTok{(}\AttributeTok{title =} \StringTok{"Histogrammes de l\textquotesingle{}expression relative des gènes aux différents relevés lors du traitement T3"}\NormalTok{, }\AttributeTok{x =} \StringTok{"Valeurs"}\NormalTok{, }\AttributeTok{y =} \StringTok{"Effectifs"}\NormalTok{)}
|
||||
\end{Highlighting}
|
||||
\end{Shaded}
|
||||
|
||||
|
@ -563,13 +564,13 @@ traitement 1 avec un regroupement sur 0.
|
|||
On voit que même sans réduire les données, chaque variable s'exprime
|
||||
environ avec la même intensité.
|
||||
|
||||
\section{TODO : RAJOUTER LES BOXPLOTS PAIRE QUANTITATIF QUALITATIF POUR
|
||||
DECELER UNE CORRELATION,
|
||||
INUTILE}\label{todo-rajouter-les-boxplots-paire-quantitatif-qualitatif-pour-deceler-une-correlation-inutile}
|
||||
\subsection{Boxplots par paire de variables
|
||||
(qualitative,quantitative)}\label{boxplots-par-paire-de-variables-qualitativequantitative}
|
||||
|
||||
\begin{Shaded}
|
||||
\begin{Highlighting}[]
|
||||
\CommentTok{\# traitement 1 corrélation avec l\textquotesingle{}expression des genes du T1 T2 et T3}
|
||||
|
||||
\FunctionTok{ggplot}\NormalTok{(T,}\FunctionTok{aes}\NormalTok{(}\AttributeTok{y=}\NormalTok{T}\SpecialCharTok{$}\NormalTok{T1\_6H\_R1,}\AttributeTok{x=}\NormalTok{T}\SpecialCharTok{$}\NormalTok{ExpT1))}\SpecialCharTok{+}
|
||||
\FunctionTok{geom\_boxplot}\NormalTok{()}
|
||||
\end{Highlighting}
|
||||
|
@ -912,8 +913,8 @@ INUTILE}\label{todo-rajouter-les-boxplots-paire-quantitatif-qualitatif-pour-dece
|
|||
\end{verbatim}
|
||||
|
||||
\includegraphics{Projet_files/figure-latex/unnamed-chunk-9-18.pdf}
|
||||
Analyse des boxplots : - traitement 1 (réplicats 1 et 2) Les genes
|
||||
sur-exprimés au T1 n'ont pas changé d'expression relativement à
|
||||
\#\#\#~Analyse des boxplots : - traitement 1 (réplicats 1 et 2) Les
|
||||
genes sur-exprimés au T1 n'ont pas changé d'expression relativement à
|
||||
l'absence de traitement durant le T2. Il est difficile d'observer une
|
||||
catégorie de genes de T1 qui se soient sous exprimés dans T2. De même
|
||||
pour la sur-expression dans T2.
|
||||
|
@ -941,13 +942,13 @@ qualitatives moyennes calculées sur T3.
|
|||
|
||||
\subsection{Analyse bi-dimensionnelle}\label{analyse-bi-dimensionnelle}
|
||||
|
||||
\subsubsection{matrice de correlation des variables
|
||||
quantitatives}\label{matrice-de-correlation-des-variables-quantitatives}
|
||||
\subsubsection{matrice de covariance des variables
|
||||
quantitatives}\label{matrice-de-covariance-des-variables-quantitatives}
|
||||
|
||||
\begin{Shaded}
|
||||
\begin{Highlighting}[]
|
||||
\NormalTok{cr }\OtherTok{=} \FunctionTok{cor}\NormalTok{(T[}\SpecialCharTok{{-}}\FunctionTok{c}\NormalTok{(}\DecValTok{37}\SpecialCharTok{:}\DecValTok{39}\NormalTok{)])}
|
||||
\FunctionTok{corrplot}\NormalTok{(cr,}\AttributeTok{method=}\StringTok{"ellipse"}\NormalTok{, }\AttributeTok{type=}\StringTok{"lower"}\NormalTok{, }\AttributeTok{bg =} \StringTok{"lightgrey"}\NormalTok{)}
|
||||
\FunctionTok{corrplot}\NormalTok{(cr,}\AttributeTok{method=}\StringTok{"ellipse"}\NormalTok{, }\AttributeTok{type=}\StringTok{"lower"}\NormalTok{, }\AttributeTok{bg =} \StringTok{"lightgrey"}\NormalTok{,}\AttributeTok{title =}\StringTok{"Visualisation de la matrice de covariance des variables quantitatives"}\NormalTok{ )}
|
||||
\end{Highlighting}
|
||||
\end{Shaded}
|
||||
|
||||
|
@ -1171,7 +1172,7 @@ résultats et qu'ils soient lisibles.
|
|||
|
||||
\begin{Shaded}
|
||||
\begin{Highlighting}[]
|
||||
\FunctionTok{fviz\_eig}\NormalTok{(res\_pca)}
|
||||
\FunctionTok{fviz\_eig}\NormalTok{(res\_pca,}\AttributeTok{title=}\StringTok{"Participation des chaque valeur propre de la matrice de correlation à l\textquotesingle{}intertie totale des données"}\NormalTok{)}
|
||||
\end{Highlighting}
|
||||
\end{Shaded}
|
||||
|
||||
|
@ -1188,7 +1189,7 @@ principaux de l'analyse.
|
|||
|
||||
\begin{Shaded}
|
||||
\begin{Highlighting}[]
|
||||
\FunctionTok{fviz\_pca\_ind}\NormalTok{(res\_pca,}\AttributeTok{label=}\StringTok{"all"}\NormalTok{)}
|
||||
\FunctionTok{fviz\_pca\_ind}\NormalTok{(res\_pca,}\AttributeTok{label=}\StringTok{"all"}\NormalTok{,}\AttributeTok{title=}\StringTok{"Projection des individus sur un plan factoriel"}\NormalTok{)}
|
||||
\end{Highlighting}
|
||||
\end{Shaded}
|
||||
|
||||
|
@ -1196,7 +1197,7 @@ principaux de l'analyse.
|
|||
|
||||
\begin{Shaded}
|
||||
\begin{Highlighting}[]
|
||||
\FunctionTok{fviz\_pca\_var}\NormalTok{(res\_pca,}\AttributeTok{axes=}\FunctionTok{c}\NormalTok{(}\DecValTok{1}\NormalTok{,}\DecValTok{2}\NormalTok{),}\AttributeTok{label=}\StringTok{"none"}\NormalTok{)}
|
||||
\FunctionTok{fviz\_pca\_var}\NormalTok{(res\_pca,}\AttributeTok{axes=}\FunctionTok{c}\NormalTok{(}\DecValTok{1}\NormalTok{,}\DecValTok{2}\NormalTok{),}\AttributeTok{label=}\StringTok{"none"}\NormalTok{,}\AttributeTok{title=}\StringTok{"Corrélations des variables avec les composantes principales"}\NormalTok{)}
|
||||
\end{Highlighting}
|
||||
\end{Shaded}
|
||||
|
||||
|
@ -1221,12 +1222,19 @@ cercle, indiquant une participation très forte des genes dans la
|
|||
variance expliquée par ces dimensions. Il n'y a pas de tendance
|
||||
particulière sur la direction selon l'axe 2 des flèches : Dans chaque
|
||||
``polarité'' de fleches selon l'axe 1, il y a des fleches dont la
|
||||
direction est negative d'autres positive selon l'axe 2.
|
||||
direction est negative d'autres positive selon l'axe 2. Bien que l'on
|
||||
dénote une quantité plus grande de gènes corrélés positiviement à la
|
||||
dimension 2.
|
||||
|
||||
Le traitement 1 est entièrement groupé sur des valeurs très negatives de
|
||||
l'axe 1. On remarque dans ce groupement la présence des T3 et T4 à la
|
||||
première heure de relevés d'expression des gènes.
|
||||
|
||||
Pour le traitement 2 et 3, on les retrouves formant 2 groupements, 1 en
|
||||
haut à droite du graphe contenant les relevés à 2 et 3h puis un
|
||||
groupement s'étalant sur la droite du graphe du centre jusqu'en bas
|
||||
contenant les relevés à partir de 4h.
|
||||
|
||||
\subsection{ON EST SENSE VOIR UN TRUC IMPORTANT D'APRES LA PROF MAIS JE
|
||||
VOIS
|
||||
RIEN}\label{on-est-sense-voir-un-truc-important-dapres-la-prof-mais-je-vois-rien}
|
||||
|
@ -1245,10 +1253,11 @@ vers le bas =\textgreater{} ça se stabilise ( donc les genes pointant
|
|||
vers le haut changent d'expression, et ceux vers le bas ont tendance à
|
||||
rester plutot pareil )
|
||||
|
||||
\paragraph{On remarque que les traitements ne sont pas du tout décris de
|
||||
la même manière selon les horaires mais il y a une régularité
|
||||
d'apparition dans chaque tranche
|
||||
horaire.}\label{on-remarque-que-les-traitements-ne-sont-pas-du-tout-duxe9cris-de-la-muxeame-maniuxe8re-selon-les-horaires-mais-il-y-a-une-ruxe9gularituxe9-dapparition-dans-chaque-tranche-horaire.}
|
||||
\begin{quote}
|
||||
On remarque que les traitements ne sont pas du tout décris de la même
|
||||
manière selon les horaires, mais il y a une régularité d'apparition dans
|
||||
chaque tranche horaire.
|
||||
\end{quote}
|
||||
|
||||
\subsubsection{hypothèses sur la signification : qu'est-ce qu'ils ont en
|
||||
commun ces gènes qui pourrait décrire ces relevés aux différentes heures
|
||||
|
@ -1282,7 +1291,8 @@ cercle)}\label{afin-de-visualiser-les-corruxe9lations-des-variables-intiales-ave
|
|||
|
||||
\includegraphics{Projet_files/figure-latex/unnamed-chunk-15-1.pdf}
|
||||
|
||||
MAIS C'EST INBUVABLE
|
||||
MAIS C'EST INBUVABLE \#\#\# plus ou moins inutile ici de regarder
|
||||
d'autres plans
|
||||
|
||||
\begin{Shaded}
|
||||
\begin{Highlighting}[]
|
||||
|
@ -1306,6 +1316,174 @@ MAIS C'EST INBUVABLE
|
|||
\end{Highlighting}
|
||||
\end{Shaded}
|
||||
|
||||
\includegraphics{Projet_files/figure-latex/unnamed-chunk-16-3.pdf}
|
||||
\includegraphics{Projet_files/figure-latex/unnamed-chunk-16-3.pdf} \#\#
|
||||
Clustering
|
||||
|
||||
\subsubsection{Clustering k-means}\label{clustering-k-means}
|
||||
|
||||
\begin{Shaded}
|
||||
\begin{Highlighting}[]
|
||||
\CommentTok{\#centrage et réduction des données}
|
||||
\NormalTok{s }\OtherTok{=} \FunctionTok{scale}\NormalTok{(donnees\_transposees)}
|
||||
|
||||
\NormalTok{Kmax}\OtherTok{\textless{}{-}}\DecValTok{15}
|
||||
\NormalTok{reskmeanscl}\OtherTok{\textless{}{-}}\FunctionTok{matrix}\NormalTok{(}\DecValTok{0}\NormalTok{,}\AttributeTok{nrow=}\FunctionTok{nrow}\NormalTok{(s),}\AttributeTok{ncol=}\NormalTok{Kmax}\DecValTok{{-}1}\NormalTok{)}
|
||||
\NormalTok{Iintra}\OtherTok{\textless{}{-}}\ConstantTok{NULL}
|
||||
\ControlFlowTok{for}\NormalTok{ (k }\ControlFlowTok{in} \DecValTok{2}\SpecialCharTok{:}\NormalTok{Kmax)\{}
|
||||
\NormalTok{ resaux}\OtherTok{\textless{}{-}}\FunctionTok{kmeans}\NormalTok{(s,k)}
|
||||
\NormalTok{ reskmeanscl[,k}\DecValTok{{-}1}\NormalTok{]}\OtherTok{\textless{}{-}}\NormalTok{resaux}\SpecialCharTok{$}\NormalTok{cluster}
|
||||
\NormalTok{ Iintra}\OtherTok{\textless{}{-}}\FunctionTok{c}\NormalTok{(Iintra,resaux}\SpecialCharTok{$}\NormalTok{tot.withinss)}
|
||||
\NormalTok{\}}
|
||||
|
||||
\NormalTok{df}\OtherTok{\textless{}{-}}\FunctionTok{data.frame}\NormalTok{(}\AttributeTok{K=}\DecValTok{2}\SpecialCharTok{:}\DecValTok{15}\NormalTok{,}\AttributeTok{Iintra=}\NormalTok{Iintra)}
|
||||
\FunctionTok{ggplot}\NormalTok{(df,}\FunctionTok{aes}\NormalTok{(}\AttributeTok{x=}\NormalTok{K,}\AttributeTok{y=}\NormalTok{Iintra))}\SpecialCharTok{+}
|
||||
\FunctionTok{geom\_line}\NormalTok{()}\SpecialCharTok{+}
|
||||
\FunctionTok{geom\_point}\NormalTok{()}\SpecialCharTok{+}
|
||||
\FunctionTok{xlab}\NormalTok{(}\StringTok{"Nombre de classes"}\NormalTok{)}\SpecialCharTok{+}
|
||||
\FunctionTok{ylab}\NormalTok{(}\StringTok{"Inertie intraclasse"}\NormalTok{)}
|
||||
\end{Highlighting}
|
||||
\end{Shaded}
|
||||
|
||||
\includegraphics{Projet_files/figure-latex/unnamed-chunk-17-1.pdf} nn
|
||||
pense dénoter un coude dans la courbe d'inertie intraclasse aux
|
||||
alentours de 4 clusters
|
||||
|
||||
\begin{Shaded}
|
||||
\begin{Highlighting}[]
|
||||
\NormalTok{Silhou}\OtherTok{\textless{}{-}}\ConstantTok{NULL}
|
||||
\ControlFlowTok{for}\NormalTok{ (k }\ControlFlowTok{in} \DecValTok{2}\SpecialCharTok{:}\NormalTok{Kmax)\{}
|
||||
\NormalTok{ aux}\OtherTok{\textless{}{-}}\FunctionTok{silhouette}\NormalTok{(reskmeanscl[,k}\DecValTok{{-}1}\NormalTok{], }\FunctionTok{daisy}\NormalTok{(s))}
|
||||
\NormalTok{ Silhou}\OtherTok{\textless{}{-}}\FunctionTok{c}\NormalTok{(Silhou,}\FunctionTok{mean}\NormalTok{(aux[,}\DecValTok{3}\NormalTok{]))}
|
||||
\NormalTok{\}}
|
||||
|
||||
\NormalTok{df}\OtherTok{\textless{}{-}}\FunctionTok{data.frame}\NormalTok{(}\AttributeTok{K=}\DecValTok{2}\SpecialCharTok{:}\NormalTok{Kmax,}\AttributeTok{Silhouette=}\NormalTok{Silhou)}
|
||||
\FunctionTok{ggplot}\NormalTok{(df,}\FunctionTok{aes}\NormalTok{(}\AttributeTok{x=}\NormalTok{K,}\AttributeTok{y=}\NormalTok{Silhouette))}\SpecialCharTok{+}
|
||||
\FunctionTok{geom\_point}\NormalTok{()}\SpecialCharTok{+}
|
||||
\FunctionTok{geom\_line}\NormalTok{()}\SpecialCharTok{+}\FunctionTok{theme}\NormalTok{(}\AttributeTok{legend.position =} \StringTok{"bottom"}\NormalTok{)}
|
||||
\end{Highlighting}
|
||||
\end{Shaded}
|
||||
|
||||
\includegraphics{Projet_files/figure-latex/unnamed-chunk-18-1.pdf}
|
||||
|
||||
\begin{Shaded}
|
||||
\begin{Highlighting}[]
|
||||
\NormalTok{aux}\OtherTok{\textless{}{-}}\FunctionTok{silhouette}\NormalTok{(reskmeanscl[,}\DecValTok{3{-}1}\NormalTok{], }\FunctionTok{daisy}\NormalTok{(s))}
|
||||
\FunctionTok{fviz\_silhouette}\NormalTok{(aux)}\SpecialCharTok{+}
|
||||
\FunctionTok{theme}\NormalTok{(}\AttributeTok{plot.title =} \FunctionTok{element\_text}\NormalTok{(}\AttributeTok{size =}\DecValTok{9}\NormalTok{))}
|
||||
\end{Highlighting}
|
||||
\end{Shaded}
|
||||
|
||||
\begin{verbatim}
|
||||
## cluster size ave.sil.width
|
||||
## 1 1 8 0.37
|
||||
## 2 2 16 0.53
|
||||
## 3 3 12 0.34
|
||||
\end{verbatim}
|
||||
|
||||
\includegraphics{Projet_files/figure-latex/unnamed-chunk-18-2.pdf}
|
||||
|
||||
\begin{Shaded}
|
||||
\begin{Highlighting}[]
|
||||
\FunctionTok{rm}\NormalTok{(df,Silhou,aux)}
|
||||
\end{Highlighting}
|
||||
\end{Shaded}
|
||||
|
||||
Silhouette fait un pic à 5 et pas 4 :/
|
||||
|
||||
\subsubsection{visualisation du
|
||||
clustering}\label{visualisation-du-clustering}
|
||||
|
||||
\begin{Shaded}
|
||||
\begin{Highlighting}[]
|
||||
\CommentTok{\#graphes des clusters}
|
||||
\NormalTok{res\_kmeans }\OtherTok{=} \FunctionTok{kmeans}\NormalTok{(s,}\DecValTok{4}\NormalTok{)}
|
||||
\FunctionTok{fviz\_cluster}\NormalTok{(res\_kmeans,}\AttributeTok{data=}\NormalTok{donnees\_transposees,}
|
||||
\AttributeTok{ellipse.type=}\StringTok{"norm"}\NormalTok{,}\AttributeTok{labelsize=}\DecValTok{8}\NormalTok{,}
|
||||
\AttributeTok{geom=}\FunctionTok{c}\NormalTok{(}\StringTok{"point"}\NormalTok{))}\SpecialCharTok{+}\FunctionTok{ggtitle}\NormalTok{(}\StringTok{"Visualisation des clusters générés par la méthode kmeans dnas le plan factoriel 1,2"}\NormalTok{)}
|
||||
\end{Highlighting}
|
||||
\end{Shaded}
|
||||
|
||||
\includegraphics{Projet_files/figure-latex/unnamed-chunk-19-1.pdf}
|
||||
|
||||
\begin{Shaded}
|
||||
\begin{Highlighting}[]
|
||||
\CommentTok{\# pour corréler à des variables qualitatives mais yen a pas la}
|
||||
|
||||
\CommentTok{\#adjustedRandIndex(T$ExpT1,res\_kmeans$cluster) }
|
||||
\CommentTok{\#adjustedRandIndex(T$ExpT2,res\_kmeans$cluster)}
|
||||
\CommentTok{\#adjustedRandIndex(T$ExpT3,res\_kmeans$cluster)}
|
||||
|
||||
\CommentTok{\#clust\textless{}{-}paste("Cl{-}K",res\_kmeans$cluster,sep="")}
|
||||
\CommentTok{\#Tab\textless{}{-}melt(table(clust,donnees\_transposees[,1]))}
|
||||
\CommentTok{\#ggplot(Tab,aes(y=value,axis1=clust,axis2=Var2))+}
|
||||
\CommentTok{\# geom\_alluvium(aes(fill=clust))+}
|
||||
\CommentTok{\# geom\_stratum(width = 1/12)+ }
|
||||
\CommentTok{\# geom\_text(stat = "stratum", aes(label = after\_stat(stratum)))+}
|
||||
\CommentTok{\# theme(legend.position = "none")}
|
||||
\CommentTok{\#chordDiagram(table(clust,donnees\_transposees[,2]))}
|
||||
\end{Highlighting}
|
||||
\end{Shaded}
|
||||
|
||||
On remaque bien 3 clusters
|
||||
|
||||
\subsubsection{PAM}\label{pam}
|
||||
|
||||
\begin{Shaded}
|
||||
\begin{Highlighting}[]
|
||||
\NormalTok{res }\OtherTok{=} \FunctionTok{pam}\NormalTok{(s,}\DecValTok{4}\NormalTok{,}\AttributeTok{metric=}\StringTok{"euclidean"}\NormalTok{)}
|
||||
\FunctionTok{fviz\_cluster}\NormalTok{(res,}\AttributeTok{data=}\NormalTok{donnees\_transposees,}
|
||||
\AttributeTok{ellipse.type=}\StringTok{"norm"}\NormalTok{,}\AttributeTok{labelsize=}\DecValTok{8}\NormalTok{,}
|
||||
\AttributeTok{geom=}\FunctionTok{c}\NormalTok{(}\StringTok{"point"}\NormalTok{))}\SpecialCharTok{+}\FunctionTok{ggtitle}\NormalTok{(}\StringTok{"Visualisation des clusters générés par la méthode PAM dnas le plan factoriel 1,2"}\NormalTok{)}
|
||||
\end{Highlighting}
|
||||
\end{Shaded}
|
||||
|
||||
\includegraphics{Projet_files/figure-latex/unnamed-chunk-20-1.pdf}
|
||||
|
||||
\subsubsection{clustering CAH}\label{clustering-cah}
|
||||
|
||||
\begin{Shaded}
|
||||
\begin{Highlighting}[]
|
||||
\NormalTok{dx}\OtherTok{\textless{}{-}}\FunctionTok{dist}\NormalTok{(donnees\_transposees,}\AttributeTok{method=}\StringTok{"euclidian"}\NormalTok{)}
|
||||
\NormalTok{hward}\OtherTok{\textless{}{-}}\FunctionTok{hclust}\NormalTok{(dx,}\AttributeTok{method =} \StringTok{"ward.D2"}\NormalTok{)}
|
||||
|
||||
|
||||
\FunctionTok{fviz\_dend}\NormalTok{(hward,}\AttributeTok{k=}\DecValTok{4}\NormalTok{,}
|
||||
\AttributeTok{show\_labels =} \ConstantTok{TRUE}\NormalTok{,}
|
||||
\AttributeTok{rect=}\ConstantTok{TRUE}\NormalTok{,}
|
||||
\AttributeTok{rect\_fill =} \ConstantTok{TRUE}\NormalTok{,}
|
||||
\AttributeTok{palette =} \StringTok{"npg"}\NormalTok{,}
|
||||
\AttributeTok{rect\_border =} \StringTok{"npg"}\NormalTok{,}
|
||||
\AttributeTok{labels\_track\_height =} \FloatTok{0.8}\NormalTok{)}\SpecialCharTok{+}\FunctionTok{ggtitle}\NormalTok{(}\StringTok{"Dendogramme du clustering de l\textquotesingle{}ACP des variables Tt en tant qu\textquotesingle{}individus, obtenu par méthode CAH"}\NormalTok{)}
|
||||
\end{Highlighting}
|
||||
\end{Shaded}
|
||||
|
||||
\begin{verbatim}
|
||||
## Warning: The `<scale>` argument of `guides()` cannot be `FALSE`. Use "none" instead as
|
||||
## of ggplot2 3.3.4.
|
||||
## i The deprecated feature was likely used in the factoextra package.
|
||||
## Please report the issue at <https://github.com/kassambara/factoextra/issues>.
|
||||
## This warning is displayed once every 8 hours.
|
||||
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
|
||||
## generated.
|
||||
\end{verbatim}
|
||||
|
||||
\includegraphics{Projet_files/figure-latex/unnamed-chunk-21-1.pdf}
|
||||
|
||||
\subsubsection{Comparaison des
|
||||
clusterings}\label{comparaison-des-clusterings}
|
||||
|
||||
On voit bien qu'à 4 classes, les regroupements ne sont pas consistents
|
||||
entre chaque méthode de clustering. A 3 classes nous obtenons une
|
||||
classification qui ne change pas, ou presque, entre chaque méthode. Nous
|
||||
décidons donc qu'il s'agit donc d'un bon choix de nombre de classes.
|
||||
|
||||
La classification obtenue est en accord avec les observations faites
|
||||
lors de l'ACP, on y retrouve plus ou moins les mêmes groupements : celui
|
||||
majoritarement composé des relevés de T1 avec une majorité de gènes sans
|
||||
changement d'expression relative, celui composé des relevés de T2 et T3
|
||||
aux heures des changements d'expression les plus brutaux, et finalement
|
||||
celui s'étalant sur la droite qui semble représenter la fin de
|
||||
l'évolution des traitements T2 et T3 où l'expression de gènes y est très
|
||||
polarisée.
|
||||
|
||||
\end{document}
|
||||
|
|
Завантаження…
Посилання в новій задачі